davibe / Phonegap-SQLitePlugin

A phonegap plugin to open and use sqlite databases on iOS.
191 stars 90 forks source link

executeSql crashes in PhoneGap 1.3.0 #3

Open vstirbu opened 12 years ago

vstirbu commented 12 years ago

Using the SQLitePlugin with the latest PhoneGap 1.3.0 crashes the application every time an executeSql call that returns JSON data is executed.

It seems that the problem is related to the JSONKit library that does not have JSONRepresentation. Changing returned serialization to JSONString fixed the problem. The code is available here.

davibe commented 12 years ago

does it still work with older jsonkit libraries ? if so could you make a pull request ?

brodybits commented 12 years ago

I issued pull request #18 for Issue #17 to fix README.md. For PG 1.3, you must also adapt PGSQLitePlugin.m:

--- a/Plugins/PGSQLitePlugin.m
+++ b/Plugins/PGSQLitePlugin.m
@@ -219,7 +219,7 @@
         if (hasInsertId) {
             [resultSet setObject:insertId forKey:@"insertId"];
         }
-        [self respond:callback withString:[resultSet JSONRepresentation] withType:@"success"];
+        [self respond:callback withString:[resultSet JSONString] withType:@"success"];
     }
 }