Addons/data/sqlite

data/sqlite - sqlite enhanced API for J

Provides J bindings to SQLite embedded engine. Contains direct library calls as well as array-based economical bulk API.
Based on sqlite 3.3.7, see [WWW] http://www.sqlite.org/
Binaries for Windows and Linux; on Mac comes standard.
For examples, see [JSvnAddons]test.ijs, [JSvnAddons]bench.ijs in SVN. Includes sqlite browser, see [JSvnAddons]browser.ijs, browser.reg.

  1. Installation
  2. Usage
    1. Selecting
    2. Error Handling
    3. SQLite Browser
  3. Authors

Installation

Use JAL/Package Manager or download the sqlite archive from [JAL]j601/addons and extract it into the ~addons/data/sqlite folder.

Usage

Load sqlite addon with the following line

   load 'data/sqlite'

Selecting

   17 colquery__db 'select * from P where WEIGHT=?;'
+---+-----+-----+------+-----+
|PID|PNAME|COLOR|WEIGHT|CITY |
+---+-----+-----+------+-----+
|P2 |Bolt |Green|17    |Paris|
|P3 |Screw|Blue |17    |Oslo |
+---+-----+-----+------+-----+

Error Handling

Errors are raised as J signal with error message.

   strquery__db 'select * from P1;'
|no such table: P1: sqlerr
|       sqlerr msg
   strquery__db 'select (* from P;'
|near "*": syntax error: sqlerr
|       sqlerr msg

SQLite Browser

SQLite Browser application views and queries database schema and data.

sqlite_br1.png

You can start SQLite Browser loading the data/sqlite/browser script: associating a key in J configuration, typing in session
   load 'data/sqlite/browser'

or from shell command line or shortcut
   j -jijx data/sqlite/browser

Usage

To associate .sqlite file extension on Windows, see browser.reg in the addon folder. Before running it, change the path to j.exe in the last line.

Authors

CategoryWorkInProgress

last edited 2008-01-03 06:35:54 by OlegKobchenko