diff options
author | 2023-01-22 19:35:32 -0800 | |
---|---|---|
committer | 2023-01-22 19:35:32 -0800 | |
commit | 771db64cbe8ce24d9068812c3e00e7a4612e5c04 (patch) | |
tree | afbcd98e7ca3000921d4bd226c95c97f216c13f9 /src/bun.js/bindings/sqlite/JSSQLStatement.cpp | |
parent | c6b941d803cc5a09fafee8ad7c1c5fb29b3c4847 (diff) | |
download | bun-771db64cbe8ce24d9068812c3e00e7a4612e5c04.tar.gz bun-771db64cbe8ce24d9068812c3e00e7a4612e5c04.tar.zst bun-771db64cbe8ce24d9068812c3e00e7a4612e5c04.zip |
[bun:sqlite] cleanup `run`
Diffstat (limited to 'src/bun.js/bindings/sqlite/JSSQLStatement.cpp')
-rw-r--r-- | src/bun.js/bindings/sqlite/JSSQLStatement.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/bun.js/bindings/sqlite/JSSQLStatement.cpp b/src/bun.js/bindings/sqlite/JSSQLStatement.cpp index 39f1f42ed..d19009e01 100644 --- a/src/bun.js/bindings/sqlite/JSSQLStatement.cpp +++ b/src/bun.js/bindings/sqlite/JSSQLStatement.cpp @@ -1461,14 +1461,17 @@ JSC_DEFINE_HOST_FUNCTION(jsSQLStatementExecuteStatementFunctionRun, (JSC::JSGlob initializeColumnNames(lexicalGlobalObject, castedThis); } - if (status == SQLITE_ROW || status == SQLITE_DONE) { - // sqlite3_reset(stmt); - RELEASE_AND_RETURN(scope, JSC::JSValue::encode(jsUndefined())); - } else { + while (status == SQLITE_ROW) { + status = sqlite3_step(stmt); + } + + if (UNLIKELY(status != SQLITE_DONE)) { sqlite3_reset(stmt); throwException(lexicalGlobalObject, scope, createError(lexicalGlobalObject, WTF::String::fromUTF8(sqlite3_errstr(status)))); return JSValue::encode(jsUndefined()); } + + RELEASE_AND_RETURN(scope, JSC::JSValue::encode(jsUndefined())); } JSC_DEFINE_HOST_FUNCTION(jsSQLStatementToStringFunction, (JSC::JSGlobalObject * lexicalGlobalObject, JSC::CallFrame* callFrame)) |