MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / sqlops_db_bind

Function sqlops_db_bind

modules/sqlops/sqlops_db.c:132–175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130
131
132int sqlops_db_bind(void)
133{
134 unsigned int i;
135
136 for(i=0;i<no_db_urls;i++) {
137 if (db_bind_mod(&db_urls[i].url, &db_urls[i].dbf )) {
138 LM_CRIT("cannot bind to database module for %.*s! "
139 "Did you load a database module ?\n",
140 db_urls[i].url.len,db_urls[i].url.s);
141 return -1;
142 }
143
144 if (!DB_CAPABILITY(db_urls[i].dbf, DB_CAP_ALL)) {
145 LM_CRIT("database modules (%.*s) does not "
146 "provide all functions needed by sqlops module\n",
147 db_urls[i].url.len,db_urls[i].url.s);
148 return -1;
149 }
150 }
151
152 /*
153 * we cannot catch the default DB url usage at fixup time
154 * as we do with the other bunch of extra sqlops DB URLs
155 *
156 * so just dig through the whole script tree
157 */
158 if (is_script_func_used("db_query", 1) ||
159 is_script_func_used("db_query", 2)) {
160 if (!DB_CAPABILITY(default_db_url->dbf, DB_CAP_RAW_QUERY)) {
161 LM_ERR("driver for DB URL [default] does not support "
162 "raw queries!\n");
163 return -1;
164 }
165 }
166
167 if (is_script_async_func_used("db_query", 1) ||
168 is_script_async_func_used("db_query", 2)) {
169 if (!DB_CAPABILITY(default_db_url->dbf, DB_CAP_ASYNC_RAW_QUERY))
170 LM_WARN("async() calls for DB URL [default] will work "
171 "in normal mode due to driver limitations\n");
172 }
173
174 return 0;
175}
176
177
178int sqlops_db_init(const str* db_table, str** db_cols)

Callers 1

sqlops_initFunction · 0.85

Calls 3

db_bind_modFunction · 0.85
is_script_func_usedFunction · 0.85

Tested by

no test coverage detected