db_http usage with avpops

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

db_http usage with avpops

Alex Massover
Hello,

I'm trying to understand what is the exact format of how to use db_http in case when the table version isn't defined on the module avpops (avp_db_load function).
I managed to work with auth_db since it only asks in http query for c=ha1 and I answer with "string\n ha1_hash".

But with avpops and custom table when I do:
avp_db_load("$avp(input_val)","$avp(result)/my_table");
it ask for c=value,attribute,type

Let's say I want to return string containing "test", but I can't figure out what is the exact format to return from the web server to make dbrow2avp() happy.

Here's a log (little bit modified to remove real data):

Dec  3 15:41:00 T800-883 /usr/sbin/opensips[12961]: DBG:db_http:do_http_op: Sent:http://server1/my_table/?k=uuid,attribute&v=my_data,result&c=value,attribute,type
Dec  3 15:41:00 T800-883 /usr/sbin/opensips[12961]: DBG:db_http:form_result: Called with : string#012test#012
Dec  3 15:41:00 T800-883 /usr/sbin/opensips[12961]: DBG:core:db_new_result: allocate 48 bytes for result set at 0x7f9cbb136148
Dec  3 15:41:00 T800-883 /usr/sbin/opensips[12961]: DBG:core:db_allocate_rows: allocate 80 bytes for result rows and values at 0x7f9cbb136af0
Dec  3 15:41:00 T800-883 /usr/sbin/opensips[12961]: DBG:db_http:put_type_in_result: Found type: string 6
Dec  3 15:41:00 T800-883 /usr/sbin/opensips[12961]: DBG:db_http:put_value_in_result: Found value: test
Dec  3 15:41:00 T800-883 /usr/sbin/opensips[12961]: DBG:db_http:form_result: Finished query
Dec  3 15:41:00 T800-883 /usr/sbin/opensips[12961]: ERROR:avpops:dbrow2avp: wrong field types in dbrow

I'd appreciate if someone could enlighten me what is the format to return strings and ints in the  format c=value,attribute,type.

--
Best Regards,
Alex Massover


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: db_http usage with avpops

Bogdan-Andrei Iancu-2
Hi Alex,

The avp_db_load() function queries for "value", "attribute" and "type"
fields and expects STRING, STRING, INT data types for them.

Let me know if this helps you or if you need more info.

Regards,

Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com


On 12/04/2012 03:42 PM, Alex Massover wrote:

> Hello,
>
> I'm trying to understand what is the exact format of how to use db_http in case when the table version isn't defined on the module avpops (avp_db_load function).
> I managed to work with auth_db since it only asks in http query for c=ha1 and I answer with "string\n ha1_hash".
>
> But with avpops and custom table when I do:
> avp_db_load("$avp(input_val)","$avp(result)/my_table");
> it ask for c=value,attribute,type
>
> Let's say I want to return string containing "test", but I can't figure out what is the exact format to return from the web server to make dbrow2avp() happy.
>
> Here's a log (little bit modified to remove real data):
>
> Dec  3 15:41:00 T800-883 /usr/sbin/opensips[12961]: DBG:db_http:do_http_op:  Sent:http://server1/my_table/?k=uuid,attribute&v=my_data,result&c=value,attribute,type
> Dec  3 15:41:00 T800-883 /usr/sbin/opensips[12961]: DBG:db_http:form_result:  Called with : string#012test#012
> Dec  3 15:41:00 T800-883 /usr/sbin/opensips[12961]: DBG:core:db_new_result: allocate 48 bytes for result set at 0x7f9cbb136148
> Dec  3 15:41:00 T800-883 /usr/sbin/opensips[12961]: DBG:core:db_allocate_rows: allocate 80 bytes for result rows and values at 0x7f9cbb136af0
> Dec  3 15:41:00 T800-883 /usr/sbin/opensips[12961]: DBG:db_http:put_type_in_result:  Found type: string 6
> Dec  3 15:41:00 T800-883 /usr/sbin/opensips[12961]: DBG:db_http:put_value_in_result:  Found value: test
> Dec  3 15:41:00 T800-883 /usr/sbin/opensips[12961]: DBG:db_http:form_result:  Finished query
> Dec  3 15:41:00 T800-883 /usr/sbin/opensips[12961]: ERROR:avpops:dbrow2avp: wrong field types in dbrow
>
> I'd appreciate if someone could enlighten me what is the format to return strings and ints in the  format c=value,attribute,type.
>
> --
> Best Regards,
> Alex Massover
>
>
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users