Bit table field type using query component
Moderators: gto, cipto_kh, EgonHugeist
-
- Fresh Boarder
- Posts: 23
- Joined: 23.06.2010, 05:33
Bit table field type using query component
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.
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.
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
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
- EgonHugeist
- Zeos Project Manager
- Posts: 1936
- Joined: 31.03.2011, 22:38
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
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/
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/
-
- Fresh Boarder
- Posts: 23
- Joined: 23.06.2010, 05:33
After I changed to stSmallInt then what should I use: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
Query1.ParamByname('IsDue').AsInteger ?
or
Query1.ParamByname('IsDue').AsValue ?
-
- Fresh Boarder
- Posts: 23
- Joined: 23.06.2010, 05:33
Hmm, we are using 5.x, newer than 5.0.3.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
- EgonHugeist
- Zeos Project Manager
- Posts: 1936
- Joined: 31.03.2011, 22:38
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 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/
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/
-
- Fresh Boarder
- Posts: 23
- Joined: 23.06.2010, 05:33
I have not updated Zeos since 2009, where can I update it?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
Not sure what version I am using neither in D2007 (how do I check what version of mine?)
- EgonHugeist
- Zeos Project Manager
- Posts: 1936
- Joined: 31.03.2011, 22:38
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
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/
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/
-
- Fresh Boarder
- Posts: 23
- Joined: 23.06.2010, 05:33
- EgonHugeist
- Zeos Project Manager
- Posts: 1936
- Joined: 31.03.2011, 22:38
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
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/
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/
-
- Fresh Boarder
- Posts: 23
- Joined: 23.06.2010, 05:33
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.
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.
-
- Fresh Boarder
- Posts: 23
- Joined: 23.06.2010, 05:33
Yes, I understand the fix will be from now and then.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
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
- EgonHugeist
- Zeos Project Manager
- Posts: 1936
- Joined: 31.03.2011, 22:38
ManUtdFans,
hmm whats left to say? Time to update and using Tortoise!!
Michael
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/
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/
-
- Fresh Boarder
- Posts: 23
- Joined: 23.06.2010, 05:33
Hi,EgonHugeist wrote:ManUtdFans,
hmm whats left to say? Time to update and using Tortoise!!
Michael
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.
-
- Fresh Boarder
- Posts: 23
- Joined: 23.06.2010, 05:33
Hi,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
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