• Home
  • Raw
  • Download

Lines Matching full:csv

1 //! CSV Virtual Table.
3 //! Port of [csv](http://www.sqlite.org/cgi/src/finfo?name=ext/misc/csv.c) C
4 //! extension: `https://www.sqlite.org/csv.html`
14 //! // Assume my_csv.csv
17 //! USING csv(filename = 'my_csv.csv')
38 /// Register the "csv" module.
40 /// CREATE VIRTUAL TABLE vtab USING csv(
41 /// filename=FILENAME -- Name of file containing CSV content
42 /// [, schema=SCHEMA] -- Alternative CSV schema. 'CREATE TABLE x(col1 TEXT NOT NULL, col2 INT, ..…
43 /// [, header=YES|NO] -- First row of CSV defines the names of columns if "yes". Default "no".
44 /// [, columns=N] -- Assume the CSV file contains N columns.
45 /// [, delimiter=C] -- CSV delimiter. Default ','.
46 /// [, quote=C] -- CSV quote. Default '"'. 0 means no quote.
51 conn.create_module("csv", read_only_module::<CsvTab>(), aux) in load_module()
54 /// An instance of the CSV virtual table
59 /// Name of the CSV file
65 offset_first_row: csv::Position,
69 fn reader(&self) -> Result<csv::Reader<File>, csv::Error> { in reader()
70 csv::ReaderBuilder::new() in reader()
96 return Err(Error::ModuleError("no CSV file specified".to_owned())); in connect()
105 offset_first_row: csv::Position::new(), in connect()
181 return Err(Error::ModuleError("no CSV file specified".to_owned())); in connect()
200 let mut record = csv::ByteRecord::new(); in connect()
250 /// A cursor for the CSV virtual table
255 /// The CSV reader object
256 reader: csv::Reader<File>,
260 cols: csv::StringRecord,
266 fn new<'vtab>(reader: csv::Reader<File>) -> CsvTabCursor<'vtab> { in new()
271 cols: csv::StringRecord::new(), in new()
336 impl From<csv::Error> for Error {
338 fn from(err: csv::Error) -> Error { in from()
354 "CREATE VIRTUAL TABLE vtab USING csv(filename = 'test.csv', header = yes)", in test_csv_module()
375 db.execute_batch("CREATE VIRTUAL TABLE vtab USING csv(filename='test.csv', header=yes)")?; in test_csv_cursor()