Difference between revisions of "C0137117334"

From dataspects::Wiki
C0137117334
Jump to navigation Jump to search
 
Line 13: Line 13:
         .schema
         .schema
         .headers on
         .headers on
== Import rows from txt file ==
sqlite> CREATE table englishWords(word STRING);
        CREATE TEMP TABLE i(txt);
        .separator ~
        .import /home/lex/p51/home/Downloads/<FILE>.txt i
        INSERT INTO englishWords(word) SELECT txt FROM i;
        DROP TABLE i;


== fileio extension ==
== fileio extension ==
https://www.sqlite.org/loadext.html
https://www.sqlite.org/loadext.html


Line 24: Line 35:


  sqlite> .load /home/lex/Downloads/fileio.so
  sqlite> .load /home/lex/Downloads/fileio.so
sqlite> CREATE table englishWords(word STRING);
        CREATE TEMP TABLE i(txt);
        .separator ~
        .import /home/lex/p51/home/Downloads/<FILE>.txt i
        INSERT INTO englishWords(word) SELECT txt FROM i;
        DROP TABLE i;

Latest revision as of 14:13, 15 June 2020


https://sqlite.org/cli.html

/home/datastore/data/datastore.db
sqlite3 datastore.db

sqlite> .tables
        .schema
        .headers on

Import rows from txt file

sqlite> CREATE table englishWords(word STRING);
        CREATE TEMP TABLE i(txt);
        .separator ~
        .import /home/lex/p51/home/Downloads/<FILE>.txt i
        INSERT INTO englishWords(word) SELECT txt FROM i;
        DROP TABLE i;

fileio extension

https://www.sqlite.org/loadext.html

sudo apt-get install libsqlite3-dev

Download fileio.c

gcc -g -fPIC -shared fileio.c -o fileio.so
sqlite> .load /home/lex/Downloads/fileio.so