2009/6/13 Florian v. Savigny <lor...@fsavigny.de>:
>
>
> I'm very sorry if this is a very stupid question. Intuitively, I would
> assume that of course, any TEXT or BLOB field may contain
> newlines. I'm, however, puzzled about two things (it all refers to the
> commandline interface):
>
> - while I can insert values with newlines by using the X'ABCD'
>  notation, i.e. saying sth like
>
>  INSERT INTO my_table VALUES (x'0a');
>
>  it does not seem possible to use a newline literally in a string,
>  e.g. like this:
>
>  INSERT INTO my_table VALUES ('
> ');
>

What problems does it cause you?

I have no problems:

SQLite version 3.4.2
Enter ".help" for instructions
sqlite>
sqlite>
sqlite> create table tst( id integer primary key, data text );
sqlite>
sqlite> insert into tst( data ) values( 'line1
   ...> line2
   ...> line3
   ...> line4' );
sqlite>
sqlite>
sqlite>
sqlite> select data from tst;
line1
line2
line3
line4
sqlite> select hex( data ) from tst;
6C696E65310A6C696E65320A6C696E65330A6C696E6534
sqlite>

>  But does this mean you can only specify newlines in x'abcd'
>  notation? Or even, that SQLite stores any string with newlines as a
>  BLOB?

No

>
> - (Almost the same question) When I use quote() to SELECT some
>  columns, is it conceivable that SQLite returns something like this
>  (assuming line mode):
>
>  quote(text) = '
> '
>  Or will it always use the X'ABCD' notation to output newlines?

See above

>
>  (I have already found out that newlines stored as blobs are returned
>  literally if you do not use quote(), but as I said, I haven't been
>  able to store newlines as text, so I could not test how they are
>  returned.)
>
>
> The background of my question is not curiosity, but the fact that I
> have designed an Elisp interface that uses SQLite's commandline
> interface with quote() and parses its line output. As long as the
> values cannot contain newlines, that's quite straightforward, but if
> they can, it's suddenly very intricate. Thus, it's the output that I'm
> chiefly concerned about, but also the fact whether I always have to
> use the X'ABCD' notation to insert a value that contains newlines (and
> perhaps also carriage returns, which I haven't tested).
>
> I'm sorry if I merely haven't found the pertinent documentation, but I
> have rummaged the docs.
>
> Thanks for any help here!
>
> Florian
>

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

Reply via email to