Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Avoid ignoring the last line of a csv file if the final field is empty and there is no trailing CFLS. Also have the csv extension treat the last line of a file in the same way as any other line if it is short fields. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
587795d47fcaf5142526fabbcc4d5a63 |
User & Date: | dan 2022-07-06 15:44:57.999 |
Context
2022-07-06
| ||
23:50 | Fix harmless compiler warnings seen with MSVC. (check-in: 61e2094afb user: mistachkin tags: trunk) | |
15:44 | Avoid ignoring the last line of a csv file if the final field is empty and there is no trailing CFLS. Also have the csv extension treat the last line of a file in the same way as any other line if it is short fields. (check-in: 587795d47f user: dan tags: trunk) | |
13:59 | Avoid dropping error codes in the xBegin() method of virtual table sqlite_dbpage. (check-in: 570e2bce59 user: dan tags: trunk) | |
Changes
Changes to ext/misc/csv.c.
︙ | ︙ | |||
747 748 749 750 751 752 753 | pCur->azVal[i] = zNew; pCur->aLen[i] = pCur->rdr.n+1; } memcpy(pCur->azVal[i], z, pCur->rdr.n+1); i++; } }while( pCur->rdr.cTerm==',' ); | | | 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 | pCur->azVal[i] = zNew; pCur->aLen[i] = pCur->rdr.n+1; } memcpy(pCur->azVal[i], z, pCur->rdr.n+1); i++; } }while( pCur->rdr.cTerm==',' ); if( z==0 && i==0 ){ pCur->iRowid = -1; }else{ pCur->iRowid++; while( i<pTab->nCol ){ sqlite3_free(pCur->azVal[i]); pCur->azVal[i] = 0; pCur->aLen[i] = 0; |
︙ | ︙ |
Changes to test/csv01.test.
︙ | ︙ | |||
249 250 251 252 253 254 255 | set fd [open csv.data w] puts $fd "a,b" puts $fd "[randomtext $ii],abcd" close $fd do_execsql_test 6.$ii.1 { CREATE VIRTUAL TABLE abc USING csv(filename='csv.data', header=true); } | < > > > > > > > > > > > > > > > > > > | 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | set fd [open csv.data w] puts $fd "a,b" puts $fd "[randomtext $ii],abcd" close $fd do_execsql_test 6.$ii.1 { CREATE VIRTUAL TABLE abc USING csv(filename='csv.data', header=true); } do_execsql_test 6.$ii.2 { SELECT count(*) FROM abc } 1 } for {set ii 0} {$ii < 20} {incr ii} { reset_db load_static_extension db csv set T [randomtext $ii] set fd [open csv.data w] puts $fd "a,b" puts -nonewline $fd "abcd,$T" close $fd do_execsql_test 7.$ii.1 { CREATE VIRTUAL TABLE abc USING csv(filename='csv.data', header=true); } breakpoint do_execsql_test 7.$ii.2 { SELECT * FROM abc } [list abcd $T] } finish_test |