I am using Zeos lib to access and use MySQL tables. Now I want to create table myself. I can catch errors regarding CREATE TABLE command, but I can not get the success result.
For example if I use IF NOT EXISTS
I don't know the tables created or not.
DBQuery.SQL.Text:=
'CREATE TABLE IF NOT EXISTS `tbltest` ('+
' `ID` int(10) unsigned NOT NULL AUTO_INCREMENT,'+
' `Field` tinyint(3) unsigned DEFAULT NULL,'+
' PRIMARY KEY (`ID`),'+
') ENGINE=MyISAM DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED AUTO_INCREMENT=1;';
DBQuery.ExecSQL;
Q: How do I know that tables created successfully?
A warning is created when your create table statement runs. If the table is created no warning will be generated, if it already exists it will fire a warning. Check that after the query with:
SHOW WARNINGS;
Or you can use the following:
select @@warning_count;
See here for full info http://dev.mysql.com/doc/refman/5.7/en/show-warnings.html