Procházet zdrojové kódy

160804 iSalesDB execsql add return value;

Ray Zhang před 9 roky
rodič
revize
8dea835114

+ 2 - 2
RedAnt ERP Mobile/common/data_provider/iSalesDB.h

@@ -13,8 +13,8 @@
 @interface iSalesDB : NSObject
 @interface iSalesDB : NSObject
 //+(void)testdata;
 //+(void)testdata;
 + (int) initializeDb;
 + (int) initializeDb;
-+(void)execSql:(NSString *)sql db:(sqlite3 *)db;
-+(void)execSql:(NSString *)sql;
++(int)execSql:(NSString *)sql db:(sqlite3 *)db;
++(int)execSql:(NSString *)sql;
 + (sqlite3*) get_db;
 + (sqlite3*) get_db;
 + (int) get_recordid:(sqlite3*)db table:(NSString*) tablename where:(NSString*) whereclause order:(NSString*) orderby;
 + (int) get_recordid:(sqlite3*)db table:(NSString*) tablename where:(NSString*) whereclause order:(NSString*) orderby;
 + (int) get_recordid:(sqlite3*)db table:(NSString*) tablename where:(NSString*) whereclause;
 + (int) get_recordid:(sqlite3*)db table:(NSString*) tablename where:(NSString*) whereclause;

+ 8 - 3
RedAnt ERP Mobile/common/data_provider/iSalesDB.m

@@ -689,16 +689,20 @@ void decryptfield (sqlite3_context *context, int argc, sqlite3_value **argv) {
     
     
    // DebugLog (@"bottom of initializeDb");
    // DebugLog (@"bottom of initializeDb");
 }
 }
-+(void)execSql:(NSString *)sql db:(sqlite3 *)db
++(int)execSql:(NSString *)sql db:(sqlite3 *)db
 {
 {
+    
+    int ret=RESULT_TRUE;
     char *err;
     char *err;
     if (sqlite3_exec(db, [sql UTF8String], NULL, NULL, &err) != SQLITE_OK) {
     if (sqlite3_exec(db, [sql UTF8String], NULL, NULL, &err) != SQLITE_OK) {
         
         
         DebugLog(@"sqlite3_exec failed msg:%s",sqlite3_errmsg(db));
         DebugLog(@"sqlite3_exec failed msg:%s",sqlite3_errmsg(db));
         DebugLog(@"sqlite3_exec failed sql:%@",sql);
         DebugLog(@"sqlite3_exec failed sql:%@",sql);
+        ret= RESULT_FALSE;
         // sqlite3_close(db);
         // sqlite3_close(db);
         
         
     }
     }
+    return ret;
 }
 }
 + (NSDictionary*) search_pdf:(int) offset limit:(int)limit keywords:(NSString*) keywords
 + (NSDictionary*) search_pdf:(int) offset limit:(int)limit keywords:(NSString*) keywords
 {
 {
@@ -755,13 +759,14 @@ void decryptfield (sqlite3_context *context, int argc, sqlite3_value **argv) {
     sqlite3_close(db);
     sqlite3_close(db);
     return json;
     return json;
 }
 }
-+(void)execSql:(NSString *)sql
++(int)execSql:(NSString *)sql
 {
 {
     
     
     sqlite3 *db = [self get_db];
     sqlite3 *db = [self get_db];
-    [self execSql:sql db:db];
+    int ret=[self execSql:sql db:db];
     
     
     sqlite3_close(db);
     sqlite3_close(db);
+    return ret;
 }
 }
 + (int) get_recordid:(NSString*) tablename where:(NSString*) whereclause
 + (int) get_recordid:(NSString*) tablename where:(NSString*) whereclause
 {
 {