2

我是 Sqlite 和 LiveCode 的新手。我需要使用 liveCode 和 SqlLite 完成一些任务。谁能告诉我什么是适合 LiveCode 的 Sqlite 版本以及我可以从哪里下载它,因为我没有找到任何足够的信息关于它的网络。谢谢

4

2 回答 2

4

LiveCode 中包含一个 sqlite 驱动程序。只需阅读 revDB 函数和命令。本教程可能会帮助您:

http://lessons.runrev.com/s/lessons/m/4071/l/30516-how-to-create-and-use-an-sqlite-database

与 LiveCode 一起分发的当前版本是 3.7.4

于 2013-07-03T06:58:40.450 回答
3

在 LiveCode 6 中执行以下操作

  • 转到菜单帮助
  • 选择示例堆栈和资源
  • 打开示例文件夹
  • 双击SQLite Sampler.rev。堆栈SQLite Sampler.rev包含解释和代码片段。
  • 根据您的需要调整示例代码片段。

例如,从该堆栈中获取的以下片段连接到数据库AppReg3.db。如果数据库尚不存在,则创建该数据库。

gConID 保存连接标识符以在以后的脚本中引用数据库。

# Connect button script
on mouseUp
  global gConID
  put revOpenDatabase("sqlite","AppReg3.db",,,,,,) into tConID
  if tConID is "" then 
    answer warning "Problem creating or accessing database!"
  else
    answer information "AppReg Connected! Your connection ID is: " & tConID
    put tConID into gConID
  end if
end mouseUp

下面创建一个表Users

on mouseUp
  global gConID
  if gConID is "" then
    answer information "No Database is Connected to, please go back 1 step and connect to the Database!"
    exit mouseUp
  end if
  put "CREATE TABLE users(userID integer primary key, name text,email text,emailList boolean)" into tSQL
  put revExecuteSQL(gConID,tSQL) into tTmp
  handleRevDBerror tTmp
  if the result is not empty then 
    answer warning the result
    exit mouseUp
  end if
  answer information "Number of Tables Added: " & tTmp
 end mouseUp
于 2013-07-03T11:03:02.327 回答