diff --git a/modules/database_sqlite/sqlite3_query_builder.cpp b/modules/database_sqlite/sqlite3_query_builder.cpp index f11fe00d2..565a8198f 100644 --- a/modules/database_sqlite/sqlite3_query_builder.cpp +++ b/modules/database_sqlite/sqlite3_query_builder.cpp @@ -411,7 +411,13 @@ void SQLite3QueryBuilder::run_query() { Ref SQLite3QueryBuilder::create_prepared_statement() { ERR_FAIL_COND_V(!_connection.is_valid(), Ref()); - return _connection->create_prepared_statement(); + Ref stmt = _connection->create_prepared_statement(); + + if (stmt.is_valid()) { + stmt->set_sql(get_result()); + } + + return stmt; } QueryBuilder *SQLite3QueryBuilder::select_last_insert_id() {