add error checking on switch_core_db_column_text

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14323 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2009-07-22 20:47:52 +00:00
parent 75d09d83bb
commit 345fd7d996
1 changed files with 9 additions and 6 deletions

View File

@ -214,12 +214,15 @@ static JSBool db_fetch(JSContext * cx, JSObject * obj, uintN argc, jsval * argv,
return JS_TRUE;
}
for (x = 0; x < colcount; x++) {
switch_snprintf(code, sizeof(code), "~_dB_RoW_DaTa_[\"%s\"] = \"%s\"",
(char *) switch_core_db_column_name(dbo->stmt, x), (char *) switch_core_db_column_text(dbo->stmt, x));
eval_some_js(code, dbo->cx, dbo->obj, rval);
if (*rval == JS_FALSE) {
return JS_TRUE;
const char *var = (char *) switch_core_db_column_name(dbo->stmt, x);
const char *val = (char *) switch_core_db_column_text(dbo->stmt, x);
if (var && val) {
switch_snprintf(code, sizeof(code), "~_dB_RoW_DaTa_[\"%s\"] = \"%s\"", var, val);
eval_some_js(code, dbo->cx, dbo->obj, rval);
if (*rval == JS_FALSE) {
return JS_TRUE;
}
}
}