Enum fields, as checkboxes not Listbox

[expired user #589]'s profile image [expired user #589] posted 17 years ago in General Permalink
I gave a field type Enum('Y','N')
Heidi gives me checkbox in Edit GridView, checked when 'Y', unchecked when 'N'.
Not a problem perse but if unchecked it will not default to 'N'.
Edit GridView this field I expect to be a dropdown listbox with the values to choose from.

Am I wrong?

Walter
ansgar's profile image ansgar posted 17 years ago Permalink
I'm not sure if I understood your question correctly. Anyway, ENUMs with 'Y','N' set are interpreted as what we could call a boolean column. In MySQL there's no support for real boolean field-types as in some other DBMS, therefore many users use ENUM instead.
[expired user #589]'s profile image [expired user #589] posted 17 years ago Permalink

I'm not sure if I understood your question correctly. Anyway, ENUMs with 'Y','N' set are interpreted as what we could call a boolean column. In MySQL there's no support for real boolean field-types as in some other DBMS, therefore many users use ENUM instead.



You are correct.
Question merely comes down to, HeidiSQL representing ENUM('Y','N') as checkboxes where 'others' represent as listbox giving the DBA the option to select value more easier.

Just a friendly comment.
Thanks
[expired user #589]'s profile image [expired user #589] posted 17 years ago Permalink
Aha, I think I just found a bug that causes me to post my previous posts.

Try this:
Using Im/Export -> Export Tables
Options set to Database:Create if Necessary, Tables: Recreate
Target Compatibility MySQL 3.23-5
Output Another Host / DB

Source is MySQL 4.1.14 FreeBSD Host
Target is Localhost, XAMPP MySQL 5.0.21

Table structure:
DROP TABLE IF EXISTS `qreport`;
CREATE TABLE `qreport` (
`id` mediumint(9) NOT NULL auto_increment,
`klt_id` mediumint(9) default NULL,
`next_id` mediumint(9) default NULL,
`omschrijving` varchar(80) NOT NULL default '',
`sqlstatement` text NOT NULL,
`orientatie` enum('V','H') NOT NULL default 'V',
`breaklevel` int(1) default '0',
`dlm_date` date default NULL,
`SubReport` enum('N','Y') default 'N',
`contexttype` char(3) default NULL,
`leeg_ok` enum('N','Y') NOT NULL default 'N',
`admin` char(1) default '',
`documentatie` text,
`pagebreak` enum('N','Y') NOT NULL default 'N',
PRIMARY KEY  (`id`),
KEY `fk_qrt_klt_id` (`klt_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;


Source table 54 records, SubReport has 15 checked
Target has 54 record, SubReport all rows are unchecked
The same goes for 'leeg_ok'

Bug or no Bug?
Or is this a MySql version problem?
Biggest pronlem is of course: if I cannot trust Export Tables..............

Walter
ansgar's profile image ansgar posted 17 years ago Permalink
I will look immediately after this bug. Release RC4 will be out shortly and should include a fix for that.
[expired user #589]'s profile image [expired user #589] posted 17 years ago Permalink
Immediate is a good word and appreciated.
Have also seen postponing of RC4 with a month.

Export/Import is critical

Walter, an understanding developer
:wink:
[expired user #589]'s profile image [expired user #589] posted 17 years ago Permalink
UPDATE:

If the source table contains an ENUM('A','D','G') or even Male Female
the export functions OK!
[expired user #589]'s profile image [expired user #589] posted 17 years ago Permalink
UPDATE #2

If dump made through PhPMyAdmin is imported through SQL
Data is imported correctly.

Walter

Please login to leave a reply, or register at first.