Delphi Firedac not recognizing new ALTER feature in sqlite3

风流意气都作罢 提交于 2021-02-17 06:25:09

问题


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.


回答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)




回答2:


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. 


来源:https://stackoverflow.com/questions/55894657/delphi-firedac-not-recognizing-new-alter-feature-in-sqlite3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!