[PATCH] [SQLBOX] Allow building with sqlite3 < 3.5

Damián Viano <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
Hi, first message to the list, first patch :)

It's a simple one, it turns out sqlite3 has sqlite3_prepare_v2 in
versions >= 3.5 (if google didn't lie to me) so, this patch only use it if
available.

It's against the lastest stable.

Hope to help.

    Damián Viano(Des).
sqlbox-0.7.2-sqlite_lt_3.5.patch (text/x-diff, 578 B)
--- sqlbox-0.7.2/gw/sqlbox_sqlite3.c	2009-05-19 12:08:35.000000000 -0300
+++ sqlbox-0.7.2_des/gw/sqlbox_sqlite3.c	2009-06-09 11:14:09.000000000 -0300
@@ -53,7 +53,11 @@
     debug("SQLBOX", 0, "sql: %s", octstr_get_cstr(sql));
 #endif
 
+#ifdef sqlite3_prepare_v2
     res = sqlite3_prepare_v2(conn->conn, octstr_get_cstr(sql), -1, &stmt, NULL);
+#else
+    res = sqlite3_prepare(conn->conn, octstr_get_cstr(sql), -1, &stmt, NULL);
+#endif
     if (res != SQLITE_OK) {
         error(0, "SQLITE3: Could not compile query: %s", sqlite3_errmsg(conn->conn));
         return NULL;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.