More BIT datatype mess?

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
upscene

More BIT datatype mess?

Post by upscene » Sun 08 Jan 2006 16:06

Create table:

create table bit_and_others_table
( b_10 bit(10),
b_ bit,
bool_ boolean

)

When selecting data, the b_10 column comes back as a TBooleanField? This seems incorrect. Is there any length recognition for the BIT datatype?

--
Martijn Tonies
Upscene Productions

upscene

Post by upscene » Mon 09 Jan 2006 09:40

When working with BIT datatypes with a length of >2, this might be useful:
http://dev.mysql.com/doc/refman/5.0/en/ ... alues.html

I guess it shouldn't always come back as a TBooleanField and the component needs to be changed.

Can you confirm?

--
Martijn Tonies
Upscene Productions

GEswin
Posts: 186
Joined: Wed 03 Nov 2004 16:57
Location: Spain
Contact:

Post by GEswin » Mon 09 Jan 2006 10:17

Has it any sense to define a bit field > 1 bit ?? I would supose those fields are for setting boolean (True/False).

upscene

Post by upscene » Mon 09 Jan 2006 10:25

If MySQL allows you to do that, and define, for example:

create table myflags
(
flag bit(4)
)

Then yes, it makes sense. Would I do it? No. Would my customers? Yes, I just got a bug-report about this :)

--
Martijn Tonies
Upscene Productions

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Tue 10 Jan 2006 16:20

Without additional request to server we can't distinguish BIT from BIT(2). We can distinguish BIT from BIT(10) by using Length parameter. But for BIT and BIT(2)value of Length is same.

upscene

Post by upscene » Tue 10 Jan 2006 16:30

Well, I guess the components need some modification then :)

BIT(2) is just very different from BIT(1) and MyDAC currently doesn't support it.

--
Martijn Tonies
Upscene Productions[/quote]

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Wed 11 Jan 2006 10:25

This is MySQL server technology restriction. Supporting this feature would slow down execution of statements greatly.

upscene

Post by upscene » Wed 11 Jan 2006 14:58

Sorry, but I fail to see the problem here.

Thing is: supplying us Delphi-guys with a TBooleanField is simply wrong for BIT(> 1).

For example, the Microolap guys just introduced BIT support:
[+] BIT datatype support. Fields are represented like TLargeintField (int64).
Which makes sense, given that there's a max of 64 bits to be supported in the BIT datatype.

Can't you do this for BIT(>1)? Actually, you SHOULD do this, given that the current BIT-support implementation is crippled.

--
Martijn Tonies
Upscene Productions

upscene

Post by upscene » Mon 16 Jan 2006 10:06

Any news on this? What are your plans on solving this?

As far as I can see, there are two issues here:

1) flawed implementation for BIT with a length > 1

2) problems in the implementation with the Prepared protocol and MyDAC.


For (1) I would say: use some kind of integer based TField instead of a TBooleanField.

For (2), I sent you two e-mail addresses of people with the MySQL crew that are willing to help, IF there is a problem.

--
Martijn Tonies
Upscene Productions

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Mon 16 Jan 2006 13:32

> 1) flawed implementation for BIT with a length > 1
MySQL API doesn't provide ability to distinguish BIT(1) and BIT(>1). So, from nearest build all MySQL 5 BIT fields, including BIT(1), will be represented as TLargeintField.

> 2) problems in the implementation with the Prepared protocol and MyDAC.

> I sent you two e-mail addresses of people

We will contact them at nearest time.

Post Reply