On 2014/10/14 16:19, Clemens Ladisch wrote:
RSmith wrote:
On 2014/10/14 13:09, Clemens Ladisch wrote:
SELECT CASE WHEN previd = 0 THEN '--------------' || char(10) END, *
FROM (SELECT ...);
This solution from Clemens will work perfectly, and depending on the
kind of OS you use and output method it might even work to add
something like '-----\n' or '----\r\n' as the Inserted item if
char(10) causes headaches.
   sqlite> select '-----\n';
   -----\n

That's not very useful.  ;-)
and...
On output produced for Windows systems that should also be
char(13) || char(10).
The sqlite3 shell uses the C runtime conventions, where stdout is in
text mode, so char(10) is correct even on Windows.

Indeed on both counts, but you assume he is using the sqlite3 shell and stdout... I said "might" be needed - if he produces, say for argument's sake, a csv-like file that will be opened by some text editor on Windows, the chr(13) is needed, and if he produces anything like a XML file or via script in Python or PHP or such the \r and \n (or even <br /> for HTML) will work as intended.

Not all of us are so pro as to only use queries in the Linux command-line ;)


_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to