diff options
Diffstat (limited to 'data/javasqlite')
-rw-r--r-- | data/javasqlite/null16.diff | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/data/javasqlite/null16.diff b/data/javasqlite/null16.diff new file mode 100644 index 000000000..64c2905c0 --- /dev/null +++ b/data/javasqlite/null16.diff @@ -0,0 +1,67 @@ +diff -ru javasqlite-20071108/native/sqlite_jni.c javasqlite-20071108+iPhone/native/sqlite_jni.c +--- javasqlite-20071108/native/sqlite_jni.c 2007-10-27 06:58:54.000000000 +0000 ++++ javasqlite-20071108+iPhone/native/sqlite_jni.c 2008-02-06 01:18:37.000000000 +0000 +@@ -3346,6 +3346,8 @@ + jsize len16; + const jchar *sql16, *tail = 0; + int ret; ++ int i; ++ jchar *sql2; + + if (!h) { + throwclosed(env); +@@ -3371,11 +3373,15 @@ + } + h->env = env; + sql16 = (*env)->GetStringChars(env, sql, 0); ++ sql2 = malloc(len16 + sizeof(jchar)); ++ memcpy(sql2, sql16, len16); ++ sql2[len16 / sizeof(jchar)] = '\0'; ++ (*env)->ReleaseStringChars(env, sql, sql16); + #if HAVE_SQLITE3_PREPARE16_V2 +- ret = sqlite3_prepare16_v2((sqlite3 *) h->sqlite, sql16, len16, ++ ret = sqlite3_prepare16_v2((sqlite3 *) h->sqlite, sql2, len16, + (sqlite3_stmt **) &svm, (const void **) &tail); + #else +- ret = sqlite3_prepare16((sqlite3 *) h->sqlite, sql16, len16, ++ ret = sqlite3_prepare16((sqlite3 *) h->sqlite, sql2, len16, + (sqlite3_stmt **) &svm, (const void **) &tail); + #endif + if (ret != SQLITE_OK) { +@@ -3387,22 +3393,23 @@ + if (ret != SQLITE_OK) { + const char *err = sqlite3_errmsg(h->sqlite); + +- (*env)->ReleaseStringChars(env, sql, sql16); ++ free(sql2); + setstmterr(env, stmt, ret); ++ printf("%s\n", err); + throwex(env, err ? err : "error in prepare"); + return; + } + if (!svm) { +- (*env)->ReleaseStringChars(env, sql, sql16); ++ free(sql2); + return; + } +- len16 = len16 + sizeof (jchar) - ((char *) tail - (char *) sql16); ++ len16 = len16 + sizeof (jchar) - ((char *) tail - (char *) sql2); + if (len16 < sizeof (jchar)) { + len16 = sizeof (jchar); + } + v = malloc(sizeof (hvm) + len16); + if (!v) { +- (*env)->ReleaseStringChars(env, sql, sql16); ++ free(sql2); + sqlite3_finalize((sqlite3_stmt *) svm); + throwoom(env, "unable to get SQLite handle"); + return; +@@ -3418,7 +3425,7 @@ + memcpy(v->tail, tail, len16); + len16 /= sizeof (jchar); + ((jchar *) v->tail)[len16 - 1] = 0; +- (*env)->ReleaseStringChars(env, sql, sql16); ++ free(sql2); + v->hh.sqlite = 0; + v->hh.haveutf = h->haveutf; + v->hh.ver = h->ver; |