#1 2012-01-06 20:20:09

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

TSQLTable get fields name

I cannot find on TSQLTable object a mothod to get fields name, something like TSQLTable.GetFieldName(id: Integer);

Is there it?

Offline

#2 2012-01-06 20:36:10

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,667
Website

Re: TSQLTable get fields name

First row of the TSQLTable always contains the field names.

Offline

#3 2012-01-06 22:59:29

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: TSQLTable get fields name

OK thanks

Offline

#4 2012-01-06 23:20:24

Leander007
Member
From: Slovenia
Registered: 2011-04-29
Posts: 113

Re: TSQLTable get fields name

Small example:
First one (Get*) returns name of column (fetching first 0 indexed row, data is from 1 on).
Second one first un-camels name and potentially gets localized version of that text, if you use SQLite3i18n unit.

  var 
   table: TSQLTable;
   i: integer;

   (...)
   for i := 0 to table.FieldCount - 1 do
   begin
       writeln('col '+IntToStr(i)+' has name '+string(table.GetS(0,i))); 
       writeln('col '+IntToStr(i)+' has caption '+table.GetCaption(0,i)); 
   end;
   (...)        

Last edited by Leander007 (2012-01-06 23:21:28)


"Uncertainty in science: There no doubt exist natural laws, but once this fine reason of ours was corrupted, it corrupted everything.", Blaise Pascal

Offline

Board footer

Powered by FluxBB