Made sure that SQL errors make it to the client.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3867 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2022-04-18 00:24:00 +00:00
parent 11ad344e52
commit 804359d12e
6 changed files with 53 additions and 36 deletions

View File

@ -177,21 +177,23 @@ static void _tf_ssb_sqlStream_callback(JSValue row, void* user_data)
static JSValue _tf_ssb_sqlStream(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
{
JSValue result = JS_NULL;
tf_ssb_t* ssb = JS_GetOpaque(this_val, _tf_ssb_classId);
if (ssb)
{
const char* query = JS_ToCString(context, argv[0]);
if (query)
{
sqlStream_callback_t info = {
sqlStream_callback_t info =
{
.context = context,
.callback = argv[2],
};
tf_ssb_db_visit_query(ssb, query, argv[1], _tf_ssb_sqlStream_callback, &info);
result = tf_ssb_db_visit_query(ssb, query, argv[1], _tf_ssb_sqlStream_callback, &info);
JS_FreeCString(context, query);
}
}
return JS_NULL;
return result;
}
static JSValue _tf_ssb_post(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)