Selaa lähdekoodia

Add a check and return error for SQLite3Statement.bind_stmt method

mingodad 9 vuotta sitten
vanhempi
sitoutus
a54b14b2c3
1 muutettua tiedostoa jossa 5 lisäystä ja 3 poistoa
  1. 5 3
      SquiLu-ext/sq_sqlite3.cpp

+ 5 - 3
SquiLu-ext/sq_sqlite3.cpp

@@ -393,13 +393,15 @@ static SQRESULT sq_sqlite3_stmt_bind_stmt(HSQUIRRELVM v)
     GET_sqlite3_stmt_INSTANCE();
     GET_sqlite3_stmt_INSTANCE();
     GET_sqlite3_stmt_INSTANCE_AT(2, stmt_src);
     GET_sqlite3_stmt_INSTANCE_AT(2, stmt_src);
 
 
-    int bind_count = sqlite3_bind_parameter_count(self);
+    int rc = SQ_OK, bind_count = sqlite3_bind_parameter_count(self);
     for(int i=0; i < bind_count; ++i)
     for(int i=0; i < bind_count; ++i)
     {
     {
-        sqlite3_bind_value(self, i+1, sqlite3_column_value(stmt_src, i));
+        rc = sqlite3_bind_value(self, i+1, sqlite3_column_value(stmt_src, i));
+        if(rc != SQ_OK) break;
     }
     }
 
 
-    return 0;
+    sq_pushinteger(v, rc);
+    return 1;
 }
 }
 
 
 static SQRESULT sq_sqlite3_stmt_bind_empty_null(HSQUIRRELVM v)
 static SQRESULT sq_sqlite3_stmt_bind_empty_null(HSQUIRRELVM v)