##### opensips.cfg
```
# ----- drouting -----
modparam("drouting", "db_url", "sqlite://var/db/opensips")
```
##### opensips.log
```
Apr 18 15:39:39 localhost opensips: INFO:drouting:dr_init: Dynamic-Routing -
initializing
Apr 18 15:39:39 localhost opensips: ERROR:db_sqlite:db_sqlite_query: failed to
prepare: (no such table: version)
Apr 18 15:39:39 localhost opensips: ERROR:db_sqlite:db_sqlite_get_query_rows:
failed to prepare query
```
##### opens incorrect sqlite db handler:
```
# ls -al /var/db
-rw-r--r-- 1 root root 0 Apr 18 15:28 opensips? <-- this is created
```
##### gdb
```
(gdb) break modules/db_sqlite/dbase.c:162
(gdb) print _h->url
$2 = {s = 0x7ffff7431bd0 "sqlite://var/db/opensips8", len = 24}
(gdb) print query_holder
$3 = {s = 0x852740 <sql_buf> "select table_version from version where
table_name='dr_gateways's", len = 64}
167 if (ret!=SQLITE_OK)
(gdb) s
168 LM_ERR("failed to prepare: (%s)\n",
sqlite3_errmsg(CON_CONNECTION(_h)));
(gdb) print ret
$4 = 1
```
##### Synopsis
Seems like the pointer arithmetic in val2str for type DB_STR
(modules/db_sqlite/val.c:229) is off (the trailing s is from the previous
sql_buf that dialog populates however the length is correct), but the other
issue is its not accessing the proper db_url string that is set correctly.
It's weird that the other modules do not seem to have this issue.
For example, dialog is the first to load, and the gdb printout of _h->url
returns the same data for its query and everything else seems ok. Perhaps
there is an invalid or lacking CON_<X> macro call?
---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/issues/471
_______________________________________________
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel