Fields with NULL values in MyDac

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
NoComprende
Posts: 135
Joined: Tue 09 Jan 2007 13:44

Fields with NULL values in MyDac

Post by NoComprende » Thu 19 Apr 2007 09:15

I know that MySQL treat NULL and empty strings ('') as being different. Does MyDac do the same? I noticed yesterday that

MyQuery->FieldByName("StringField")->IsNull returned false

yet the BCB IDE inspector displayed the value of

MyQuery->FieldByName("StringField")->AsString as NULL.

[The field in question has a MySQL default value of ''].

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

Post by Antaeus » Thu 19 Apr 2007 14:51

Both MySQL and MyDAC treat NULL values and empty strings as different values. If a field contains the NULL value, the IsNull method returns True, but AsString converts NULL values to empty strings.

Post Reply