Re: MyISAM & InnoDB buffering
SHOW CREATE TABLE sampledb.test;
Gives >
| test | CREATE TABLE `test` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`first_name` varchar(50) NOT NULL,
`last_name` varchar(50) NOT NULL,
`age` int(3) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
The Insert is a little more difficult. I have installed the pdowrapper and pdohelper from the PDO_Class_Wrapper-master on GitHub.
The insert_demo.php is what I am trying, it ran success fully after I had corrected the mistakes? in the source. I then tried it again after dropping the table and re-creating it when it started creating duplicate entries.
The insert runs
<?php
//300 seconds = 5 minutes execution time
ini_set('max_execution_time', 300);
// overrides the default PHP memory limit.
ini_set('memory_limit', '-1');
// include pdo helper class to use common methods
include_once 'class/class.pdohelper.php';
// include pdo class wrapper
include_once 'class/class.pdowrapper.php';
// database connection setings
$dbConfig = array("host"=>"localhost", "dbname"=>'sampledb', "username"=>'root', "password"=>'');
// get instance of PDO Wrapper object
$db = new PdoWrapper($dbConfig);
// get instance of PDO Helper object
$helper = new PDOHelper();
// set error log mode true to show error on screen or false to log in log file
$db->setErrorLog(true);
// Example -1
$dataArray = array('first_name'=>'Sid','last_name'=>'Mike','age'=>45);
// use insert function
$q = $db->insert('test3',$dataArray)->showQuery()->getLastInsertId();
$helper->PA($q);
// Example -2
$dataArray = array('first_name'=>'Scott','last_name'=>'Dimon','age'=>55);
// use insert function
$q = $db->insert('test3',$dataArray)->showQuery()->getLastInsertId();
$helper->PA($q);
the remaining parts of the insert_demo.php I had commented out.