Page 1 of 1

AsInt64 is not available

Posted: Thu 16 Nov 2006 10:23
by arno
Hi!

If I want to get an integer from a row in a table I do this:
MyQuery->FieldByName("ResultId")->AsInteger

But there is not a function like this:
MyQuery->FieldByName("ResultId")->AsInt64

How do I get a BIGINT value from MySQL database?

Regard Thomas

Posted: Thu 16 Nov 2006 15:54
by Antaeus
If the ResultId field is represented as TLargeintField on the client, you can cast it explicitly to TLargeintField and call the AsLargeInt method.
In Delphi this may look like the following:

Code: Select all

  if MyQuery1.FieldByName('c_int64') is TLargeintField then
    ShowMessage(IntToStr(TLargeintField(MyQuery1.FieldByName('c_int64')).AsLargeInt));

Posted: Tue 21 Nov 2006 11:01
by Rocojo
AsFloat is also possible to use

In Borland C++ Builder it would look like this

Posted: Thu 23 Nov 2006 18:12
by arno
In Borland C++ Builder it would look like this:

unsigned __int64 val;
val = ((TLargeintField*)MyQuery->FieldByName("c_int64"))->AsLargeInt;