Last active
October 7, 2020 15:51
-
-
Save crevillo/bd7b75d4a809a7edeb9c to your computer and use it in GitHub Desktop.
Revisions
-
crevillo renamed this gist
Sep 10, 2014 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
crevillo renamed this gist
Sep 10, 2014 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
crevillo revised this gist
Sep 10, 2014 . 1 changed file with 0 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -25,11 +25,6 @@ $dbh->query( "DROP DATABASE newdb" ); /** without MYSQL_ATTR_FOUND_ROWS" **/ $dbh = new PDO("mysql:host=$host", $root, $root_password); -
crevillo created this gist
Sep 10, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,51 @@ <?php $host="localhost"; $root="root"; $root_password="***************"; $dbh = new PDO("mysql:host=$host", $root, $root_password); $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $dbh->setAttribute(PDO::MYSQL_ATTR_FOUND_ROWS, TRUE); $dbh->query("CREATE DATABASE IF NOT EXISTS `newdb`"); $dbh->query("use newdb"); $dbh->query("CREATE TABLE IF NOT EXISTS tabla (id INT PRIMARY KEY, value INT)"); $statement = $dbh->prepare("INSERT ignore INTO tabla VALUES ( 1, 10 )"); $statement->execute(); $statement = $dbh->prepare("UPDATE tabla SET value = 20 where id = 1"); $statement->execute(); print "rowCount For First update: " . $statement->rowCount() . "\n"; $statement = $dbh->prepare("UPDATE tabla SET value = 20 where id = 1"); $statement->execute(); print "rowCount For First update: " . $statement->rowCount() . "\n"; $dbh->query( "DROP DATABASE newdb" ); $host="localhost"; $root="root"; $root_password="2048"; /** without MYSQL_ATTR_FOUND_ROWS" **/ $dbh = new PDO("mysql:host=$host", $root, $root_password); $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $dbh->query("CREATE DATABASE IF NOT EXISTS `newdb`"); $dbh->query("use newdb"); $dbh->query("CREATE TABLE IF NOT EXISTS tabla (id INT PRIMARY KEY, value INT)"); $statement = $dbh->prepare("INSERT ignore INTO tabla VALUES ( 1, 10 )"); $statement->execute(); $statement = $dbh->prepare("UPDATE tabla SET value = 20 where id = 1"); $statement->execute(); print "rowCount For First update: " . $statement->rowCount() . "\n"; $statement = $dbh->prepare("UPDATE tabla SET value = 20 where id = 1"); $statement->execute(); print "rowCount For First update: " . $statement->rowCount() . "\n"; $dbh->query( "DROP DATABASE newdb" );