Description:
A insert statement that gives to warning when using mysql prompt in Unix.
Gives only one when using JDBC.
How to repeat:
Create table:
CREATE TABLE `organizationaddress` (
`bookid` int(11) NOT NULL default '0',
`organizationnr` int(11) NOT NULL default '0',
`type` char(1) collate utf8_bin NOT NULL default '',
`streetname` varchar(24) collate utf8_bin NOT NULL default '',
`streetnr` int(11) NOT NULL default '0',
`streetnrext` varchar(4) collate utf8_bin NOT NULL default '',
`zipcode` varchar(6) collate utf8_bin NOT NULL default '',
`city` varchar(24) collate utf8_bin NOT NULL default '',
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin ;
Test following statement, once using mysql command:
Suggested fix:
insert into organizationaddress (bookid, organizationnr, type, streetname, streetnr, streetnrext, zipcode, city) values (3, -1, 'Pxx', 'xxxxxxxxxxxxxxxxxxxxxxx', 6999999900019, '', '', '');
show warnings;
--> 2 warnings
When using JDBC it gives only 1 warning (drop and recreate table first):
try {
st = conn.createStatement();
rows = st.executeUpdate(statement);
} catch (SQLWarning e) {
SQLWarning warning = st.getWarnings();
while (warning != null) {
System.out.println("Warning: " +warning);
warning = warning.getNextWarning();
}