# unqlite 库模块帮助文档

## unqlite 成员列表 <a id="unqlite" href="#unqlite">&#x23;</a>

嵌入式NoSQL引擎

### unqlite("/test.db" ) <a id="unqlite("/test.db" )" href="#unqlite("/test.db" )">&#x23;</a>
打开数据库,  
可选使用参数二用 _UNQLITE_OPEN_ 前缀常量指定选项  
默认为 _UNQLITE_OPEN_CREATE

### unqlite() <a id="unqlite()" href="#unqlite()">&#x23;</a>
[返回对象:unqliteObject](#unqliteObject)

### unqlite.version <a id="unqlite.version" href="#unqlite.version">&#x23;</a>
unqlite版本

## unqliteObject 成员列表 <a id="unqliteObject" href="#unqliteObject">&#x23;</a>

### unqliteObject.append("键名",值,格式化参数) <a id="unqliteObject.append" href="#unqliteObject.append">&#x23;</a>
追加值到指定键  
格式化参数为可选参数  
成功返回0,失败返回非0

### unqliteObject.beginTrans() <a id="unqliteObject.beginTrans" href="#unqliteObject.beginTrans">&#x23;</a>
开始事务  
成功返回0,失败返回非0

### unqliteObject.commitTrans() <a id="unqliteObject.commitTrans" href="#unqliteObject.commitTrans">&#x23;</a>
提交事务  
成功返回0,失败返回非0

### unqliteObject.compile("jx9脚本") <a id="unqliteObject.compile" href="#unqliteObject.compile">&#x23;</a>
编译jx9脚本,  
参数可以是脚本代码或脚本文件路径

### unqliteObject.compile() <a id="unqliteObject.compile" href="#unqliteObject.compile">&#x23;</a>
[返回对象:unqliteJx9Object](#unqliteJx9Object)

### unqliteObject.configErrLog() <a id="unqliteObject.configErrLog" href="#unqliteObject.configErrLog">&#x23;</a>
返回错误信息

### unqliteObject.cursor() <a id="unqliteObject.cursor" href="#unqliteObject.cursor">&#x23;</a>
创建游标  

[返回对象:unqliteCursorObject](#unqliteCursorObject)

### unqliteObject.delete("键名") <a id="unqliteObject.delete" href="#unqliteObject.delete">&#x23;</a>
删除键值

### unqliteObject.fetch(键名) <a id="unqliteObject.fetch" href="#unqliteObject.fetch">&#x23;</a>
如果不指定回调函数,直接返回查询结果  
失败返回空值

### unqliteObject.fetch(键名,回调函数) <a id="unqliteObject.fetch" href="#unqliteObject.fetch">&#x23;</a>

```aardio
unqliteObject.fetch("/*键名*/",function( value ){  
	io.print( "查询返回", value )  
} )
```

### unqliteObject.fetchObject(键名) <a id="unqliteObject.fetchObject" href="#unqliteObject.fetchObject">&#x23;</a>
如果不指定回调函数,直接返回对象  
失败返回空值

### unqliteObject.fetchObject(键名,回调函数) <a id="unqliteObject.fetchObject" href="#unqliteObject.fetchObject">&#x23;</a>

```aardio
unqliteObject.fetchObject("/*键名*/",function( tab ){  
	io.print( "查询返回对象", tab )  
} )
```

### unqliteObject.rollbackTrans() <a id="unqliteObject.rollbackTrans" href="#unqliteObject.rollbackTrans">&#x23;</a>
回滚事务  
成功返回0,失败返回非0

### unqliteObject.store("键名",值,格式化参数) <a id="unqliteObject.store" href="#unqliteObject.store">&#x23;</a>
写入键值  
格式化参数为可选参数  
成功返回0,失败返回非0

### unqliteObject.storeFile("键名","文件路径") <a id="unqliteObject.storeFile" href="#unqliteObject.storeFile">&#x23;</a>
存储文件到数据库  
成功返回0,失败返回非0

### unqliteObject.storeObject("键名",表对象) <a id="unqliteObject.storeObject" href="#unqliteObject.storeObject">&#x23;</a>
写入表对象  
成功返回0,失败返回非0

### 自动完成常量
_SXERR_ABORT=-10  
_SXERR_BIG=-32  
_SXERR_BUSY=-14  
_SXERR_CONTINUE=-25  
_SXERR_CORRUPT=-24  
_SXERR_DONE=-28  
_SXERR_EMPTY=-3  
_SXERR_EOF=-18  
_SXERR_EXISTS=-11  
_SXERR_FORMAT=-21  
_SXERR_IGNORE=-63  
_SXERR_INVALID=-9  
_SXERR_IO=-2  
_SXERR_LIMIT=-7  
_SXERR_LOCKED=-4  
_SXERR_MEM=-1  
_SXERR_MORE=-8  
_SXERR_NEXT=-22  
_SXERR_NOMATCH=-26  
_SXERR_NOOP=-20  
_SXERR_NOTFOUND=-6  
_SXERR_NOTIMPLEMENTED=-17  
_SXERR_ORANGE=-5  
_SXERR_OS=-23  
_SXERR_OVERFLOW=-15  
_SXERR_PATH=-30  
_SXERR_PERM=-19  
_SXERR_RESET=-27  
_SXERR_RETRY=-33  
_SXERR_SHORT=-29  
_SXERR_SYNTAX=-12  
_SXERR_TIMEOUT=-31  
_SXERR_UNKNOWN=-13  
_SXERR_WILLBLOCK=-16  
_SXRET_OK=0  
_UNQLITE_ABORT=-10  
_UNQLITE_BUSY=-14  
_UNQLITE_CANTOPEN=-74  
_UNQLITE_COMPILE_ERR=-70  
_UNQLITE_CONFIG_DISABLE_AUTO_COMMIT=5  
_UNQLITE_CONFIG_ERR_LOG=3  
_UNQLITE_CONFIG_GET_KV_NAME=6  
_UNQLITE_CONFIG_JX9_ERR_LOG=1  
_UNQLITE_CONFIG_KV_ENGINE=4  
_UNQLITE_CONFIG_MAX_PAGE_CACHE=2  
_UNQLITE_CORRUPT=-24  
_UNQLITE_DONE=-28  
_UNQLITE_EMPTY=-3  
_UNQLITE_EOF=-18  
_UNQLITE_EXISTS=-11  
_UNQLITE_FULL=-73  
_UNQLITE_INVALID=-9  
_UNQLITE_IOERR=-2  
_UNQLITE_KV_CONFIG_CMP_FUNC=2  
_UNQLITE_KV_CONFIG_HASH_FUNC=1  
_UNQLITE_LIB_CONFIG_MEM_ERR_CALLBACK=2  
_UNQLITE_LIB_CONFIG_PAGE_SIZE=8  
_UNQLITE_LIB_CONFIG_STORAGE_ENGINE=7  
_UNQLITE_LIB_CONFIG_THREAD_LEVEL_MULTI=5  
_UNQLITE_LIB_CONFIG_THREAD_LEVEL_SINGLE=4  
_UNQLITE_LIB_CONFIG_USER_MALLOC=1  
_UNQLITE_LIB_CONFIG_USER_MUTEX=3  
_UNQLITE_LIB_CONFIG_VFS=6  
_UNQLITE_LIMIT=-7  
_UNQLITE_LOCKED=-4  
_UNQLITE_LOCKERR=-76  
_UNQLITE_LOCK_EXCLUSIVE=4  
_UNQLITE_LOCK_NONE=0  
_UNQLITE_LOCK_PENDING=3  
_UNQLITE_LOCK_RESERVED=2  
_UNQLITE_LOCK_SHARED=1  
_UNQLITE_NOMEM=-1  
_UNQLITE_NOOP=-20  
_UNQLITE_NOTFOUND=-6  
_UNQLITE_NOTIMPLEMENTED=-17  
_UNQLITE_OK=0  
_UNQLITE_OPEN_CREATE=4  
_UNQLITE_OPEN_EXCLUSIVE=8  
_UNQLITE_OPEN_IN_MEMORY=0x80  
_UNQLITE_OPEN_MMAP=0x100  
_UNQLITE_OPEN_NOMUTEX=0x20  
_UNQLITE_OPEN_OMIT_JOURNALING=0x40  
_UNQLITE_OPEN_READONLY=1  
_UNQLITE_OPEN_READWRITE=2  
_UNQLITE_OPEN_TEMP_DB=0x10  
_UNQLITE_PERM=-19  
_UNQLITE_READ_ONLY=-75  
_UNQLITE_SYNC_DATAONLY=0x10  
_UNQLITE_SYNC_FULL=3  
_UNQLITE_SYNC_NORMAL=2  
_UNQLITE_UNKNOWN=-13  
_UNQLITE_VM_CONFIG_ARGV_ENTRY=0xC  
_UNQLITE_VM_CONFIG_CREATE_VAR=6  
_UNQLITE_VM_CONFIG_ENV_ATTR=9  
_UNQLITE_VM_CONFIG_ERR_REPORT=3  
_UNQLITE_VM_CONFIG_EXEC_VALUE=0xA  
_UNQLITE_VM_CONFIG_EXTRACT_OUTPUT=0xD  
_UNQLITE_VM_CONFIG_HTTP_REQUEST=7  
_UNQLITE_VM_CONFIG_IMPORT_PATH=2  
_UNQLITE_VM_CONFIG_IO_STREAM=0xB  
_UNQLITE_VM_CONFIG_OUTPUT=1  
_UNQLITE_VM_CONFIG_RECURSION_DEPTH=4  
_UNQLITE_VM_CONFIG_SERVER_ATTR=8  
_UNQLITE_VM_ERR=-71  
_UNQLITE_VM_OUTPUT_LENGTH=5  
