From d208d887fcc3f932614d1f04aec2bb9923b4674a Mon Sep 17 00:00:00 2001 From: Relintai Date: Sat, 27 Apr 2024 21:06:54 +0200 Subject: [PATCH] Fix text binds being interpreted as blobs. --- modules/database_sqlite/sqlite3_prepared_statement.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/database_sqlite/sqlite3_prepared_statement.cpp b/modules/database_sqlite/sqlite3_prepared_statement.cpp index 3c77ecfea..c5bbbc905 100644 --- a/modules/database_sqlite/sqlite3_prepared_statement.cpp +++ b/modules/database_sqlite/sqlite3_prepared_statement.cpp @@ -136,7 +136,8 @@ Error SQLite3PreparedStatement::bind_text(const int p_index, const String &p_val CharString cs = p_value.utf8(); - int res = sqlite3_bind_text(_prepared_statement, p_index, cs.get_data(), cs.size(), SQLITE_TRANSIENT); + //cs.size() - 1 -> Don't send the null terminator, as then the text will be interpreted as blob + int res = sqlite3_bind_text(_prepared_statement, p_index, cs.get_data(), cs.size() - 1, SQLITE_TRANSIENT); if (res != SQLITE_OK) { return FAILED;