[OpenSER-Users] avp_db_query problem

Jeremy George jeremy at georgeco.us
Wed Dec 26 22:32:36 CET 2007


Hello All,

I expect I have a syntax fluff with an avp_db_query() example, but I can't
find it. A pointer to the solution would be greatly appreciated.

I'm running mysql 5:

Spongy% mysql -V
mysql Ver 14.12 Distrib 5.0.27, for pc-linux-gnu (i686) using readline 5.0

and openser 1.3.0:

Spongy% openser -V
version: openser 1.3.0-tls (i386/linux)
flags: STATS: Off, USE_IPV6, USE_TCP, USE_TLS, DISABLE_NAGLE, USE_MCAST, SHM_MEM, SHM_MMAP, PKG_MALLOC, F_MALLOC, FAST_LOCK-ADAPTIVE_WAIT
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
svnrevision: unknown
@(#) $Id: main.c 3304 2007-12-11 12:55:11Z bogdan_iancu $
main.c compiled on 12:09:35 Dec 14 2007 with gcc 3.4.6


A direct query of the mysql usr_preferences table works as expected:

mysql> select attribute, value from usr_preferences where username='55555' order by attribute;
+-----------+-------+
| attribute | value |
+-----------+-------+
| 1 | 55510 |
| 2 | 55520 |
| 3 | 55530 |
| 4 | 55540 |
| 5 | 55500 |
+-----------+-------+
5 rows in set (0.00 sec)

This configuration taken almost directly from avp_db_query.html

mpath="/usr/local/lib/openser/modules"
...
loadmodule "mysql.so"
loadmodule "avpops.so"
loadmodule "xlog.so"
...

avp_delete("*");
if (avp_db_query("SELECT attribute, value
FROM usr_preferences
WHERE username='55555'
ORDER BY attribute")) {

xlog("L_NOTICE", "avp(i:1[1])=$avp(i:1[1]) avp(i:2[1])=$avp(i:2[1])\n");
xlog("L_NOTICE", "avp(i:1[2])=$avp(i:1[2]) avp(i:2[2])=$avp(i:2[2])\n");
xlog("L_NOTICE", "avp(i:1[3])=$avp(i:1[3]) avp(i:2[3])=$avp(i:2[3])\n");
xlog("L_NOTICE", "avp(i:1[4])=$avp(i:1[4]) avp(i:2[4])=$avp(i:2[4])\n");
xlog("L_NOTICE", "avp(i:1[5])=$avp(i:1[5]) avp(i:2[5])=$avp(i:2[5])\n");

} else {
xlog("L_NOTICE", "avp_db_query() returned no records\n");
};

produces these errors:

Dec 26 14:16:28 [25226] WARNING:core:main: no fork mode
Dec 26 14:16:28 [25226] INFO:core:init_tcp: using epoll_lt as the TCP io watch method (auto detected)
Dec 26 14:16:28 [25226] NOTICE:core:main: version: openser 1.3.0-tls (i386/linux)
Dec 26 14:16:28 [25226] INFO:core:main: using 32 Mb shared memory
Dec 26 14:16:28 [25226] INFO:core:main: using 1 Mb private memory per process
Dec 26 14:16:28 [25226] INFO:sl:mod_init: Initializing StateLess engine
Dec 26 14:16:28 [25226] INFO:tm:mod_init: TM - initializing...
Dec 26 14:16:28 [25226] INFO:acc:mod_init: initializing...
Dec 26 14:16:28 [25226] INFO:maxfwd:mod_init: initializing...
Dec 26 14:16:28 [25226] INFO:usrloc:ul_init_locks: locks array size 512
Dec 26 14:16:28 [25226] INFO:registrar:mod_init: initializing...
Dec 26 14:16:28 [25226] INFO:auth:mod_init: initializing...
Dec 26 14:16:28 [25226] INFO:auth_db:mod_init: initializing...
Dec 26 14:16:28 [25226] INFO:textops:mod_init: initializing...
Dec 26 14:16:28 [25226] INFO:exec:mod_init: exec - initializing
Dec 26 14:16:28 [25226] INFO:options:mod_init: initializing...
Dec 26 14:16:28 [25226] INFO:avpops:avpops_init: initializing...
Dec 26 14:16:28 [25226] INFO:xlog:mod_init: initializing...
Dec 26 14:16:28 [25226] ERROR:core:parse_avp_name: invalid ID <1[1]> not a number
Dec 26 14:16:28 [25226] ERROR:core:pv_parse_avp_name: bad avp name [1[1]]
Dec 26 14:16:28 [25226] ERROR:core:pv_parse_spec: pvar "avp" has an invalid name param [1[1]]
Dec 26 14:16:28 [25226] ERROR:core:pv_parse_spec: wrong char [)/41] in [$avp(i:1[1]) avp(i:2[1])=$avp(i:2[1])
] at [11 (5)]
Dec 26 14:16:28 [25226] ERROR:xlog:xdbg_fixup: ERROR: wrong format[avp(i:1[1])=$avp(i:1[1]) avp(i:2[1])=$avp(i:2[1])
]
Dec 26 14:16:28 [25226] ERROR:core:fix_actions: fixing failed (code=-1) at cfg line 288
Dec 26 14:16:28 [25226] ERROR:core:main: failed to fix configuration with err code -1


Thanks much for any help.

- Jeremy







More information about the Users mailing list