cvs: php-src /ext/mysqli/tests table.inc
| From: | Ulf Wendel | Date: | Thu, 12 Jul 2007 20:10:24 +0000 |
| Subject: | cvs: php-src /ext/mysqli/tests table.inc | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-45316@lists.php.net to get a copy of this message | ||
uw Thu Jul 12 20:10:24 2007 UTC
Added files:
/php-src/ext/mysqli/tests table.inc
Log:
Some of the upcoming new tests will use this little helper to create a
very simple MySQL table with some data in it to play with.
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/table.inc?view=markup&rev=1.1
Index: php-src/ext/mysqli/tests/table.inc
+++ php-src/ext/mysqli/tests/table.inc
<?PHP
require_once('connect.inc');
if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s,
port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
exit(1);
}
if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
exit(1);
}
if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id))
ENGINE=' . $engine)) {
printf("Failed to create test table: [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
exit(1);
}
if (!mysqli_query($link, 'INSERT INTO test(id, label) VALUES (1, "a"), (2,
"b"), (3, "c"), (4, "d"), (5, "e"), (6,
"f")')) {
printf("[%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
?>