Taj, > Hi Ulrik, > >>>Now, that's all fine and everything for interactive SQL, but when I'm >>>using this in a program (written in Delphi), the comma messes up the >>>returned values (since they are comma seperated) >>> >>> >> >>You can do escaping that replaces the comma with something else when >>writing to the table, then converts it back after you have gotten the >> info >>from the comma-separated format. >> >>For example, URLs regularly use %XX to escape characters such as space, >>where XX is the hexadecimal ASCII value. So "space" (ASCII 32) will be >>"%20". Just remember to escape not only the comma, but also the >>percentage sign or whatever signals your escape sequences. >> >> > Ahh! That's a good idea! What characters would I need to escape? Comma, > obviously, percentage, what else would freak SQLite out? I guess that > when stuff is returned from the database or inserted into it, I should > escape it or unescape the text?
A NUL (ASCII 0) would also freak SQLite out, unless you are storing as a BLOB in SQLite 3. Yes, you should escape when inserting and unescape after getting back from the table. Dennis suggested inserting "double quotes" around the text. That is simpler, and may work - try it first. It is standard practice in comma-separated-value files to embed fields in "double quotes" if you want to escape commas inside of it. You say that the DLL uses regular expressions to comma-delimit the table. Depending on how the DLL does it, it is maybe possible to specify a language in regular expressions that takes care of not splitting on a comma if that comma is embedded in double quotes. HTH Ulrik -- Ulrik Petersen, Denmark