[SR-Users] Re: How to assign xavp array to htable?

2024-01-26 Thread Henning Westerholt via sr-users
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


-- 
Henning Westerholt – https://skalatan.de/blog/
Kamailio services – https://gilawa.com



> -Original Message-
> From: Benoît Panizzon via sr-users 
> Sent: Freitag, 26. Januar 2024 08:17
> To: Alex Balashov via sr-users 
> Cc: Benoît Panizzon 
> Subject: [SR-Users] Re: How to assign xavp array to htable?
> 
> 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 
> ;-)
> 
> --
> Mit freundlichen Grüssen
> 
> -Benoît Panizzon- @ HomeOffice und normal erreichbar
> --
> I m p r o W a r e   A G-Leiter Commerce Kunden
> __
> 
> Zurlindenstrasse 29 Tel  +41 61 826 93 00
> CH-4133 PrattelnFax  +41 61 826 93 01
> Schweiz Web  http://www.imp.ch
> __
> __
> Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe send
> an email to sr-users-le...@lists.kamailio.org
> Important: keep the mailing list in the recipients, do not reply only to the 
> sender!
> Edit mailing list options or unsubscribe:
__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] Re: How to assign xavp array to htable?

2024-01-25 Thread Benoît Panizzon via sr-users
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 ;-)

-- 
Mit freundlichen Grüssen

-Benoît Panizzon- @ HomeOffice und normal erreichbar
-- 
I m p r o W a r e   A G-Leiter Commerce Kunden
__

Zurlindenstrasse 29 Tel  +41 61 826 93 00
CH-4133 PrattelnFax  +41 61 826 93 01
Schweiz Web  http://www.imp.ch
__
__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:


[SR-Users] Re: How to assign xavp array to htable?

2024-01-25 Thread Alex Balashov via sr-users



> On 25 Jan 2024, at 06:34, Benoit Panizzon via sr-users 
>  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

-- 
Alex Balashov
Principal Consultant
Evariste Systems LLC
Web: https://evaristesys.com
Tel: +1-706-510-6800

__
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe: