UNQLITE

<< Click to Display Table of Contents >>

Navigation:  TCC > Commands >

UNQLITE
Purpose:Create / Read / Write a NoSQL database

 

Format:UNQLITE [/RWC [/RO [/MM] /RW /TEMP /MM] [/DB:"name"] [/C] [/D key] [/R key]  [/KVBA "key" handle length] [/KVF "key" filename length] [/KVFA "key" filename length] [/KVS "key" "value"] [/KVSA "key" "string"]

 

/C(lose)/MM (memory mapped)
/D(elete)/R(ead)
/DB:name (database name)/RO (open read-only)
/KVB (create key/binary blob)/RW (open read+write)
/KVBA (append key/binary blob)/RWC (open read+write+create)
/KVF (create key/file)/TEMP (temporary db)

/KVFA (append key/file)

/KVS (create key/value)

/KVSA (append)

 

Usage:

 

UnQLite is an embedded NoSQL (Key/Value store and Document-store) database engine. UnQLite reads and writes directly to ordinary disk files. The complete database with multiple collections is contained in a single disk file. The database file format is cross-platform, you can copy a database between 32-bit and 64-bit systems or between big-endian and little-endian architectures.

 

You can only perform one operation (open, close, write, read, etc.) each time you call UNQLITE. For example:

 

unqlite  /db:"test.db"/rwc

unqlite /db:"test.db" /kvs "keyone" "This is a string value assigned to keyone"

unqlite /db:"test.db" /c

 

If filename is ":mem:", then a private in-memory database is created. The in-memory database will be discarded when the database is closed.

 

UNQLITE does not support extended Unicode characters for the database name.

 

Both keys and values are treated as arrays of bytes, so the content can be ASCII strings, Unicode strings, binary blogs, or disk files.

 

The maximum size of a file for /KVF or /KVFA is dependent on the RAM and disk space available.

 

UNQLITE has an internal command variable:

 

%_unq_dbThe name of the current database

 

Options:

 

/CClose a database. If you omit the name, UNQLITE will close the most recently opened database.

 

/DDelete the specified key

 

/DB:nameOpen an existing database for a read / write / delete operation. The database name should be quoted. You need to use the same name when calling any of the read / write options. If this option is omitted, UNQLITE will use the last database name (if any).

 

/KVBCreate a key / binary blob value. If the key exists, it will be overwritten with the new value. handle is a handle returned by @BALLOC; length is the length to write (or -1 for the entire buffer).

 

/KVBAAppend a binary blob to the value of an existing key. handle is a handle returned by @BALLOC; length is the length to write (or -1 for the entire buffer).

 

/KVFCreate a key / file value pair. If the key exists, it will be overwritten with the new value. length is the length of the file to write (or -1 for the entire file).

 

/KVFAAppend a file to the value of an existing key. length is the length of the file to write (or -1 for the entire file).

 

/KVSCreate a key / value pair. If the key exists, it will be overwritten with the new value.

 

/KVSAAppend a string to the value of an existing key.

 

/MMA read-only memory-mapped view of the database. Only valid when used with /RO.

 

/RRead the specified key and display the value. If the key doesn't exist (or doesn't have a value) UNQLITE will not display anything.

 

/ROOpen the database in read-only mode. If the database does not exist, an error is returned.

 

/RWOpen the database with read+write privileges. If the database does not exist, an error is returned.

 

/RWCOpen a database with read+write privileges.  The database is created if it doesn't exist.

 

/TEMPA private, temporary on-disk database will be created. The database will be deleted when the database is closed.