Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用sqlite数据库部署android应用程序_Android_Sqlite_Livecode - Fatal编程技术网

使用sqlite数据库部署android应用程序

使用sqlite数据库部署android应用程序,android,sqlite,livecode,Android,Sqlite,Livecode,我在livecode中创建了一个使用sqlite数据库的应用程序。应用程序使用以下代码连接到数据库: on preopenstack --Used to connect to the database when application --first open and open the menu stack set the itemDelimiter to " " put item 2 of the name of the current stack into stackna

我在livecode中创建了一个使用sqlite数据库的应用程序。应用程序使用以下代码连接到数据库:

on preopenstack 
--Used to connect to the database when application 
--first open and open the menu stack

   set the itemDelimiter to " "
   put item 2 of  the name of the current stack into stackname
   put  the length of stackname into namelength
   put char 2 to namelength-1 stackname into stackname

   if stackname= "FoodPoisoningInvestigator" then

      -- Open a connection to the database and store 
      --the database id into global variable so 
      --other handlers can access it
      put the effective filename of this stack into tFolderPath
      set the itemDelimiter to slash
      delete last item of tFolderPath

      put tFolderPath & "/mysql2.sqlite" into gDatabasePath
      put revOpenDatabase("sqlite",gDatabasePath) into gDatabaseID

   end if 

end preopenstack
在standalone设置对话框的文件设置中,我选择了mysql2.sqlite,它在创建windows standalone时添加到文件夹中,但不适用于android。该应用程序安装在手机上,但即使在安装前我手动将其添加到文件夹中,它也不会连接到数据库


我做错了什么?

也许,您的应用程序没有访问apk包中数据库的权限,或者Gdata数据库路径不包含您期望的内容,或者路径不存在。请注意,.apk包是一个zip文件,无法直接访问,因此使用了虚拟路径。试一试

put specialFolderPath("engine") & "/mysql2.sqlite" into gDatabasePath
或者将数据库安装到

specialFolderPath("documents")
和使用

put specialFolderPath("documents") & "/mysql2.sqlite" into gDatabasePath

也许,您的应用程序没有访问apk包中数据库的权限,或者gDatabasePath不包含您期望的内容,或者该路径不存在。请注意,.apk包是一个zip文件,无法直接访问,因此使用了虚拟路径。试一试

put specialFolderPath("engine") & "/mysql2.sqlite" into gDatabasePath
或者将数据库安装到

specialFolderPath("documents")
和使用

put specialFolderPath("documents") & "/mysql2.sqlite" into gDatabasePath

Mark,我尝试了
将specialFolderPath(“documents”)和“/mysql2.sqlite”放入gDatabasePath将revOpenDatabase(“sqlite”,gDatabasePath)放入gDatabaseID
中,并在卡片调用测试中创建一个字段,并使用
将gDatabasePath放入fld“test”
来显示数据库的位置。我得到/data/data/com.sheilsapp.FPI13/files/mysql2.sqlite。我知道在需要数据库数据的字段中获取revdberr。Mark,您解释过.apk包是一个zip文件。如何确定sqlite文件是否已添加到包中您可以解压缩该文件,然后查看sqlite文件是否存在,或者您可以使用类似
的语法,即有一个文件路径
。我仍在努力。我已经解压,sqlite文件在资产文件夹中。最大的文件夹是lib,所以我猜它是用来存放应用程序的。基于此信息的任何建议?使用
此堆栈的有效文件名
显示应用程序存储在/data/app/com.sheilsapp.FPI13中。我已经尝试过使用/data/app/com.sheilsapp.FPI13/files/mysql2.sqlite作为数据库路径,但没有使用luckMark,我尝试过
将specialFolderPath(“文档”)和/mysql2.sqlite“放入gDatabasePath,将revOpenDatabase(“sqlite”,gDatabasePath)放入gDatabaseID
中,并在卡调用测试中创建一个字段,并使用
将gDatabasePath放入fld“试验“
以显示数据库的位置。我得到/data/data/com.sheilsapp.FPI13/files/mysql2.sqlite。我知道在需要数据库数据的字段中获取revdberr。Mark,您解释过.apk包是一个zip文件。如何确定sqlite文件是否已添加到包中您可以解压缩该文件,然后查看sqlite文件是否存在,或者您可以使用类似
的语法,即有一个文件路径
。我仍在努力。我已经解压,sqlite文件在资产文件夹中。最大的文件夹是lib,所以我猜它是用来存放应用程序的。基于此信息的任何建议?使用
此堆栈的有效文件名
显示应用程序存储在/data/app/com.sheilsapp.FPI13中。我尝试了/data/app/com.sheilsapp.FPI13/files/mysql2.sqlite作为数据库路径,但没有成功