Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Database Server Software > MySQL > boolean in SQL

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-07-03, 05:16
swiatlo swiatlo is offline
Registered User
 
Join Date: Jul 2003
Posts: 4
Thumbs down boolean in SQL

I have finished application (Borland Builder C++) useing BDE and Paradox table. After all I wanted to change engine to other. It is MySQL + ODBC. Now there is no more suport for SQL statements like:
"select * from TableName"
"where record_saved = true"

record_saved is ftBoolean type. MySQL returns error:
>> true - invalid column name<<.

ftBoolean is converted to TINYINT(1).
How can I overcome this, and make my app to work with no big changes. Is there an interface I can modyfy 'false -> 0' 'true -> 1' ?
Reply With Quote
  #2 (permalink)  
Old 07-07-03, 13:30
Niels Niels is offline
Registered User
 
Join Date: Jun 2003
Posts: 21
Re: boolean in SQL

Quote:
Originally posted by swiatlo
I have finished application (Borland Builder C++) useing BDE and Paradox table. After all I wanted to change engine to other. It is MySQL + ODBC. Now there is no more suport for SQL statements like:
"select * from TableName"
"where record_saved = true"

record_saved is ftBoolean type. MySQL returns error:
>> true - invalid column name<<.

ftBoolean is converted to TINYINT(1).
How can I overcome this, and make my app to work with no big changes. Is there an interface I can modyfy 'false -> 0' 'true -> 1' ?


Use the ORD function (Delphi has it, I presume that C Builder also has it). It returns the ordinal value of a boolean being either 1 for TRUE or 0 for FALSE.

"select * from TableName"
"where record_saved = " + IntToStr(Ord(true))

Hope this helps.

Niels
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On