simplified statement_reset
This commit is contained in:
@@ -49,7 +49,10 @@ typedef struct tsqlite_statement {
|
|||||||
/// @return compiled statement
|
/// @return compiled statement
|
||||||
Result(tsqlite_statement*) tsqlite_statement_compile(tsqlite_connection* conn, str sql_code);
|
Result(tsqlite_statement*) tsqlite_statement_compile(tsqlite_connection* conn, str sql_code);
|
||||||
|
|
||||||
void tsqlite_statement_free(tsqlite_statement* st);
|
void tsqlite_statement_free(NULLABLE(tsqlite_statement*) st);
|
||||||
|
|
||||||
|
/// call this after executing a compiled statement to use it again
|
||||||
|
void tsqlite_statement_reset(NULLABLE(tsqlite_statement*) st);
|
||||||
|
|
||||||
/// @brief execute statement or move to next result row.
|
/// @brief execute statement or move to next result row.
|
||||||
/// Documentation: https://sqlite.org/c3ref/step.html
|
/// Documentation: https://sqlite.org/c3ref/step.html
|
||||||
@@ -66,9 +69,6 @@ void tsqlite_statement_free(tsqlite_statement* st);
|
|||||||
/// @return is result row avaliable
|
/// @return is result row avaliable
|
||||||
Result(bool) tsqlite_statement_step(tsqlite_statement* self);
|
Result(bool) tsqlite_statement_step(tsqlite_statement* self);
|
||||||
|
|
||||||
/// call this after executing a compiled statement to use it again
|
|
||||||
Result(void) tsqlite_statement_reset(tsqlite_statement* st);
|
|
||||||
|
|
||||||
/// Bind value to a placeholder
|
/// Bind value to a placeholder
|
||||||
Result(void) tsqlite_statement_bind_null(tsqlite_statement* self, cstr key);
|
Result(void) tsqlite_statement_bind_null(tsqlite_statement* self, cstr key);
|
||||||
Result(void) tsqlite_statement_bind_i64(tsqlite_statement* self, cstr key, i64 v);
|
Result(void) tsqlite_statement_bind_i64(tsqlite_statement* self, cstr key, i64 v);
|
||||||
|
|||||||
@@ -27,11 +27,12 @@ void tsqlite_statement_free(tsqlite_statement* self){
|
|||||||
free(self);
|
free(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result(void) tsqlite_statement_reset(tsqlite_statement* self){
|
void tsqlite_statement_reset(tsqlite_statement* self){
|
||||||
try_sqlite3(self->conn, sqlite3_reset(self->st));
|
if(!self)
|
||||||
|
return;
|
||||||
|
sqlite3_reset(self->st);
|
||||||
self->result_row = -1;
|
self->result_row = -1;
|
||||||
self->result_col = -1;
|
self->result_col = -1;
|
||||||
return RESULT_VOID;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user