#1 2015-05-19 07:52:33

cypriotcalm
Member
Registered: 2015-02-18
Posts: 122

boolean data type created as int(11) in MySQL

Hi ab,

if I define a custom SQL-class inherited from TSQLRecord with a boolean field and let the ORM create the corresponding table in a MySQL database, the boolean field is created as int(11) and not as tinyint(1) which is a type for the boolean-values in MySQL. After the table creation I have a problem to read this field in delphi. I get an error something like "... this is not a boolean value type..."

How could I solve this problem through the ORM?

Thanks!

Offline

#2 2015-05-19 07:59:47

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,182
Website

Re: boolean data type created as int(11) in MySQL

Create the table by hand, before the ORM tries to create it.

Offline

#3 2015-05-19 08:05:30

cypriotcalm
Member
Registered: 2015-02-18
Posts: 122

Re: boolean data type created as int(11) in MySQL

ab wrote:

Create the table by hand, before the ORM tries to create it.

by hand you mean executing a custom SQL "create table..."?

Offline

#4 2015-05-19 08:29:10

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,182
Website

Re: boolean data type created as int(11) in MySQL

Yes

Offline

#5 2015-05-19 09:03:46

cypriotcalm
Member
Registered: 2015-02-18
Posts: 122

Re: boolean data type created as int(11) in MySQL

Ok, thx for your answer, I also did solve the problem in this way, but I thought I could do it without custom SQL code and let it do the ORM for me

Last edited by cypriotcalm (2015-05-19 09:04:19)

Offline

Board footer

Powered by FluxBB