SQLite Forum

Bug in .import --skip (v3.33.0, trunk)
Login
I noted that when using the new --skip option for the shell's .import command, the line numbers are incorrect. The reason is that while skipping, xRead (either ascii_read_one_field or csv_read_one_field) increments ImportCtx.nLine, and the loop to skip lines does it too:

    shell.c:8137

    while( (nSkip--)>0 ){
      while( xRead(&sCtx) && sCtx.cTerm==sCtx.cColSep ){}
      sCtx.nLine++;
    }

The line numbers reported in error messages and (when using -v) the number of used lines are too high by the number of skipped lines.

The fix is, of course, to remove the sCtx.nLine++ statement.

The --skip option does not complain about negative values or otherwise unparseable values.