Hello,
I've taken the time to investigate the problem: only the last
parameter is not correctly bound to NULL.

May I suggest a patch:

--- shell_.c 2014-06-15 14:22:39.000000000 +0200
+++ shell.c 2014-06-15 14:23:11.000000000 +0200
@@ -2553,7 +2553,7 @@
                           "filling the rest with NULL\n",
                           sCsv.zFile, startLine, nCol, i+1);
           i++;
-          while( i<nCol ){ sqlite3_bind_null(pStmt, i); i++; }
+          while( i<=nCol ){ sqlite3_bind_null(pStmt, i); i++; }
         }
       }
       if( sCsv.cTerm==sCsv.cSeparator ){

Regards.

On Mon, Jun 2, 2014 at 9:34 PM, Gert Van Assche <ger...@gmail.com> wrote:
> gwenn, thanks for this. I did not understand what you saw, and then I
> realized my shell exe was probably too old.
> I downloaded the new exe and this solves the problem just fine!
> thanks for your help.
>
> gert
>
>
> 2014-06-02 19:03 GMT+02:00 gwenn <gwenn.k...@gmail.com>:
>
>> Hello,
>> I doesn't fail for me (it may depend on the constraints on the target
>> table) but the behaviour is unexpected:
>>
>> $ echo "1|test
>> > " > empty.csv
>> $ sqlite3
>> SQLite version 3.8.4.3 2014-04-03 16:53:12
>> sqlite> create table test(opt text, data text not null);
>> sqlite> .import empty.csv test
>> empty.csv:2: expected 2 columns but found 1 - filling the rest with NULL
>> sqlite> select * from test;
>> 1|test
>> |test
>>
>> As the bindings are not cleared, it is not a null value but the
>> previous bound value which is inserted.
>> Regards.
>>
>> On Mon, Jun 2, 2014 at 5:41 PM, Gert Van Assche <ger...@gmail.com> wrote:
>> > All,
>> >
>> > I received 100.000 UTF-8 files (average size 50kb)  "ready for import" in
>> > an SQLite db.
>> > 90% of them go fine, but some files have an empty line at the very end of
>> > the fine (so an extra EOL before the EOF).
>> >
>> > Of course, the import fails... Is there an easy way to get rid of that
>> > extra empty line before I import the file, or is there a way to ignore an
>> > empty line?
>> >
>> > thanks
>> >
>> > Gert
>> > _______________________________________________
>> > sqlite-users mailing list
>> > sqlite-users@sqlite.org
>> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>> _______________________________________________
>> sqlite-users mailing list
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to