瀏覽代碼

Include fixes, and making an exception thrown when a query is used in executeUpdate:

ccgus 14 年之前
父節點
當前提交
9c5df78bbd
共有 2 個文件被更改,包括 6 次插入2 次删除
  1. 5 2
      src/FMDatabase.m
  2. 1 0
      src/FMDatabasePool.h

+ 5 - 2
src/FMDatabase.m

@@ -535,6 +535,7 @@ - (FMResultSet *)executeQuery:(NSString *)sql withArgumentsInArray:(NSArray*)arr
                 if (_logsErrors) {
                     NSLog(@"DB Error: %d \"%@\"", [self lastErrorCode], [self lastErrorMessage]);
                     NSLog(@"DB Query: %@", sql);
+                    NSLog(@"DB Path: %@", _databasePath);
 #ifndef NS_BLOCK_ASSERTIONS
                     if (_crashOnErrors) {
                         abort();
@@ -720,6 +721,7 @@ - (BOOL)executeUpdate:(NSString*)sql error:(NSError**)outErr withArgumentsInArra
                 if (_logsErrors) {
                     NSLog(@"DB Error: %d \"%@\"", [self lastErrorCode], [self lastErrorMessage]);
                     NSLog(@"DB Query: %@", sql);
+                    NSLog(@"DB Path: %@", _databasePath);
 #ifndef NS_BLOCK_ASSERTIONS
                     if (_crashOnErrors) {
                         abort();
@@ -848,8 +850,9 @@ - (BOOL)executeUpdate:(NSString*)sql error:(NSError**)outErr withArgumentsInArra
         
     } while (retry);
     
-    assert(rc != SQLITE_ROW );
-    
+    if (rc == SQLITE_ROW) {
+        NSAssert(NO, @"A executeUpdate is being called with a query string", 0x00);
+    }
     
     if (_shouldCacheStatements && !cachedStmt) {
         cachedStmt = [[FMStatement alloc] init];

+ 1 - 0
src/FMDatabasePool.h

@@ -7,6 +7,7 @@
 //
 
 #import <Foundation/Foundation.h>
+#import "sqlite3.h"
 
 @class FMDatabase;