Re: [asterisk-users] Setting Multiple Values via func_odbc ...?

2007-12-06 Thread Alex Balashov


On Thu, 6 Dec 2007, Douglas Garstang wrote:

 I need to insert/update multiple MySQL columns in a single row with the 
 func_odbc function at the SAME TIME.

   If I understand your question correctly, this can be done using a 
standard SQL UPDATE query.

   UPDATE tblname SET col1 = val1, col2 = val2, .. WHERE field = criterion;

--
Alex Balashov
Evariste Systems
Web: http://www.evaristesys.com/
Tel: +1-678-954-0670
Direct : +1-678-954-0671

___
--Bandwidth and Colocation Provided by http://www.api-digital.com--

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Setting Multiple Values via func_odbc ...?

2007-12-06 Thread Douglas Garstang
Alex,

Yes, but the issue isn't MySQL. The issue is func_odbc and passing multiple 
values to it.

Douglas.

- Original Message 
From: Alex Balashov [EMAIL PROTECTED]
To: Asterisk Users Mailing List - Non-Commercial Discussion 
asterisk-users@lists.digium.com
Sent: Thursday, December 6, 2007 10:23:02 AM
Subject: Re: [asterisk-users] Setting Multiple Values via func_odbc ...?




On Thu, 6 Dec 2007, Douglas Garstang wrote:

 I need to insert/update multiple MySQL columns in a single row with
 the 
 func_odbc function at the SAME TIME.

   If I understand your question correctly, this can be done using a 
standard SQL UPDATE query.

   UPDATE tblname SET col1 = val1, col2 = val2, .. WHERE field =
 criterion;

--
Alex Balashov
Evariste Systems
Web: http://www.evaristesys.com/
Tel: +1-678-954-0670
Direct : +1-678-954-0671

___
--Bandwidth and Colocation Provided by http://www.api-digital.com--

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users






  

Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs___
--Bandwidth and Colocation Provided by http://www.api-digital.com--

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

[asterisk-users] Setting Multiple Values via func_odbc ...?

2007-12-06 Thread Douglas Garstang
I need to insert/update multiple MySQL columns in a single row with the 
func_odbc function at the SAME TIME.

Someone showed me how to use ARRAY to retrieve multiple values at the same 
time, but I need to SET multiple values.

Can this be done?

If not, I will just stick with MySQL, but that's a pain in the ass because the 
asterisk-addons package has no default rpm spec file for building an RPM.

I had something like this in func_odbc.conf:

[VOX_LOG_CALL_LEG]
dsn=MySQL
write=INSERT into CallLog (Source,IDDCode,AreaCode,ProviderId,SIPReply) values 
(${VAL1},${VAL2},${VAL3},${VAL4},${VAL5})

but it doesn't like it. In order for this to work, I'd have to have several 
LOG_CALL_LEG functions, each taking one parameter, and then requiring several 
database updates!

Doug.






  

Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs___
--Bandwidth and Colocation Provided by http://www.api-digital.com--

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Setting Multiple Values via func_odbc ...?

2007-12-06 Thread Tilghman Lesher
On Thursday 06 December 2007 12:20:54 Douglas Garstang wrote:
 I need to insert/update multiple MySQL columns in a single row with the
 func_odbc function at the SAME TIME.

 Someone showed me how to use ARRAY to retrieve multiple values at the same
 time, but I need to SET multiple values.

 Can this be done?

 If not, I will just stick with MySQL, but that's a pain in the ass because
 the asterisk-addons package has no default rpm spec file for building an
 RPM.

 I had something like this in func_odbc.conf:

 [VOX_LOG_CALL_LEG]
 dsn=MySQL
 write=INSERT into CallLog (Source,IDDCode,AreaCode,ProviderId,SIPReply)
 values (${VAL1},${VAL2},${VAL3},${VAL4},${VAL5})

 but it doesn't like it. In order for this to work, I'd have to have several
 LOG_CALL_LEG functions, each taking one parameter, and then requiring
 several database updates!

Yes, you can.  The issue is that Set is claiming the '|' character for itself,
which is masking the multiple values passed to func_odbc.  You need to
escape your commas with a backslash to ensure the multiple arguments
are seen by func_odbc:

Set(ODBC_VOX_CALL_LEG()=foo\,bar\,baz\,bay\,bax)

I suppose, just brainstorming, that you could also use an alternate delimiter
and break them up yourself with CUT:

[VOX_LOG_CALL_LEG]
dsn=MySQL
write=INSERT into CallLog (Source,IDDCode,AreaCode,ProviderId,SIPReply)
values (${CUT(VAL1,^,1)},${CUT(VAL1,^,2)},${CUT(VAL1,^,3},${CUT(VAL1,^,4)},
${CUT(VAL1,^,5)})

Set(ODBC_VOX_CALL_LEG()=foo^bar^baz^bay^bax)

That's assuming that you can ensure that other character won't be used in any
of your data fields.

BTW, this issue is solved in trunk (which will become 1.6) by limiting Set to
get only a single name/value pair.

-- 
Tilghman

___
--Bandwidth and Colocation Provided by http://www.api-digital.com--

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users