Summary: | ASTERISK-05971: Cannot use multiple values with func_odbc | ||
Reporter: | Jason Parker (jparker) | Labels: | |
Date Opened: | 2006-01-04 00:18:01.000-0600 | Date Closed: | 2006-01-16 12:56:37.000-0600 |
Priority: | Minor | Regression? | No |
Status: | Closed/Complete | Components: | Functions/func_odbc |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ( 0) 20060105__app.c_quote_args.diff.txt | |
Description: | When using func_odbc and SET with the following syntax, only VAL1 is set. SET(ODBC_TESTSQL()=valA|valB) ****** ADDITIONAL INFORMATION ****** Per Corydon, the problem is because SET tries to use the "|" chars as it's own separator. This is proven when trying to use 3 values, such as SET(ODBC_TESTSQL()=valA|valB|valC), which causes this line of code to be hit. ast_log(LOG_WARNING, "Ignoring entry '%s' with no = (and not last 'options' entry)\n", name); Perhaps some type of escape handing, such as \| could be added, to allow such values to be passed to the function. | ||
Comments: | By: Tilghman Lesher (tilghman) 2006-01-04 00:34:35.000-0600 We've discussed a number of ways to fix this on IRC: 1) Change Set to only take a single name=value pair, and everything after the '=' gets passed verbatim. The option 'g' gets changed to use a function, namely: Set(GLOBAL(foo)=bar). If we really need to be able to set multiple values using a single application, then I propose using SetMultiple. 2) We could have a Set1 application that behaves in the manner that I suggest above in 1). 3) Add escaping of the delimiter for ast_app_separate_args(). Due to the escaping already done by pbx_config.c, this would make the syntax in the .conf file as Set(foo=bar\\\|baz), which is annoying at best and prone to errors at worst. 4) Values get passed to func_odbc as comma-delimited values, and we escape the commas in the .conf file: Set(ODBC_FOO()=bar\,baz\,bay). I like the first option the best, but it obviously breaks backwards compatibility. 2 and 4 are also good alternatives. 3 is an ugly hack. By: Tilghman Lesher (tilghman) 2006-01-04 00:36:30.000-0600 Kevin, can you take a look at this, please? By: Tilghman Lesher (tilghman) 2006-01-05 12:47:21.000-0600 Patch uploaded, for another alternative: Set(ODBC_FOO()="1|2|3") |