简体   繁体   English

Delphi FMX - Android API 26 - 与 UniDAC 的 SQLite 数据库连接

[英]Delphi FMX - Android API 26 - SQLite DB Connection with UniDAC

I'm using Tokyo 10.2.3 and UniDAC component for interacting with an SQLite database on Android API 26 Platform.我正在使用 Tokyo 10.2.3 和 UniDAC 组件与 Android API 26 平台上的 SQLite 数据库进行交互。 So far, with the help from Dave:到目前为止,在 Dave 的帮助下:

http://www.delphiworlds.com/2018/06/targeting-android-8-and-higher-continued/ http://www.delphiworlds.com/2018/06/targeting-android-8-and-higher-continued/

... the App worked fine with access to 'TakePhoto', 'Positioning', 'W/R to external storage'... The UniDAC MySQL Connection is working too but seems to need no further permissions. ...该应用程序在访问“TakePhoto”、“定位”、“W/R 到外部存储”时运行良好...UniDAC MySQL Connection 也在运行,但似乎不需要进一步的权限。

But I can get no connection to my SQLite Database anymore.但是我再也无法连接到我的 SQLite 数据库了。 Before the change from SDK14 to SDK26, the connection worked fine.在从 SDK14 更改为 SDK26 之前,连接工作正常。 Seems to me, as it is a problem with accessing 'external' URIs as Dave described in his blog.在我看来,正如戴夫在他的博客中所描述的那样,访问“外部”URI 是一个问题。 I changed the Manifest.xml, added a file-provider and added the provider_paths.xml too.我更改了 Manifest.xml,添加了文件提供程序并添加了 provider_paths.xml。

The way of choose the Databasefile with UniDAC as String:选择UniDAC为字符串的数据库文件的方法:

SQLiteConnection1.Database := TPath.Combine(TPath.GetDocumentsPath, 'test.db');

Any solutions or help outside?任何解决方案或外部帮助?

Deployment path: assets\internal部署路径:assets\internal
Change UniConnection.Direct to true.将 UniConnection.Direct 更改为 true。 Add UNIDAC before connection连接前添加UNIDAC

procedure TDataModule1.UniCon_SQliteBeforeConnect(Sender: TObject);
begin
  {$IF DEFINED(iOS) or DEFINED(ANDROID)}
  DataModule1.UniCon_SQlite.Database :=
  TPath.Combine(TPath.GetDocumentsPath, 'st_pass.db');
  {$ENDIF}
end;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM