I have understood from an other post 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 ;
___________________________________
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 Insert request into 'mysql' in command line, or by phpMyAdmin... it works... but not with DBI.
Can anybody bring me help ?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.