FireDAC query->Open crashes on Android


I have a multi-device FMX Form that I’m building in Embarcadero C++Builder. The app opens a local SQLite database file (my_local.db) and performs queries against it.

It works fine on iOS, but crashes on Android. No error to catch. The SQLite file exists and the ShowMessage inside the #if statement returns “/data/user/0/com.embarcadero.Project1/files/my_local.db”.

If I comment out the query->Open() statement, the code runs and the app won’t crash.

#if defined(_PLAT_IOS) || defined(_PLAT_ANDROID)
Form1->FDConnection1->Params->Values[“ColumnMetadataSupported”] = “False”;
Form1->FDConnection1->Params->Values[“Database”] = System::Ioutils::TPath::Combine(System::Ioutils::TPath::GetDocumentsPath(), “my_local.db”);
if (FileExists(Form1->FDConnection1->Params->Values[“Database”])) {
ShowMessage(Form1->FDConnection1->Params->Values[“Database”]); // if file there show its path

TFDQuery *query;
query = new TFDQuery(NULL);
query->Connection = Form1->FDConnection1;
query->SQL->Text = “SELECT * FROM info”;

Any pointers or suggestions on how to catch this error?

Comments are closed.