import{_ as t,b as e,d as a,p as s,w as n,H as l,i,o as u,f as c,k as f,R as o}from"./index-2PZN6pGH.js";const r=t({data:()=>({title:"SQLite"}),methods:{openDB:function(){plus.sqlite.openDatabase({name:"first",path:"_doc/test.db",success:function(t){plus.nativeUI.alert("打开数据库test.db成功 ")},fail:function(t){plus.nativeUI.alert("打开数据库test.db失败: "+JSON.stringify(t))}})},executeSQL:function(){plus.sqlite.executeSql({name:"first",sql:'create table if not exists database("name" CHAR(110),"sex" CHAR(10),"age" INT(11))',success:function(t){plus.sqlite.executeSql({name:"first",sql:"insert into database values('彦','女','7000')",success:function(t){plus.nativeUI.alert("创建表table和插入数据成功")},fail:function(t){plus.nativeUI.alert("创建表table成功但插入数据失败: "+JSON.stringify(t))}})},fail:function(t){plus.nativeUI.alert("创建表table失败: "+JSON.stringify(t))}})},selectSQL:function(){plus.sqlite.selectSql({name:"first",sql:"select * from database",success:function(t){plus.nativeUI.alert("查询SQL语句成功: "+JSON.stringify(t))},fail:function(t){plus.nativeUI.alert("查询SQL语句失败: "+JSON.stringify(t))}})},droptable:function(){plus.sqlite.executeSql({name:"first",sql:"drop table database",success:function(t){plus.nativeUI.alert("删除表database成功")},fail:function(t){plus.nativeUI.alert("删除表database失败: "+JSON.stringify(t))}})},closeDB:function(){plus.sqlite.closeDatabase({name:"first",success:function(t){plus.nativeUI.alert("关闭数据库成功")},fail:function(t){plus.nativeUI.alert("关闭数据库失败: "+JSON.stringify(t))}})},isOpenDB:function(){plus.sqlite.isOpenDatabase({name:"first",path:"_doc/test.db"})?plus.nativeUI.alert("Opened!"):plus.nativeUI.alert("Unopened!")}}},[["render",function(t,r,p,d,b,m){const v=e(a("page-head"),l),y=o,_=i;return u(),s(_,null,{default:n((()=>[c(v,{title:b.title},null,8,["title"]),c(_,{class:"uni-padding-wrap uni-common-mt"},{default:n((()=>[c(_,{class:"uni-btn-v"},{default:n((()=>[c(y,{type:"primary",onClick:m.openDB},{default:n((()=>[f("打开数据库test.db")])),_:1},8,["onClick"])])),_:1}),c(_,{class:"uni-btn-v"},{default:n((()=>[c(y,{type:"primary",onClick:m.executeSQL},{default:n((()=>[f("创建表database及插入数据")])),_:1},8,["onClick"])])),_:1}),c(_,{class:"uni-btn-v"},{default:n((()=>[c(y,{type:"primary",onClick:m.selectSQL},{default:n((()=>[f("查询表database的数据")])),_:1},8,["onClick"])])),_:1}),c(_,{class:"uni-btn-v"},{default:n((()=>[c(y,{type:"primary",onClick:m.droptable},{default:n((()=>[f("删除表database")])),_:1},8,["onClick"])])),_:1}),c(_,{class:"uni-btn-v"},{default:n((()=>[c(y,{type:"primary",onClick:m.closeDB},{default:n((()=>[f("关闭数据库test.db")])),_:1},8,["onClick"])])),_:1}),c(_,{class:"uni-btn-v"},{default:n((()=>[c(y,{type:"primary",onClick:m.isOpenDB},{default:n((()=>[f("查询是否打开数据库")])),_:1},8,["onClick"])])),_:1})])),_:1})])),_:1})}],["__scopeId","data-v-f8ea0662"]]);export{r as default};
