Bit table field type using query component

Forum related to MySQL

Moderators: gto, cipto_kh, EgonHugeist

ManUtdFans
Fresh Boarder
Fresh Boarder
Posts: 23
Joined: 23.06.2010, 05:33

Bit table field type using query component

Post by ManUtdFans »

Hi,

We are using MySQL 5 and have a table field defined as Bit for using as Boolean equivalent.

I tried to write by using:
Query1.ParamByName('IsDue').AsBoolean := 1;
Query1.ParamByName('IsDue').AsSmallIn := 1;
Query1.ParamByName('IsDue').Value := 1;

All did not work.
josimarz
Junior Boarder
Junior Boarder
Posts: 41
Joined: 14.09.2009, 17:29
Location: Brazil

Post by josimarz »

Hi,

Verify your MySQL version. "Before 5.0.3, BIT is a synonym for TINYINT(1).".
Source: http://dev.mysql.com/doc/refman/5.0/en/ ... rview.html

Josimar
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

josimarz,

ManUtdFans,

nope this i think is an bug on our MySQL definition. Don't have a testccase now but what i can see in the ZDbcMySQLUtils.pas is that type defined as stBinaryStream which means we try to write into a lob which doesn't exits.

simply exchange the stBinaryStream with stSmallInt. So we are compatible to all client versions.

If i'm ready with testing then i'll commit a fix..

Michael
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
ManUtdFans
Fresh Boarder
Fresh Boarder
Posts: 23
Joined: 23.06.2010, 05:33

Post by ManUtdFans »

EgonHugeist wrote:josimarz,

ManUtdFans,

nope this i think is an bug on our MySQL definition. Don't have a testccase now but what i can see in the ZDbcMySQLUtils.pas is that type defined as stBinaryStream which means we try to write into a lob which doesn't exits.

simply exchange the stBinaryStream with stSmallInt. So we are compatible to all client versions.

If i'm ready with testing then i'll commit a fix..

Michael
After I changed to stSmallInt then what should I use:

Query1.ParamByname('IsDue').AsInteger ?
or
Query1.ParamByname('IsDue').AsValue ?
ManUtdFans
Fresh Boarder
Fresh Boarder
Posts: 23
Joined: 23.06.2010, 05:33

Post by ManUtdFans »

josimarz wrote:Hi,

Verify your MySQL version. "Before 5.0.3, BIT is a synonym for TINYINT(1).".
Source: http://dev.mysql.com/doc/refman/5.0/en/ ... rview.html

Josimar
Hmm, we are using 5.x, newer than 5.0.3.
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

ManUtdFans,

i patched this stupid issue in Rev 155x?? Don't know if you've recognized it. We moved our SF.NET location.

New url for the testing-branch is: http://svn.code.sf.net/p/zeoslib/code-0 ... es/testing

can you please check if that issue is gone?

Michael
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
ManUtdFans
Fresh Boarder
Fresh Boarder
Posts: 23
Joined: 23.06.2010, 05:33

Post by ManUtdFans »

EgonHugeist wrote:ManUtdFans,

i patched this stupid issue in Rev 155x?? Don't know if you've recognized it. We moved our SF.NET location.

New url for the testing-branch is: http://svn.code.sf.net/p/zeoslib/code-0 ... es/testing

can you please check if that issue is gone?

Michael
I have not updated Zeos since 2009, where can I update it?
Not sure what version I am using neither in D2007 (how do I check what version of mine?)
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

ManUtdFans,

Oh oh since 2009 no update?!

Ok you here are the new URLs for our SVN:

http://zeos.firmos.at/viewtopic.php?t=3431

Please download the testing branch where i added the patch. The offical trunk is deprecated and will be updated in two weeks.

Michael
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
ManUtdFans
Fresh Boarder
Fresh Boarder
Posts: 23
Joined: 23.06.2010, 05:33

Post by ManUtdFans »

Is there a component suite for the latest build such as in the old days to install the whole package?
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

ManUtdFans,

this is never a good idea i think. Only if a stable candidate was released. On the other hand you miss all fixes which have been allready done and you're forced to fix them by your selves. Also are we not willing to build suh an package each times after fixing something. I hope you can understand this.

Michael
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
ManUtdFans
Fresh Boarder
Fresh Boarder
Posts: 23
Joined: 23.06.2010, 05:33

Post by ManUtdFans »

In addition, if I use the query for retrieving the contents, how should I compare?

eg

with Query1 do
begin
Close;
SQL.Clear;
SQL.Add('select Name, IsNew from employee');
Open;
First;
if FieldByName('IsNew').AsInteger = 1 then
Showmessage('Employee is new')
else
Showmessage('Employee is NOT new');

I got a runtime error saying:
'Cannot access field 'IsNew' as type Integer'

I also tried:
f FieldByName('IsNew').AsVariant = 1
got exception too.
ManUtdFans
Fresh Boarder
Fresh Boarder
Posts: 23
Joined: 23.06.2010, 05:33

Post by ManUtdFans »

EgonHugeist wrote:ManUtdFans,

this is never a good idea i think. Only if a stable candidate was released. On the other hand you miss all fixes which have been allready done and you're forced to fix them by your selves. Also are we not willing to build suh an package each times after fixing something. I hope you can understand this.

Michael
Yes, I understand the fix will be from now and then.
I have also installed tortoise but not sure how to overwrite my installed Zeos source files.

I have installed Zeos package 3 years ago, eg. on:
C:\Delphi\Zeos
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

ManUtdFans,

hmm whats left to say? Time to update and using Tortoise!! :)

Michael
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
ManUtdFans
Fresh Boarder
Fresh Boarder
Posts: 23
Joined: 23.06.2010, 05:33

Post by ManUtdFans »

EgonHugeist wrote:ManUtdFans,

hmm whats left to say? Time to update and using Tortoise!! :)

Michael
Hi,

So after I do an update (via tortoise), then copy the files into my Zeos installed folder?

Edit:- yes of course I need to make a back up of my installatin folder first:
- back up my Zeos 6.6.4 installation folder
eg.
C:\Delphi\Zeos
Copy to C:\Delphi\Zeos_Backup

- use tortoise point to
svn://zeos.firmos.at/zeos/trunk

- update it
- copy the all folders over-write by original Zeos installation folder

Am I correct?
Last edited by ManUtdFans on 26.07.2012, 04:03, edited 1 time in total.
ManUtdFans
Fresh Boarder
Fresh Boarder
Posts: 23
Joined: 23.06.2010, 05:33

Post by ManUtdFans »

EgonHugeist wrote:josimarz,

ManUtdFans,

nope this i think is an bug on our MySQL definition. Don't have a testccase now but what i can see in the ZDbcMySQLUtils.pas is that type defined as stBinaryStream which means we try to write into a lob which doesn't exits.

simply exchange the stBinaryStream with stSmallInt. So we are compatible to all client versions.

If i'm ready with testing then i'll commit a fix..

Michael
Hi,

I think my version is a bit old, this is in ZDcintfs

{** Defines supported SQL types. }
TZSQLType = (stUnknown, stBoolean, stByte, stShort, stInteger, stLong, stFloat,stDouble, stBigDecimal, stString, stUnicodeString, stBytes, stDate, stTime,stTimestamp, stAsciiStream, stUnicodeStream, stBinaryStream);

There is no stSmallInt.
I'll try stByte of stShort to see if it works.

Thanks
Post Reply