This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
howtos:sqliteutilitynotes [2007/01/23 00:14] – texasfett | howtos:sqliteutilitynotes [2007/01/23 00:26] – texasfett | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== sqlite tutorial ====== | ====== sqlite tutorial ====== | ||
a command-line program to administer SQLite databases | a command-line program to administer SQLite databases | ||
+ | |||
==== Introduction ==== | ==== Introduction ==== | ||
Line 10: | Line 11: | ||
The SQLite web site only seems to document the **sqlite3** utility which is not compatible with the SQLite databases created by POPFile. The information on this wiki page is based upon an old page (last modified on 2004/05/31 15:06:30) from the SQLite web site which documented the features supported by the **sqlite** command-line utility. | The SQLite web site only seems to document the **sqlite3** utility which is not compatible with the SQLite databases created by POPFile. The information on this wiki page is based upon an old page (last modified on 2004/05/31 15:06:30) from the SQLite web site which documented the features supported by the **sqlite** command-line utility. | ||
- | The SQLite web site still has some [[http:// | + | The SQLite web site still has some [[http:// |
==== Getting Started ==== | ==== Getting Started ==== | ||
Line 226: | Line 226: | ||
$ | $ | ||
</ | </ | ||
+ | |||
Line 257: | Line 258: | ||
< | < | ||
sqlite> .schema | sqlite> .schema | ||
- | create table tbl1(one varchar(1), two smallint); | + | create table tbl1(one varchar(10), two smallint) |
CREATE TABLE tbl2 ( | CREATE TABLE tbl2 ( | ||
- | f1 varchar(30) primary key, | + | |
- | f2 text, | + | f2 text, |
- | f3 real | + | f3 real |
- | ); | + | ) |
sqlite> .schema tbl2 | sqlite> .schema tbl2 | ||
CREATE TABLE tbl2 ( | CREATE TABLE tbl2 ( | ||
- | f1 varchar(30) primary key, | + | |
- | f2 text, | + | f2 text, |
- | f3 real | + | f3 real |
- | ); | + | ) |
sqlite> | sqlite> | ||
</ | </ | ||
Line 301: | Line 302: | ||
< | < | ||
+ | |||
+ | |||
Line 307: | Line 310: | ||
==== Converting An Entire Database To An ASCII Text File ==== | ==== Converting An Entire Database To An ASCII Text File ==== | ||
- | Use the " | + | Use the " |
A good way to make an archival copy of a database is this: | A good way to make an archival copy of a database is this: | ||
- | <code bash> | + | <code bash>$ echo ' |
This generates a file named **ex1.dump.gz** that contains everything you need to reconstruct the database at a later time, or on another machine. To reconstruct the database, just type: | This generates a file named **ex1.dump.gz** that contains everything you need to reconstruct the database at a later time, or on another machine. To reconstruct the database, just type: |
Should you find anything in the documentation that is incomplete, unclear, outdated or just plain wrong, please let us know and leave a note in the Documentation Forum.