alzalabany / sql-buddy

Automatically exported from code.google.com/p/sql-buddy
MIT License
0 stars 0 forks source link

NULL values cannot be inserted #9

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In the following table there is no way to insert a row with user_id=null. A
checkbox is needed to signify a NULL value.

CREATE TABLE IF NOT EXISTS `test` (
  `id` int(11) NOT NULL auto_increment,
  `user_id` int(11) default NULL,
  `url` varchar(500) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;

Original issue reported on code.google.com by dare...@gmail.com on 30 Aug 2008 at 9:20

GoogleCodeExporter commented 9 years ago
I found a way to fix this issue without adding an extra checkbox. I changed the 
code so that when the textbox is 
left empty and the column has the NULL attribute, a null value is automatically 
inserted. If the textbox is empty 
and the column has a NOT NULL attribute, an empty string is inserted instead. I 
think this is a good solution.

Original comment by calvinlo...@gmail.com on 9 Sep 2008 at 9:23