0

SQLite3 release 3.25 and higher allows me to "ALTER TABLE myTable RENAME COLUMN oldColName TO newColName". But I get an error "near RENAME" when I execute this in my Delphi code, but it works running the new sqlite3.dll from the command line or with another utility.

This works:

HerdConnection.ExecSQL('ALTER TABLE myTable RENAME TO NewNameTable');

This fails:

HerdConnection.ExecSQL('ALTER TABLE myTable RENAME COLUMN oldcolName TO NewColName');

Since i installed the new sqlite3.dll driver, the column re-name does work, but NOT in my Delphi code (Delphi 10.2 Update 2)

I suspect the included sqlite3 driver with FireDac is not up to date, but have switched to the newest sqlite3.dll everywhere on the computer i can find.

2 Answers 2

1

You're probably using FireDAC with default SQLite static linking. Static linking based on SQLite binaries v 3.9.2. If you want to use the latest SQLite, you need to switch to dynamic linking. The exact instructions are on the link Connect to SQLite database (FireDAC)

Sign up to request clarification or add additional context in comments.

5 Comments

Thanks Branko for at least pointing me in the right direction. Unfortunately the link you included may be out of date or inaccurate, at least for my installation of Delphi 10.2.3. The instruction is to modify an ini file that is not located at the stated location, or anywhere else for that matter in my Embarcadero folder. The instructions had it located: C:\Program Files (x86)\Embarcadero\Studio\19.0\source\data\firedac. Only 3 pas files there with no obvious to me way to modify them.
@ScottStalheim - You must have Delphi Professional with FireDAC C/S Add-On Pack or at least Delphi Enterprise. You can use SQLite dynamic linking only if you have FireDAC source.
Thanks for the info. I have professional, but apparently without the FireDac C/S Add-On pack. My FireDac folder has 3 source files in it, but not the "ini" file. My registration for Professional includes the Mobile Add-on Pack, but I can not see how to add or buy the FireDac C/S Add on.
It really looks like they no more sell Firedac separately. Contact Embarcadero Sales, I'm sure they will offer you a solution
Thanks for your effort both of you. But the either modify the FireDAC.inc file or re-compiling the .pas files won't work (at least for RAD 10 seattle). That ecause I've tried to do both ways & fails. It seems Embarcadero want to force us to upgrade to other versions
1

The problem is after you change the FireDac.inc file nothing change ,that because the compiler use delphi .DCP files not .pas files I have the solution ,i just make it please follow these steps :

0-close delphi .
1- go to (C:\Program Files\Embarcadero\Studio\20.0\source\data\firedac) open FireDac.inc then remove (.) from line ({.$UNDEF FireDAC_SQLITE_STATIC}) then save it.
2- download the lase version of Sqlite3.dll .
3- go to (C:\Program Files\Embarcadero\Studio\20.0\bin)and replacing the old sqlite3.dll.  
4- go to your application exe folder and past the sqlite3.dll . 
5- open delphi and make new vcl application (debudg build) name it (myfire) and save it in new folder name it (fires).
6-go to (C:\Program Files\Embarcadero\Studio\20.0\source\data\firedac) and copy the following files to the (fires) folder :
a-FireDAC.Comp.BatchMove.SQL.pas
b-FireDAC.Phys.SQLite.pas
c-FireDAC.Phys.SQLiteCli.pas
d-FireDAC.Phys.SQLiteDef.pas
e-FireDAC.Phys.SQLiteMeta.pas
f-FireDAC.Phys.SQLiteVDataSet.pas
g-FireDAC.Phys.SQLiteWrapper.pas
h-FireDAC.Stan.SQLTimeInt.pas
i-FireDAC.Phys.SQLGenerator.pas
j-FireDAC.Phys.SQLPreprocessor.pas
7- add those file to (myfire) project and compile the project and close delphi.
8- go to (myfire) exe folder you will see .DCP files have the same name of 10 .pas files you added before. 
9- copy those 10 .DCP files and past them in (C:\ProgramFiles\Embarcadero\Studio\20.0\lib\win32\debug).
10-make the same steps form step 5 to 9 for (release build).
11-open delphi to your main project and recompile it then try (RENAME COLUMN) it will be work. 

5 Comments

Thank you for the detailed instructions. But I have Delphi Professional and apparently would have to update to Enterprise to get the "inc" files. Another concern is that I use the encryption feature from within Delphi, and it appears that if I go to dynamic linking, the documentation says I would lose that?
Another comment on your post is that the first line refers to version 19.0 (my version), and later lines refer to version 20.0 - I am sure just a typo and would work in 19.0 or 20.0. Either way I can not verify the process without the inc files.
the first line in my comment i copy it from internet< my version is 20.0
Thanks again Ahmed. I marked your answer as useful It is likely correct also, but I can not test it with my Delphi Professional version.
I tried to do what you suggest, but I have the problem with the DCP files, which are not produced by the compilation. Therefore I cannot complete with points 9 and 10. Strangely enough it works with a test apllication, but whe I try on my real project, it does.nt, probably because I don't know where to put all of those files. My application has a number of folders, each with a number of sources. Can you explain how is that you get DCP files and better detail where to store those files ? Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.