2015-12-15 97 views
1

我通过Firedac Connection通过GetFieldNames命令行恢复Firebird表的字段,但是某些列表字段是用引号返回的。FireDac GetFieldNames不带引号

我试着插入参数MetaDefCatalog = MySql指令,并没有解决。

List:=TStringList.Create; 
FDConnection.GetFieldNames('','','Table','',List); 
if List.IndexOf('Field') > 0 then 
// commands to create field in the table 

的问题是,当现场被Firedac充满了引号,如果要求创建一个已经存在并产生一个错误的领域(的dbExpress没有这样做)的条款。

的GetFieldNames的结果:

enter image description here

+1

啊,DATA可能是一个保留字。错误的数据库设计;-)也许FireBird用引号存储字段名称。 –

+0

这是FireDAC为什么要引用DATA字段名称的正确原因。 –

+0

@JanDoggen Firebird不会用引号存储对象名称,所以它很可能是工具/库。 –

回答

2

要删除引号,您可以使用StringReplace功能,像这样。

FDConnection.GetFieldNames('','','Table','',List); 
//remove the quotation marks 
List.Text := StringReplace(List.Text, '"', '', [rfReplaceAll]); 
if List.IndexOf('Field') > 0 then 
// commands to create field in the table 
+0

谢谢,RRUZ !!! – prmas