Hello,
There appears to be an issue with the exported pseudo variable $dbr(key=>rows). I am receiving rows back that are being populated into xavp via sql_xquery. However the result of $dbr(key=>rows) is zero.
Perhaps I am doing something wrong or sql_xquery does not populate the $dbr pseudo variable?
Thanks in advance.
Sincerely, Brandon Armstead
Hello,
Almost forgot to add - this is on Kamailio 3.2 --- checking master branch to see if there is any changes, but it does look like in 3.2 res->nrows & res->ncols is not being set.
On Mon, Nov 26, 2012 at 11:50 AM, Brandon Armstead brandon@cryy.com wrote:
Hello,
There appears to be an issue with the exported pseudo variable $dbr(key=>rows). I am receiving rows back that are being populated into xavp via sql_xquery. However the result of $dbr(key=>rows) is zero.
Perhaps I am doing something wrong or sql_xquery does not populate the $dbr pseudo variable?
Thanks in advance.
Sincerely, Brandon Armstead
Hello,
sql_xquery() does not set $dbr(...), but $xavp(...). And I don't think it sets any xavp with the number of rows and number of columns. The readme should have some examples, IIRC (not being the developer of this function).
Cheers, Daniel
On 11/26/12 9:16 PM, Brandon Armstead wrote:
Hello,
Almost forgot to add - this is on Kamailio 3.2 --- checking master branch to see if there is any changes, but it does look like in 3.2 res->nrows & res->ncols is not being set.
On Mon, Nov 26, 2012 at 11:50 AM, Brandon Armstead <brandon@cryy.com mailto:brandon@cryy.com> wrote:
Hello, There appears to be an issue with the exported pseudo variable $dbr(key=>rows). I am receiving rows back that are being populated into xavp via sql_xquery. However the result of $dbr(key=>rows) is zero. Perhaps I am doing something wrong or sql_xquery does not populate the $dbr pseudo variable? Thanks in advance. Sincerely, Brandon Armstead
sr-dev mailing list sr-dev@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Daniel,
Indeed this seems to be the case at least in 3.2 - I guess I assumed they would export the same pseudo variable access.
Is there any reason to use sql_xquery vs sql_query?
Looking through the source it seems they both now handle the same or similar data types?
Sincerely, Brandon Armstead
On Mon, Nov 26, 2012 at 12:21 PM, Daniel-Constantin Mierla < miconda@gmail.com> wrote:
Hello,
sql_xquery() does not set $dbr(...), but $xavp(...). And I don't think it sets any xavp with the number of rows and number of columns. The readme should have some examples, IIRC (not being the developer of this function).
Cheers, Daniel
On 11/26/12 9:16 PM, Brandon Armstead wrote:
Hello,
Almost forgot to add - this is on Kamailio 3.2 --- checking master
branch to see if there is any changes, but it does look like in 3.2 res->nrows & res->ncols is not being set.
On Mon, Nov 26, 2012 at 11:50 AM, Brandon Armstead brandon@cryy.comwrote:
Hello,
There appears to be an issue with the exported pseudo variable
$dbr(key=>rows). I am receiving rows back that are being populated into xavp via sql_xquery. However the result of $dbr(key=>rows) is zero.
Perhaps I am doing something wrong or sql_xquery does not populate the $dbr pseudo variable?
Thanks in advance.
Sincerely, Brandon Armstead
sr-dev mailing listsr-dev@lists.sip-router.orghttp://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
-- Daniel-Constantin Mierla - http://www.asipto.comhttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
On Monday 26 November 2012 21:29:10 Brandon Armstead wrote:
Is there any reason to use sql_xquery vs sql_query?
Looking through the source it seems they both now handle the same or similar data types?
It's not about datatypes, its about how you access the results.
sql_query() returns a resultset which can only be accessed by row and column _numbers_. Further, the resultset is gone after processing the message.
sql_qxuery() stores the resultset in named xavp's. The columns can be accessed by _name_. Because the resultset is in xavp's, it is stored in the transaction and can be (re)used in onreply_route and failure_route.
To be complete, there is also sql_pvquery(), which is like avp_db_query() on steroids. It allows the results to be assigned to arbitrary PV's instead of just avp's.
Which one you use depends on your use-case.
On Monday 26 November 2012 21:16:09 Brandon Armstead wrote:
Almost forgot to add - this is on Kamailio 3.2 --- checking master branch to see if there is any changes, but it does look like in 3.2 res->nrows & res->ncols is not being set.
These are for use with the result set obtained with sql_query(). sql_xquery() does not create such a result set, and thus can't set these counters.