Hi List
Via sql_xquery I get a stacked xavp aka array.
I would like to store that stacked xavp into a hash table for later usage in other transactions. Is this possible?
Via xarp_parameters explode or implode does not work as that would stringy the same key multiple times.
Mit freundlichen Grüssen
-Benoît Panizzon-
On 25 Jan 2024, at 06:34, Benoit Panizzon via sr-users sr-users@lists.kamailio.org wrote:
Hi List
Via sql_xquery I get a stacked xavp aka array.
I would like to store that stacked xavp into a hash table for later usage in other transactions. Is this possible?
You can always iterate through the XAVP array manually and perform your own data marshalling:
sql_xquery("db", "SELECT ...", "stuff");
$var(i) = 0;
while(defined $xavp(stuff[$var(i)])) { $sht(tbl=>$xavp(stuff[$var(i)]=>id)) = $xavp(stuff[$var(i)]=>otherval); $var(i) = $var(i) + 1; }
etc.
-- Alex
Hi Alex
sql_xquery("db", "SELECT ...", "stuff"); $var(i) = 0; while(defined $xavp(stuff[$var(i)])) { $sht(tbl=>$xavp(stuff[$var(i)]=>id)) =
$xavp(stuff[$var(i)]=>otherval); $var(i) = $var(i) + 1; }
etc.
Thank you. So there is no 'direct' way I missed. Ok, I'll find a way around ;-)
Hello,
just for completeness, the htable module also offers the possibility to read values (at startup and/or triggered from a command) from a database. Especially for values that did not change to often this is a good option.
Cheers,
Henning