SQLite

Check-in [3df56e8491]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add a test case for empty quoted field in CSV import in the shell.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 3df56e849164811117f9ac8ee2aee1eee188bb96
User & Date: drh 2013-08-28 11:57:52.201
Context
2013-08-28
13:33
Fix an off-by-one error that causes a quoted empty string at the end of a CRNL-terminated line of CSV input to be misread by the shell. (check-in: b5617e4fda user: drh tags: trunk)
11:57
Add a test case for empty quoted field in CSV import in the shell. (check-in: 3df56e8491 user: drh tags: trunk)
11:43
Label a certain branch as NEVER() only for non-STAT3/4 builds. (check-in: b5ccf6e995 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/shell5.test.
237
238
239
240
241
242
243


























244
245
SELECT * FROM t1;}
  } {0 {1,"this is 1"
2,"this is 2"
3,"this is 3"
4,"this is 4"
5,"this is 5"}}
}



























finish_test







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
SELECT * FROM t1;}
  } {0 {1,"this is 1"
2,"this is 2"
3,"this is 3"
4,"this is 4"
5,"this is 5"}}
}

# Import columns containing quoted strings
do_test shell5-1.9 {
  set out [open shell5.csv w]
  puts $out {1,"",11}
  puts $out {2,"x",22}
  puts $out {3,"""",33}
  puts $out {4,"hello",44}
  puts $out {5,55,""}
  puts $out {6,66,"x"}
  puts $out {7,77,""""}
  puts $out {8,88,"hello"}
  puts $out {"",9,99}
  puts $out {"x",10,110}
  puts $out {"""",11,121}
  puts $out {"hello",12,132}
  close $out
  file delete -force test.db
  catchcmd test.db {.mode csv
    CREATE TABLE t1(a,b,c);
.import shell5.csv t1
  }
  sqlite3 db test.db
  db eval {SELECT *, '|' FROM t1 ORDER BY rowid}
} {1 {} 11 | 2 x 22 | 3 {"} 33 | 4 hello 44 | 5 55 {} | 6 66 x | 7 77 {"} | 8 88 hello | {} 9 99 | x 10 110 | {"} 11 121 | hello 12 132 |}
db close

finish_test