Delphi Firedac无法识别sqlite3中的新ALTER功能

时间:2019-04-28 21:18:54

标签: sqlite delphi firedac

SQLite3版本3.25和更高版本允许我"ALTER TABLE myTable RENAME COLUMN oldColName TO newColName"使用。但是当我在Delphi代码中执行此操作时出现错误"near RENAME",但是它可以通过命令行或其他实用程序运行新的sqlite3.dll。

这有效:

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

此操作失败:

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

自从我安装了新的sqlite3.dll驱动程序以来,列重命名确实起作用了,但是在我的Delphi代码中却没有起作用(Delphi 10.2 Update 2)

我怀疑FireDac附带的sqlite3驱动程序不是最新的,但在我能找到的计算机上到处都切换到了最新的sqlite3.dll。

2 个答案:

答案 0 :(得分:1)

您可能正在使用带有默认SQLite静态链接的FireDAC。基于SQLite二进制v 3.9.2的静态链接。如果要使用最新的SQLite,则需要切换到动态链接。确切的说明位于链接Connect to SQLite database (FireDAC)

答案 1 :(得分:0)

问题是更改FireDac.inc文件后没有任何更改,这是因为编译器使用的是delphi .DCP文件而不是.pas文件 我有解决方案,请按照以下步骤操作:

0-close delphi .
1- go to (C:\Program Files (x86)\Embarcadero\Studio\19.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.