| 3407 | } |
| 3408 | |
| 3409 | static int dbstmt_exec(Lua lua) |
| 3410 | { |
| 3411 | SP sp = getsp(lua); |
| 3412 | sqlite3 *sqldb = getdb(sp); |
| 3413 | |
| 3414 | luaL_checkudata(lua, 1, dbtypes.dbstmt); |
| 3415 | dbstmt_t *dbstmt = lua_touserdata(lua, 1); |
| 3416 | no_stmt_chk(lua, dbstmt); |
| 3417 | setup_first_sqlite_step(sp, dbstmt, 0); |
| 3418 | sqlite3_stmt *stmt = dbstmt->stmt; |
| 3419 | int rc; |
| 3420 | lua_begin_step(sp->clnt, sp, stmt); |
| 3421 | while ((rc = sqlite3_maybe_step(sp->clnt, stmt)) == SQLITE_ROW) { |
| 3422 | lua_another_step(sp->clnt, stmt, rc); |
| 3423 | } |
| 3424 | lua_end_step(sp->clnt, sp, stmt); |
| 3425 | dbstmt->rows_changed = sqlite3_changes(sqldb); |
| 3426 | if (rc == SQLITE_DONE) { |
| 3427 | sqlite3_reset(stmt); |
| 3428 | db_reset(lua); |
| 3429 | lua_pushinteger(lua, 0); |
| 3430 | return 1; |
| 3431 | } |
| 3432 | const char *errstr = NULL; |
| 3433 | sql_check_errors(sp->clnt, sqldb, stmt, &errstr); |
| 3434 | donate_stmt(getsp(lua), dbstmt); |
| 3435 | return luabb_error(lua, sp, errstr); |
| 3436 | } |
| 3437 | |
| 3438 | static int dbstmt_fetch(Lua lua) |
| 3439 | { |
nothing calls this directly
no test coverage detected