MySQL Forums
Forum List  »  PHP

Re: MyISAM & InnoDB buffering
Posted by: Alan Cameron
Date: November 01, 2016 01:10PM

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.

Options: ReplyQuote


Subject
Written By
Posted
October 29, 2016 02:09PM
October 29, 2016 08:40PM
October 30, 2016 05:21PM
Re: MyISAM & InnoDB buffering
November 01, 2016 01:10PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.