We help IT Professionals succeed at work.

Delphi, Mysql and boolean

Mysterion
Mysterion asked
on
799 Views
Last Modified: 2013-11-05
Hi,

I have a problem with delphi and mysql.. when i save a boolean in the database, the false is 0 and the true is -1.

Is there any way to force mysql to save it as 1 instead of -1?

Thanks
Luc
Comment
Watch Question

Mike LittlewoodEngineer

Commented:
Some databases use -1 as true, some use 1.
Only other way I can think would be to not use boolean and use smallInt
Oracle dba
CERTIFIED EXPERT
Top Expert 2009
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Geert GOracle dba
CERTIFIED EXPERT
Top Expert 2009

Commented:
looking at the MySQL docs the value is stored as 0 or 1 into a TinyInt(1) field

http://dev.mysql.com/doc/refman/6.0/en/numeric-type-overview.html

how do you store the value into the mysql database ?
and what components do you use for this ?
aikimarkSocial distance; Wear a mask; Don't touch your face; Wash your hands for 20 seconds
CERTIFIED EXPERT
Top Expert 2014
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Geert GOracle dba
CERTIFIED EXPERT
Top Expert 2009

Commented:
Please read the help before you ask your next question
especially about accepting answers

http://beta.experts-exchange.com/help.jsp
aikimarkSocial distance; Wear a mask; Don't touch your face; Wash your hands for 20 seconds
CERTIFIED EXPERT
Top Expert 2014

Commented:
@Geert_Gruwez

Please be a bit more specific in what you are urging Mysterion to consider or change in evaluation of future answers.

Your answer was very language specific, where my answer was database/SQL specific.  Somewhere between the two of our answers, Luc seems to have gotten an acceptable work-around.  Looking at the new grading recommendations, I don't see anything amiss in the B grade and the split points.
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.