I have understood that there was no problem to use DBI with InnoDB tables, but I still have a problem :
I used to have MyISAM tables where everything was working fine, and I created a whole new set of InnoDB tables.
When I call Inserts on these new tables, it does NOT insert my values, and DBI::execute is not returning any error, still the 'auto_increment'... increments (on table status).
Table is :
______________________________
CREATE TABLE `log` (
`id` int(11) NOT NULL auto_increment,
`timestamp` datetime NOT NULL default '0000-00-00 00:00:00',
`alert` enum('y','n') NOT NULL default 'y',
`id_daemon` int(11) NOT NULL default '0',
`id_event_type` int(11) NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `id_daemon` (`id_daemon`),
KEY `id_event_type` (`id_event_type`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;
___________________________________
Foreign keys :
ALTER TABLE `log`
ADD CONSTRAINT `log_ibfk_1` FOREIGN KEY (`id_daemon`) REFERENCES `daemons` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `log_ibfk_2` FOREIGN KEY (`id_event_type`) REFERENCES `event_types` (`id`) ON DELETE CASCADE;
___________________________________
Code :
$req = "INSERT INTO log
(`timestamp`,`alert`,`id_daemon`,`id_event_type`)
VALUES
(NOW(),'y','31','3')";
$query = $dbh->prepare($req);
$query->execute or sayAll("Query failed : $req".$query->errstr);
When I paste the request into 'mysql' in command line, or by phpMyAdmin... it works... but not with DBI.
Can anybody bring me help ?
| [reply] |