[Users] avp_db_load
Norman Brandinger
norm at goes.com
Tue Jan 23 19:13:31 CET 2007
Hi Brandon,
Perhaps if you use avp_db_query, you will have better luck.
The simple example below uses $fU instead of $rU and assumes that you
have a column in usr_preferences called "e911".
Hope this helps.
if (!avp_db_query("SELECT e911 FROM usr_preferences WHERE username =
'$fU'", "$avp(s:e911)")) {
xlog("L_NOTICE", "DATABASE ERROR avp_db_query() failed\n");
sl_send_reply("500", "Server Internal Error");
exit;
}
Regards,
Norm
Brandon Armstead wrote:
> Hello everyone,
>
> I'm trying to load an avp from the database, now from my
> understanding I
> simply use the avp_db_load() function. Now I previously setup my
> avp_table
> to be usr_preferences, now I'm doing the following:
>
> route[5]
> {
> xlog("L_INFO", "time [$Tf] method <$rm> r-uri <$ru> 2nd via
> <$hdr(via[1])>\n");
>
> avp_db_load("$rU/username", "$avp(s:e911)");
>
> xlog("L_INFO", "CURRENT AVP VALUE: $avp(s:e911)");
>
> if(is_avp_set("$avp(s:e911)"))
> {
> xlog("L_INFO", "CURRENT \$ru: $ru");
> avp_pushto("$ru", "$avp(s:e911)");
> xlog("L_INFO", "AFTER \$ru: $ru");
> }
>
> route(1);
> }
>
> For route 5, and I have a AVP row for 'e911' in the database, with the
> username, domain, and the attribute set, the attribute ofcourse being
> e911,
> type 0, and a value set. However, I keep getting NULL back for the
> AVP I'm
> trying to pull, does anyone care to explain what I'm doing wrong?
> Thanks.
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at openser.org
> http://openser.org/cgi-bin/mailman/listinfo/users
>
More information about the Users
mailing list