When using the Boolean type in the sql create table statement, MariaDb (and I assume MySql) will produce a TINYINT(1) type. ZEOS has a MySQL_FieldType_Bit_1_IsBoolean option that allows BIT(1) to be mapped to a TZBooleanField, but nothing similar for TINYINT(1), which would be more useful these days.
Another thing, this is the description for the option MySQL_FieldType_Bit_1_IsBoolean: "Treat fieldtype BIT(1) as Boolean instead of ENUM('Y','N'), Default since 7.3". The mapping won't work if I don't add that option, so I don't understand what this "Default since 7.3" means.
Map MariaDb/MySql TINYINT(1) to TZBooleanField
-
- Platinum Boarder
- Posts: 1956
- Joined: 17.01.2011, 14:17
Re: Map MariaDb/MySql TINYINT(1) to TZBooleanField
Hello abonic,
Best regards,
Jan
I will add that as a feature request in the bug tracker.abonic wrote: ↑02.08.2024, 08:57 When using the Boolean type in the sql create table statement, MariaDb (and I assume MySql) will produce a TINYINT(1) type. ZEOS has a MySQL_FieldType_Bit_1_IsBoolean option that allows BIT(1) to be mapped to a TZBooleanField, but nothing similar for TINYINT(1), which would be more useful these days.
Zeos 8.0.0 has problems detecting modern libmaridab versions. This is because MariaDB decided to break versioning of libmariadb. Feature detection in Zeos 8.0.0 works well for libmaridb versioins 10. Newer libmariadb versions start with 3 as their verion number which breaks feature detection in Zeos. This has been adressed in the current 8.0-patches branch. We are going to release a new stable version soon.abonic wrote: ↑02.08.2024, 08:57 Another thing, this is the description for the option MySQL_FieldType_Bit_1_IsBoolean: "Treat fieldtype BIT(1) as Boolean instead of ENUM('Y','N'), Default since 7.3". The mapping won't work if I don't add that option, so I don't understand what this "Default since 7.3" means.
Best regards,
Jan
-
- Platinum Boarder
- Posts: 1956
- Joined: 17.01.2011, 14:17
Re: Map MariaDb/MySql TINYINT(1) to TZBooleanField
I created a feature request for this: https://sourceforge.net/p/zeoslib/internaltickets/51/.
We could decide to treat both field types (TINYINT(1) and BIT(1)) as boolean? Opinions?
Note: Adding this by default would be a breaking change.
We could decide to treat both field types (TINYINT(1) and BIT(1)) as boolean? Opinions?
Note: Adding this by default would be a breaking change.
Re: Map MariaDb/MySql TINYINT(1) to TZBooleanField
MySQL since version 8.0 has also defined BOOLEAN and BOOL as synonyms for TINYINT(1), so both databases are compatible in this regard.
I'm fine with any solution that will map TINYINT(1) to TZBooleanField, but it's possible someone uses TINYINT(1) as an integer. If that is indeed the case, then it would not be wise to make it a default option. The solution that guarantees the least problems is to introduce the MySQL_FieldType_TinyInt_1_IsBoolean property. Maybe even at the Dataset level, but that's probably a step too far.
I'm fine with any solution that will map TINYINT(1) to TZBooleanField, but it's possible someone uses TINYINT(1) as an integer. If that is indeed the case, then it would not be wise to make it a default option. The solution that guarantees the least problems is to introduce the MySQL_FieldType_TinyInt_1_IsBoolean property. Maybe even at the Dataset level, but that's probably a step too far.