Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| en:guides:database [2013/04/26 19:44] – emgi | en:guides:database [2014/11/09 16:55] (current) – tiny edits linea | ||
|---|---|---|---|
| Line 2: | Line 2: | ||
| - | **SQLite** is a lightweight SQL database and as such perfectly suitable for use with slitaz. Leightweight | + | **SQLite** is a lightweight SQL database and as such perfectly suitable for use with Slitaz. Lightweight |
| To begin with, the program in all its aspects is extensively documented on: http:// | To begin with, the program in all its aspects is extensively documented on: http:// | ||
| Line 9: | Line 9: | ||
| ====== What do I need to get started with SQLite? ====== | ====== What do I need to get started with SQLite? ====== | ||
| - | + | To begin with SQLite on Slitaz, you only need to install the sqlite client package: | |
| - | -To begin with, you need to install the sqlite client package: | + | |
| < | < | ||
| This installs the sqlite client in your /usr/bin directory. The version offered with slitaz is a stable release but not the latest one available. SQLite is under active development and new versions appear on a regular basis. If you need a more recent version you may use the precompiled binary which is available on the SQLite.org download page. To do this, you can simply download the precompiled binary and save it in the /usr/bin/ folder, overwriting the file from the tazpkg installation if it exists. | This installs the sqlite client in your /usr/bin directory. The version offered with slitaz is a stable release but not the latest one available. SQLite is under active development and new versions appear on a regular basis. If you need a more recent version you may use the precompiled binary which is available on the SQLite.org download page. To do this, you can simply download the precompiled binary and save it in the /usr/bin/ folder, overwriting the file from the tazpkg installation if it exists. | ||
| - | <note important> | + | <note important> |
| To run SQLite with Perl, one additional package must be installed; the perl-sqlite module: | To run SQLite with Perl, one additional package must be installed; the perl-sqlite module: | ||
| Line 23: | Line 22: | ||
| The sqlite client / | The sqlite client / | ||
| - | Starting the program without any parameters or options returns a > prompt. You may enter sql commands terminated by the semcolon | + | Starting the program without any parameters or options returns a > prompt. You may enter sql commands terminated by the semicolon |
| One small example: < | One small example: < | ||
| This command prints the layout of the tables in the database. To create a new database, set the filename to whatever is deemed suitable. A new database is created if the file does not exist. | This command prints the layout of the tables in the database. To create a new database, set the filename to whatever is deemed suitable. A new database is created if the file does not exist. | ||
| Line 29: | Line 28: | ||
| Please refer to http:// | Please refer to http:// | ||
| - | Copying or renaming the file containg | + | Copying or renaming the file containing |
| < | < | ||
| The filesize depends heavily on the type of database and its actual contents. The more data is entered, the larger the file becomes. | The filesize depends heavily on the type of database and its actual contents. The more data is entered, the larger the file becomes. | ||
| Please note that the file does not shrink when a large amount of data is deleted. Instead, the empty space is preserved and re-used before the file starts to increase in size again. | Please note that the file does not shrink when a large amount of data is deleted. Instead, the empty space is preserved and re-used before the file starts to increase in size again. | ||
| - | Something else to keep in mind is that the file permissions must be set correctly to be able read or write the database. | + | Something else to keep in mind is that the file permissions must be set correctly to be able to read or write the database. |
| + | |||
| + | ======Keeping sqlite up-to-date====== | ||
| + | SQLite is still under development and new versions are made available every one-two months. You can run the latest client without compiling and installing a package every time. In the end, it is just one binary file: sqlite3. This file is available as a precompiled binary for download from www.sqlite.org. All that's needed is to move it to the correct folder, thereby replacing the old version. A sample script to automate this action could look like this: | ||
| + | < | ||
| + | if [ -s sqlite3 ]; then | ||
| + | rm sqlite3.old | ||
| + | mv / | ||
| + | mv sqlite3 /usr/bin/ | ||
| + | chmod 755 / | ||
| + | fi | ||
| + | </ | ||
| + | This script looks for a file named sqlite3 in / | ||