Hi Guys
I've just started using libzdb for a iOS (iPad) project. We use it because one software component has to be written in C (so, ... no use of CoreData or Object-C wrapper!).
I've encountered a problem SQLiteConnection.c. As far as i see it's not possible to have url escaped Path for sqlite (because the path for iOS Simulator has multiple " " (whitespaces)). I've changed line 80 to: const char *path = URL_unescape(URL_getPath(url));
Patch: *** vendor/libzdb-2.8.1/src/db/sqlite/SQLiteConnection.c 2011-02-15 01:13:35.000000000 +0100 --- vendor/libzdb-2.8.1/src/db/sqlite/SQLiteConnection_modified.c 2011-05-03 11:35:25.000000000 +0200 *************** *** 76,82 ****
static sqlite3 *doConnect(URL_T url, char **error) { sqlite3 *db; ! const char *path = URL_getPath(url); if (! path) { *error = Str_dup("no database specified in URL"); return NULL; --- 76,86 ----
static sqlite3 *doConnect(URL_T url, char **error) { sqlite3 *db; ! ! const char *path = URL_unescape(URL_getPath(url)); ! ! ! if (! path) { *error = Str_dup("no database specified in URL"); return NULL;
#################################
Maybe theres another solution. If not, maybe the patch will find his way to the main trunk.
-- Jonas
°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° include7 AG Jonas Schnelli Grüngasse 10 CH-8004 Zürich Switzerland Office: +41 44 500 16 70
Skype: jonas.schnelli Mail: jonas.schnelli@include7.ch Web: www.include7.ch V-Card: www.include7.ch/js.vcf °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
ACHTUNG Bitte senden sie uns keine sensitiven Daten in unverschlüsselten E-Mails. Verwenden Sie hierzu folgenden Link: https://include7.ch/contact/secureform
°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
Hi
Thank you. I guess we've never used a SQLite path with spaces in it before, otherwise we should have seen this problem. Your solution is fine, though it modifies a const, i.e. path in URL, but I think this is acceptable. Other solutions would be to allow spaces in URL path at creation time or copy URL path at connection time and unescape it then. Neither of these are particularly wanted. So your patch is included and added to the repository and will be part of the next release of libzdb.
Thanks again :)
On May 3, 2011, at 11:56 AM, Jonas Schnelli wrote:
Hi Guys
I've just started using libzdb for a iOS (iPad) project. We use it because one software component has to be written in C (so, ... no use of CoreData or Object-C wrapper!).
I've encountered a problem SQLiteConnection.c. As far as i see it's not possible to have url escaped Path for sqlite (because the path for iOS Simulator has multiple " " (whitespaces)). I've changed line 80 to: const char *path = URL_unescape(URL_getPath(url));