Re: [asterisk-users] create table in mysql using asterisk
Thanks But that's not the problem, I also tried without the quotes and still the error appears only this time it is like this app_addon_sql_mysql.c:383 aMYSQL_query: aMYSQL_query: mysql_query failed. Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 -Original Message- From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of James Sharp Sent: Monday, January 09, 2012 9:56 AM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [asterisk-users] create table in mysql using asterisk On 01/09/2012 02:44 AM, Eyal wrote: Hi, I try to create a new table using MYSQL command in asterisk. This is what i write: *Query resultid ${connid} CREATE TABLE IF NOT EXISTS conference_600 (id int(11) NOT NULL auto_increment, channel_id varchar(40), number_in_line int(2), PRIMARY KEY(id))* and this is the warning that i get in the cli: *app_addon_sql_mysql.c:383 aMYSQL_query: aMYSQL_query: mysql_query failed. Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'conference_600 (id int(11) NOT NULL auto_increment, channel_id varchar(40)' at line 1 * What is the problem do you think? Do I in the direction or have a completely different way to do this? That's a MySQL syntax error, not an Asterisk error. However, the solution is to not put quotes around your table and field names. That will make MySQL happy. -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] create table in mysql using asterisk
On Mon, Jan 09, 2012 at 10:09:40AM +0200, Eyal wrote: On Monday, January 09, 2012 9:56 AM, James Sharp wrote: On 01/09/2012 02:44 AM, Eyal wrote: Hi, I try to create a new table using MYSQL command in asterisk. This is what i write: *Query resultid ${connid} CREATE TABLE IF NOT EXISTS conference_600 (id int(11) NOT NULL auto_increment, channel_id varchar(40), number_in_line int(2), PRIMARY KEY(id))* and this is the warning that i get in the cli: *app_addon_sql_mysql.c:383 aMYSQL_query: aMYSQL_query: mysql_query failed. Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'conference_600 (id int(11) NOT NULL auto_increment, channel_id varchar(40)' at line 1 * What is the problem do you think? Do I in the direction or have a completely different way to do this? That's a MySQL syntax error, not an Asterisk error. However, the solution is to not put quotes around your table and field names. That will make MySQL happy. Thanks But that's not the problem, I also tried without the quotes and still the error appears only this time it is like this app_addon_sql_mysql.c:383 aMYSQL_query: aMYSQL_query: mysql_query failed. Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 And you tested that query outside of Asterisk? BTW: why would you create a table from within the Asterisk dialplan? -- Tzafrir Cohen icq#16849755 jabber:tzafrir.co...@xorcom.com +972-50-7952406 mailto:tzafrir.co...@xorcom.com http://www.xorcom.com iax:gu...@local.xorcom.com/tzafrir -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] create table in mysql using asterisk
In article acf1979b7d3ca54089c1abda3528b1f901dbc...@media2.media.ltd, Eyal e...@mcr-m.com wrote: I try to create a new table using MYSQL command in asterisk. This is what i write: Query resultid ${connid} CREATE TABLE IF NOT EXISTS conference_600 (id int(11) NOT NULL auto_increment, channel_id varchar(40), number_in_line int(2), PRIMARY KEY(id)) and this is the warning that i get in the cli: app_addon_sql_mysql.c:383 aMYSQL_query: aMYSQL_query: mysql_query failed. Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'conference_600 (id int(11) NOT NULL auto_increment, channel_id varchar(40)' at line 1 What is the problem do you think? Do I in the direction or have a completely different way to do this? Yes, you need to solve your problem in a completely different way. You appear to be wanting to create a new table for each conference, with the table containing a row for each channel that is a member of the conference. You don't need to do that at all. Just have a single table, with an additional column containing your conference number. Then you only need to create the table once, outside of Asterisk, and within Asterisk you only need to write rows into the table, putting the conference number into the additional column instead of using it as part of the table name. Hope this helps! Tony -- Tony Mountifield Work: t...@softins.co.uk - http://www.softins.co.uk Play: t...@mountifield.org - http://tony.mountifield.org -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] create table in mysql using asterisk
O.P. doesn't state his Asterisk version, but in 10.0(beta) I had a similar problem where sqlite3 couldn't create the new Asterisk DB. From what I read in the archives, we really could use a guru to thoroughly pound these DB statements to make them a bit more bullet-proof. -Original Message- From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Tony Mountifield Sent: Monday, January 09, 2012 3:42 AM To: asterisk-users@lists.digium.com Subject: Re: [asterisk-users] create table in mysql using asterisk In article acf1979b7d3ca54089c1abda3528b1f901dbc...@media2.media.ltd, Eyal e...@mcr-m.com wrote: I try to create a new table using MYSQL command in asterisk. This is what i write: Query resultid ${connid} CREATE TABLE IF NOT EXISTS conference_600 (id int(11) NOT NULL auto_increment, channel_id varchar(40), number_in_line int(2), PRIMARY KEY(id)) and this is the warning that i get in the cli: app_addon_sql_mysql.c:383 aMYSQL_query: aMYSQL_query: mysql_query failed. Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'conference_600 (id int(11) NOT NULL auto_increment, channel_id varchar(40)' at line 1 What is the problem do you think? Do I in the direction or have a completely different way to do this? Yes, you need to solve your problem in a completely different way. You appear to be wanting to create a new table for each conference, with the table containing a row for each channel that is a member of the conference. You don't need to do that at all. Just have a single table, with an additional column containing your conference number. Then you only need to create the table once, outside of Asterisk, and within Asterisk you only need to write rows into the table, putting the conference number into the additional column instead of using it as part of the table name. Hope this helps! Tony -- Tony Mountifield Work: t...@softins.co.uk - http://www.softins.co.uk Play: t...@mountifield.org - http://tony.mountifield.org -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] create table in mysql using asterisk
On Monday 09 January 2012, Danny Nicholas wrote: O.P. doesn't state his Asterisk version, but in 10.0(beta) I had a similar problem where sqlite3 couldn't create the new Asterisk DB. From what I read in the archives, we really could use a guru to thoroughly pound these DB statements to make them a bit more bullet-proof. -Original Message- From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Tony Mountifield Sent: Monday, January 09, 2012 3:42 AM To: asterisk-users@lists.digium.com Subject: Re: [asterisk-users] create table in mysql using asterisk In article acf1979b7d3ca54089c1abda3528b1f901dbc...@media2.media.ltd, Eyal e...@mcr-m.com wrote: I try to create a new table using MYSQL command in asterisk. This is what i write: Query resultid ${connid} CREATE TABLE IF NOT EXISTS conference_600 (id int(11) NOT NULL auto_increment, channel_id varchar(40), number_in_line int(2), PRIMARY KEY(id)) and this is the warning that i get in the cli: app_addon_sql_mysql.c:383 aMYSQL_query: aMYSQL_query: mysql_query failed. Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'conference_600 (id int(11) NOT NULL auto_increment, channel_id varchar(40)' at line 1 What is the problem do you think? Do I in the direction or have a completely different way to do this? Yes, you need to solve your problem in a completely different way. You appear to be wanting to create a new table for each conference, with the table containing a row for each channel that is a member of the conference. You don't need to do that at all. Just have a single table, with an additional column containing your conference number. Then you only need to create the table once, outside of Asterisk, and within Asterisk you only need to write rows into the table, putting the conference number into the additional column instead of using it as part of the table name. That's because your syntax is wrong. Strict ANSI SQL specifies 'single speech marks' around values, and no reserved words in field names. There are two non-standard extensions that have grown up since then. PostgreSQL allows you to use double speech marks around a field name with a reserved word in it (like your example above). MySQL accepts double speech marks around *values* as an alternative to 'single speech marks'. If you need to use a reserved word in a field name, you need to use `backward speech marks` (old-fashioned shorthand for command output) around the field name. -- AJS Answers come *after* questions. -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] create table in mysql using asterisk
On Mon, 9 Jan 2012, A J Stiles wrote: Strict ANSI SQL specifies 'single speech marks' around values, and no reserved words in field names. Is this a UK'ism? I've never seen a 'quotation mark' (single or double) referred to as a 'speech mark.' -- Thanks in advance, - Steve Edwards sedwa...@sedwards.com Voice: +1-760-468-3867 PST Newline Fax: +1-760-731-3000 -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] create table in mysql using asterisk
In article alpine.DEB.2.00.1201091001320.16313@localhost.localdomain, Steve Edwards asterisk@sedwards.com wrote: On Mon, 9 Jan 2012, A J Stiles wrote: Strict ANSI SQL specifies 'single speech marks' around values, and no reserved words in field names. Is this a UK'ism? I've never seen a 'quotation mark' (single or double) referred to as a 'speech mark.' It probably is, then, as I'm in the UK and it sounded normal to me! Although personally I call them single-quotes and double-quotes. When I was young they were often called inverted commas too. Cheers Tony -- Tony Mountifield Work: t...@softins.co.uk - http://www.softins.co.uk Play: t...@mountifield.org - http://tony.mountifield.org -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] create table in mysql using asterisk
On Mon, Jan 09, 2012 at 10:37:12AM -0600, Danny Nicholas wrote: O.P. doesn't state his Asterisk version, but in 10.0(beta) I had a similar problem where sqlite3 couldn't create the new Asterisk DB. From what I read in the archives, we really could use a guru to thoroughly pound these DB statements to make them a bit more bullet-proof. You seem to be confusing MySQL with the internal astdb (originally an old Berkeley DB, replaced in 10 with SQLite). -- Tzafrir Cohen icq#16849755 jabber:tzafrir.co...@xorcom.com +972-50-7952406 mailto:tzafrir.co...@xorcom.com http://www.xorcom.com iax:gu...@local.xorcom.com/tzafrir -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
[asterisk-users] create table in mysql using asterisk
Hi, I try to create a new table using MYSQL command in asterisk. This is what i write: Query resultid ${connid} CREATE TABLE IF NOT EXISTS conference_600 (id int(11) NOT NULL auto_increment, channel_id varchar(40), number_in_line int(2), PRIMARY KEY(id)) and this is the warning that i get in the cli: app_addon_sql_mysql.c:383 aMYSQL_query: aMYSQL_query: mysql_query failed. Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'conference_600 (id int(11) NOT NULL auto_increment, channel_id varchar(40)' at line 1 What is the problem do you think? Do I in the direction or have a completely different way to do this? -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] create table in mysql using asterisk
On 01/09/2012 02:44 AM, Eyal wrote: Hi, I try to create a new table using MYSQL command in asterisk. This is what i write: *Query resultid ${connid} CREATE TABLE IF NOT EXISTS conference_600 (id int(11) NOT NULL auto_increment, channel_id varchar(40), number_in_line int(2), PRIMARY KEY(id))* and this is the warning that i get in the cli: *app_addon_sql_mysql.c:383 aMYSQL_query: aMYSQL_query: mysql_query failed. Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'conference_600 (id int(11) NOT NULL auto_increment, channel_id varchar(40)' at line 1 * What is the problem do you think? Do I in the direction or have a completely different way to do this? That's a MySQL syntax error, not an Asterisk error. However, the solution is to not put quotes around your table and field names. That will make MySQL happy. -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users