[asterisk-users] create table in mysql using asterisk

Danny Nicholas danny at debsinc.com
Mon Jan 9 10:37:12 CST 2012


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-bounces at lists.digium.com
[mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Tony
Mountifield
Sent: Monday, January 09, 2012 3:42 AM
To: asterisk-users at lists.digium.com
Subject: Re: [asterisk-users] create table in mysql using asterisk

In article <ACF1979B7D3CA54089C1ABDA3528B1F901DBC39A at media2.media.ltd>,
Eyal <eyal at 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: tony at softins.co.uk - http://www.softins.co.uk
Play: tony at 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




More information about the asterisk-users mailing list