更新记录
1.0.7(2024-06-21)
1.优化插件内部逻辑。 2.打开数据库接口新增path参数,执行接口后返回dbPath路径参数。
1.0.6(2024-03-08)
调整interface.uts文件中接口导出信息。
1.0.5(2024-03-07)
插件陪配置中新增abis支持说明
查看更多平台兼容性
Vue2 | Vue3 |
---|---|
√ | √ |
App | 快应用 | 微信小程序 | 支付宝小程序 | 百度小程序 | 字节小程序 | QQ小程序 |
---|---|---|---|---|---|---|
HBuilderX 3.6.8,Android:4.4,iOS:9,HarmonyNext:不确定 | × | × | × | × | × | × |
钉钉小程序 | 快手小程序 | 飞书小程序 | 京东小程序 |
---|---|---|---|
× | × | × | × |
H5-Safari | Android Browser | 微信浏览器(Android) | QQ浏览器(Android) | Chrome | IE | Edge | Firefox | PC-Safari |
---|---|---|---|---|---|---|---|---|
× | × | × | × | × | × | × | × | × |
概述
XF-sqliteUTS实现了iOS、Android系统下操作加密的sqlite的数据库功能。
插件接口
openDatabase
打开数据库
uni-app项目中(nvue)调用示例:
import { openDatabase } from "@/uni_modules/XF-sqliteUTS"
openDatabase({
name: "demo",
password: "123456",
complete: (res) => {
console.log(res)
}
});
uni-app x项目(uvue)中调用示例:
import { openDatabase } from "@/uni_modules/XF-sqliteUTS";
import { OpenDatabaseOptions } from "@/uni_modules/XF-sqliteUTS/utssdk/interface.uts";
let options = {
name: "demo",
password: "123456",
complete: (res : any) => {
console.log(res)
}
} as OpenDatabaseOptions;
openDatabase(options);
可用性
iOS、Android系统
可提供的1.0.0及更高版本
closeDatabase
关闭数据库
uni-app项目中(nvue)调用示例:
import { closeDatabase } from "@/uni_modules/XF-sqliteUTS"
closeDatabase({
name: "demo",
complete: (res) => {
console.log(res)
}
});
uni-app x项目(uvue)中调用示例:
import { closeDatabase } from "@/uni_modules/XF-sqliteUTS";
import { CloseDatabaseOptions } from "@/uni_modules/XF-sqliteUTS/utssdk/interface.uts";
let options = {
name: "demo",
complete: (res : any) => {
console.log(res)
}
} as CloseDatabaseOptions;
closeDatabase(options);
可用性
iOS、Android系统
可提供的1.0.0及更高版本
transaction
事务执行提交
uni-app项目中(nvue)调用示例:
import { transaction } from "@/uni_modules/XF-sqliteUTS"
transaction({
name: "demo",
operation: "commit",
complete: (res) => {
console.log(res)
}
});
uni-app x项目(uvue)中调用示例:
import { transaction } from "@/uni_modules/XF-sqliteUTS";
import { TransactionOptions } from "@/uni_modules/XF-sqliteUTS/utssdk/interface.uts";
let options = {
name: "demo",
operation: "commit",
complete: (res : any) => {
console.log(res)
}
} as TransactionOptions;
transaction(options);
可用性
iOS、Android系统
可提供的1.0.0及更高版本
executeSql
执行Sql语句
uni-app项目中(nvue)调用示例:
import { executeSql } from "@/uni_modules/XF-sqliteUTS"
executeSql({
name: "demo",
sql : "",
complete: (res) => {
console.log(res)
}
});
uni-app x项目(uvue)中调用示例:
import { executeSql } from "@/uni_modules/XF-sqliteUTS";
import { ExecuteSqlOptions } from "@/uni_modules/XF-sqliteUTS/utssdk/interface.uts";
let options = {
name: "demo",
sql : "",
complete: (res : any) => {
console.log(res)
}
} as ExecuteSqlOptions;
executeSql(options);
可用性
iOS、Android系统
可提供的1.0.0及更高版本
selectSql
查询数据库数据
uni-app项目中(nvue)调用示例:
import { selectSql } from "@/uni_modules/XF-sqliteUTS"
selectSql({
name: "demo",
sql : "",
complete: (res) => {
console.log(res)
}
});
uni-app x项目(uvue)中调用示例:
import { selectSql } from "@/uni_modules/XF-sqliteUTS";
import { ExecuteSqlOptions } from "@/uni_modules/XF-sqliteUTS/utssdk/interface.uts";
let options = {
name: "demo",
sql : "",
complete: (res : any) => {
console.log(res)
}
} as ExecuteSqlOptions;
selectSql(options);
可用性
iOS、Android系统
可提供的1.0.0及更高版本
updatePassword
修改数据库密码
uni-app项目中(nvue)调用示例:
import { updatePassword } from "@/uni_modules/XF-sqliteUTS"
updatePassword({
name: "demo",
password: "123456",
complete: (res) => {
console.log(res)
}
});
uni-app x项目(uvue)中调用示例:
import { updatePassword } from "@/uni_modules/XF-sqliteUTS";
import { UpdatePasswordOptions } from "@/uni_modules/XF-sqliteUTS/utssdk/interface.uts";
let options = {
name: "demo",
password: "123456",
complete: (res : any) => {
console.log(res)
}
} as UpdatePasswordOptions;
updatePassword(options);
可用性
iOS、Android系统
可提供的1.0.0及更高版本
isOpen
数据库是否打开
uni-app项目中(nvue)调用示例:
import { isOpen } from "@/uni_modules/XF-sqliteUTS"
isOpen("demo");
uni-app x项目(uvue)中调用示例:
import { isOpen } from "@/uni_modules/XF-sqliteUTS";
isOpen("demo");
可用性
iOS、Android系统
可提供的1.0.0及更高版本