1

I am recovering the fields of Firebird tables by Firedac Connection through GetFieldNames command line, however some list fields are returned with quotes.

I've tried inserting the parameters to MetaDefCatalog = MySql directive and not solved.

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

The problem is that when the field is filled with quotes by Firedac (DBExpress did not do that) the clause if asked to create the field that already exists and generates an error.

Result of the GetFieldNames:

enter image description here

3
  • 1
    Ah, DATA is probably a reserved word. Bad database design ;-) Maybe FireBird stored the field name with quotes.
    – Jan Doggen
    Dec 15, 2015 at 20:01
  • This is the correct reason of why FireDAC quotes the DATA field name.
    – da-soft
    Dec 16, 2015 at 8:53
  • @JanDoggen Firebird doesn't store object names with quotes, so it is likely the tool/library doing this. Dec 16, 2015 at 12:33

1 Answer 1

2

To remove the quotation marks, you can use the StringReplace function like so.

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

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.