Page 1 of 2

Bit table field type using query component

Posted: 20.07.2012, 00:23
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.

Posted: 20.07.2012, 13:16
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

Posted: 20.07.2012, 15:12
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

Posted: 22.07.2012, 13:02
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 ?

Posted: 22.07.2012, 13:42
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.

Posted: 22.07.2012, 15:14
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

Posted: 23.07.2012, 00:23
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?)

Posted: 23.07.2012, 06:48
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

Posted: 24.07.2012, 00:40
by ManUtdFans
Is there a component suite for the latest build such as in the old days to install the whole package?

Posted: 24.07.2012, 12:00
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

Posted: 25.07.2012, 04:01
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.

Posted: 25.07.2012, 04:05
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

Posted: 25.07.2012, 09:53
by EgonHugeist
ManUtdFans,

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

Michael

Posted: 26.07.2012, 02:45
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?

Posted: 26.07.2012, 02:47
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