PHP  
 PHP_5_6
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

Test Failure Report for ext/pdo_odbc/tests/max_columns.phpt ('PDO ODBC varying character with max/no length')

Script

1: <?php
2:
require 'ext/pdo/tests/pdo_test.inc';
3:
$db PDOTest::test_factory('ext/pdo_odbc/tests/common.phpt');
4:
$db->setAttribute(PDO::ATTR_ERRMODEPDO::ERRMODE_SILENT);
5:
6: if (
false === $db->exec('CREATE TABLE TEST (id INT NOT NULL PRIMARY KEY, data varchar(max))')) {
7:     if (
false === $db->exec('CREATE TABLE TEST (id INT NOT NULL PRIMARY KEY, data longtext)')) {
8:         if (
false === $db->exec('CREATE TABLE TEST (id INT NOT NULL PRIMARY KEY, data CLOB)')) {
9:             die(
"BORK: don't know how to create a long column here:\n" implode(", "$db->errorInfo()));
10:         }
11:     }
12: }
13:
14:
$db->setAttribute(PDO::ATTR_ERRMODEPDO::ERRMODE_EXCEPTION);
15:
16:
$sizes = array(326412825325425525625725851210242048399839994000);
17:
18:
$db->beginTransaction();
19:
$insert $db->prepare('INSERT INTO TEST VALUES (?, ?)');
20: foreach (
$sizes as $num) {
21:     
$insert->execute(array($numstr_repeat('i'$num)));
22: }
23:
$insert null;
24:
$db->commit();
25:
26: foreach (
$db->query('SELECT id, data from TEST') as $row) {
27:     
$expect str_repeat('i'$row[0]);
28:     if (
strcmp($expect$row[1])) {
29:         echo 
"Failed on size $row[id]:\n";
30:         
printf("Expected %d bytes, got %d\n"strlen($expect), strlen($row['data']));
31:         echo 
bin2hex($expect) . "\n";
32:         echo 
bin2hex($row['data']) . "\n";
33:     }
34: }
35:
36: echo 
"Finished\n";
37:
38:

Expected

Finished

Output

BORK: don't know how to create a long column here:
42000, 1064, [MySQL][ODBC 5.1 Driver][mysqld-5.1.73]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CLOB)' at line 1 (SQLExecDirect[1064] at /var/php_gcov/PHP_5_6/ext/pdo_odbc/odbc_driver.c:247), 42000

Diff

001+ BORK: don't know how to create a long column here:
001- Finished
002+ 42000, 1064, [MySQL][ODBC 5.1 Driver][mysqld-5.1.73]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CLOB)' at line 1 (SQLExecDirect[1064] at /var/php_gcov/PHP_5_6/ext/pdo_odbc/odbc_driver.c:247), 42000

 

Generated at Mon, 27 Nov 2017 05:04:32 +0000 (13 days ago)

Copyright © 2005-2017 The PHP Group
All rights reserved.