All,

I'm attempting to inject a lengthy text entry right into a SQLite database, inside a TEXT area. This text has new lines inside it (i.e. it spans multiple sentences).

I'm able to obtain the new lines to appear basically perform the Place by hand:

INSERT INTO "LOGENTRY" VALUES(5,40,'PLACE','line1
line2

line4
',1283990533315,'4A','TEXT','',NULL);

but when I've the same text inside a CSV file and try to .import it in to the table, I recieve a mistake it's expecting more posts than exist (the moment the brand new lines are experienced, this program assumes it is the finish from the input and therefore it's missing posts).

Is possible? Or perhaps is the only method to by hand do each Place?

Your condition may be the csv format!

Commas separate fields

Double quotes may be used to group a area which consists of commas.

New lines delimit records

You can either have to escape/remove your brand-new lines, or, apply certain various other appropriate extendable.

The next (sed) regular expresion will "remove" undesirable line feeds

s/\(,"[^",]*\)$/\1\1/g

Just simple searching provided the end result

http://www.mail-archive.com/sqlite-users@sqlite.org/msg43557.html

You actually can:

SQLite version 3.6.14.2
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> create table x ( a );
sqlite> INSERT INTO x VALUES('line1
   ...> line2');
sqlite> SELECT a FROM x;
line1
line2
sqlite> SELECT hex(a) FROM x;
6C696E65310A6C696E6532
sqlite>

Hope it will help!

Whether it's inside the application, I'd make use of a parameterized / prepared statement, a minimum of for individuals values that aren't constant:

db.execSQL("INSERT INTO LOGENTRY " +
    "VALUES(?, ?, ?, ?, ?, ?, ?, '', NULL)", 
    new Object[]{5, 40, place, text, num, x, t2});