prmas
prmas

Reputation: 15

FireDac GetFieldNames without quotes

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

Upvotes: 1

Views: 1105

Answers (1)

RRUZ
RRUZ

Reputation: 136401

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

Upvotes: 2

Related Questions