[VCOM] Question: How to get the Field-Type?

Kirill Pekarov kirill_pekarov at valentina-db.com
Mon Oct 22 04:04:25 CDT 2007


Hi, blackfin.

You wrote 21.10.2007, 17:12:44:

> Example:
> Cursor := DB.sqlselect('SELECT * FROM T1') ;
> Cursor.Firstrecord() ;
> Then, when I do a...
> FieldType := Cursor.Field(index).type_ ;

Using VCOM 3.4 I try next example:

procedure TForm1.Button1Click(Sender: TObject);
var
  V3 : IValentina ;
  V3Database : IVDatabase ;
  curs : IVCursor ;
  fldType : EVFieldType;
begin

  V3 := CoValentina.Create() ;

  V3.Init(10*1024*1024,'');
  V3.DebugLevel := kLogParams;

  V3Database := CoVDatabase.Create() ;
  V3Database.InitLocal(0);
  V3Database.Create( 'test.vdb', kDscDatBlbInd, 32, kOsDefault );

  V3Database.SqlExecute('CREATE TABLE Person (age long)', '');
  V3Database.SqlExecute('INSERT INTO Person(age) VALUES(1)', '');
  
  curs := V3Database.SqlSelect('SELECT * FROM Person', kClientSide, kReadOnly, kRandom, '' );

  fldType := curs.Field(1).type_;

  curs :=nil ;

  V3Database.Close();
  V3Database := nil ;

  V3.ShutDown();
  V3 := nil ;
end;

fldType return result as you can see into log file:

VDatabase.SqlSelect...
        PARAM: this = 14958280
        PARAM: inQuery = "SELECT * FROM Person"
        PARAM: inCursorLocation = 1
        PARAM: inLockType = 2
        PARAM: inCursorDirection = 2
        PARAM: inCursorLocation = 1
        PARAM: inLockType = 2
        PARAM: inCursorDirection = 2
return object = 14958320

VCursor.Field...
        PARAM: this = 14958320
        PARAM: inValue.lVal = 1
return object = 14958536

VField.get_Type...
        PARAM: this = 14958536
return res = 8



-- 
Best regards,

Kirill Pekarov
Software Engineer Associate
Paradigma Software, Inc
Valentina - The Ultra-Fast Database
http://www.valentina-db.com



More information about the Valentina mailing list