| |||||||||||||||||||||||||||||||
|
> 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
| ||||||||||||||||||||||||||||||
© 2004-2008 readlist.com