Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: SQLite Database Not Updating On Mac



Permlink Replies: 3 - Last Post: Nov 3, 2015 8:40 PM Last Post By: Dmitry Arefiev
Eric Hartner

Posts: 1
Registered: 7/7/10
SQLite Database Not Updating On Mac
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 3, 2015 6:55 PM
What I'm doing is quite simple and works on Windows but not on the Mac with a Delphi FMX application (Delphi 10 Trial). I've use a TFDQuery and did a selection from one of my tables. Then I do something as follows:

while not sqlTable.Eof do
begin
sqlTable.Edit;
sqlTable.FieldByName('field1').AsString := 'test';
sqlTable.Post;
sqlTable.Next;
end;

When running on Windows field1 is updated to test, but not on the Mac. On the Mac the date / time is not even changed on the SQLite database file.

Can anyone point me in the right direction?

Thank you,
Eric
Eli M

Posts: 1,346
Registered: 11/9/13
Re: SQLite Database Not Updating On Mac
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 3, 2015 7:24 PM   in response to: Eric Hartner in response to: Eric Hartner
So for sure the sqlite database exists and correctly deployed and not read only?

Maybe investigate the file on the Mac with:
http://sqlitebrowser.org/
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: SQLite Database Not Updating On Mac
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 3, 2015 7:26 PM   in response to: Eric Hartner in response to: Eric Hartner
Eric wrote:

When running on Windows field1 is updated to test, but not on the Mac.
On the Mac the date / time is not even changed on the SQLite database
file.

Note sure if this applies to you or not, but worth checking:

Editing Records
http://docwiki.embarcadero.com/RADStudio/en/Editing_Records

Note: Even if a dataset is in dsEdit state, editing records may not succeed
for SQL-based databases if your application's user does not have proper SQL
access privileges.

Also:

Data.DB.TDataSet.Post
http://docwiki.embarcadero.com/Libraries/Seattle/en/Data.DB.TDataSet.Post

Client datasets post records to an internal change log until they are applied
to the database by calling ApplyUpdates or merged with the client dataset's
data by calling MergeChangeLog.

Try calling sqlTable.ApplyUpdates() after posting your data.

--
Remy Lebeau (TeamB)
Dmitry Arefiev

Posts: 1,406
Registered: 12/7/03
Re: SQLite Database Not Updating On Mac
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 3, 2015 8:40 PM   in response to: Eric Hartner in response to: Eric Hartner
Several options:
1) You deploying a DB file to one place, but using some old file from another place.
Try to completely remove application files and install them again.
2) If your application creates required not existing tables on application startup,
but you did not specified DB file path to TFDConnection, then you will get in-memory
SQLite database, instead of using DB file.
Verify TFDConnection 'database=' parameter.
3) Try to replace TFDTable with TFDQuery.

--
With best regards,
Dmitry Arefiev / FireDAC Architect
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02