AsInt64 is not available

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
arno
Posts: 6
Joined: Mon 19 Jun 2006 09:05
Location: Denmark

AsInt64 is not available

Post by arno » Thu 16 Nov 2006 10:23

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

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Thu 16 Nov 2006 15:54

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));

Rocojo
Posts: 18
Joined: Tue 24 Jan 2006 12:57
Location: Eindhoven, The Netherlands

Post by Rocojo » Tue 21 Nov 2006 11:01

AsFloat is also possible to use

arno
Posts: 6
Joined: Mon 19 Jun 2006 09:05
Location: Denmark

In Borland C++ Builder it would look like this

Post by arno » Thu 23 Nov 2006 18:12

In Borland C++ Builder it would look like this:

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

Post Reply