List:Commits« Previous MessageNext Message »
From:uwendel Date:April 4 2008 3:56pm
Subject:PHP mysqlnd svn commit: r1395 - trunk/tests/ext/pdo_mysql
View as plain text  
Author: uwendel
Date: 2008-04-04 17:56:45 +0200 (Fri, 04 Apr 2008)
New Revision: 1395

Added:
   trunk/tests/ext/pdo_mysql/pdo_mysql_mantis_370.phpt
Log:
lastInsertId() seems to return wrong results


Added: trunk/tests/ext/pdo_mysql/pdo_mysql_mantis_370.phpt
===================================================================
--- trunk/tests/ext/pdo_mysql/pdo_mysql_mantis_370.phpt	                        (rev 0)
+++ trunk/tests/ext/pdo_mysql/pdo_mysql_mantis_370.phpt	2008-04-04 15:56:45 UTC (rev 1395)
@@ -0,0 +1,35 @@
+--TEST--
+Mantis #365 (Wrong SQLSTATE - II) - remove test after fix!
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+require_once('mysql_pdo_test.inc');
+MySQLPDOTest::skip();
+$db = MySQLPDOTest::factory();
+?>
+--FILE--
+<?php
+	require_once('mysql_pdo_test.inc');
+
+	$db = MySQLPDOTest::factory();
+
+	$db->exec('DROP TABLE IF EXISTS test');
+	$db->exec(sprintf('CREATE TABLE test(id INT AUTO_INCREMENT PRIMARY KEY, col1
CHAR(10)) ENGINE=%s', PDO_MYSQL_TEST_ENGINE));
+
+	$db->exec('INSERT INTO test(id, col1) VALUES (100, "a")');
+	var_dump($db->lastInsertId());
+
+	$db->exec('INSERT INTO test(id, col1) VALUES (100, "a")');
+	var_dump($db->lastInsertId());
+
+	$db->exec('INSERT INTO test(id, col1) VALUES (101, "b")');
+	var_dump($db->lastInsertId());
+
+	print "done!";
+--EXPECTF--
+string(3) "100"
+
+Warning: PDO::exec(): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate
entry '100' for key 'PRIMARY' in %s on line %d
+string(3) "100"
+string(3) "101"
+done!
\ No newline at end of file

Thread
PHP mysqlnd svn commit: r1395 - trunk/tests/ext/pdo_mysqluwendel4 Apr