On 2017/12/19 11:13 PM, Tony Papadimitriou wrote:
Great! Didn't think of the char() function at all.  (Although I would prefer a platform independent \n)

"\n" is NOT platform independent.  Char(10) on the other hand IS platform independent. That's perhaps the root of the misunderstanding.

I mean there are other factors too... Like on Linux we like to use only Char(10) (which can sometimes be signaled by "\n" to your app if the user pleases) having the great advantage of being nice and lean as a line and record separator.

On Windows we use both a Char(13) and Char(10) to signal a line-break or record separator (or "\r\n" if you will) which is fatter but allows you to use a normal linefeed character within records without breaking/ending the record.

These things are all OS dependent and so are the escape sequences "\anything" - it has nothing to do with data storage. In sqlite (or any other database) we use the actual really real control characters, not some escaped representation of it.  If you need to produce database output that will be fed via a command-line or console to a next application and want to pop out those escapes character sequences in stead of the real McCoy, then you can easily do that too by making a UDF or even doing this:

SELECT  replace(replace(replace(replace( "SomeDataColumn", char(10), '\n'), char(13), '\r'), char(09), '\t')....

But I have to tell you, that makes my spine twitch....

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

Reply via email to