Skip to content

Commit 0775b99

Browse files
committed
Fix mysqli_fetch_field_types.phpt
1 parent c290996 commit 0775b99

File tree

1 file changed

+13
-20
lines changed

1 file changed

+13
-20
lines changed

ext/mysqli/tests/mysqli_fetch_field_types.phpt

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ require_once 'skipifconnectfailure.inc';
3030
$sql = sprintf("INSERT INTO test(id) VALUES (%s)", $php_value);
3131

3232
if (!mysqli_query($link, $sql)) {
33-
printf("[003] '%s' - '%s' - '%s', [%d] %s\n", $sql_type, $create, $sql,
33+
printf("[003] '%s' - '%s', [%d] %s\n", $sql_type, $sql,
3434
mysqli_errno($link), mysqli_error($link));
3535
return false;
3636
}
@@ -67,7 +67,7 @@ require_once 'skipifconnectfailure.inc';
6767
$datatypes = array(
6868
MYSQLI_TYPE_TINY => array('TINYINT', 5),
6969
MYSQLI_TYPE_SHORT => array('SMALLINT', 10),
70-
MYSQLI_TYPE_LONG => 'MYSQLI_TYPE_LONG - TODO add testing',
70+
MYSQLI_TYPE_LONG => array('INT', 15),
7171
MYSQLI_TYPE_FLOAT => array('FLOAT', '1.3'),
7272
MYSQLI_TYPE_DOUBLE => array('DOUBLE', '1.4'),
7373
MYSQLI_TYPE_TIMESTAMP => array('TIMESTAMP', '2007-08-20 18:34:00'),
@@ -77,30 +77,23 @@ require_once 'skipifconnectfailure.inc';
7777
MYSQLI_TYPE_TIME => array('TIME', '18:41:38'),
7878
MYSQLI_TYPE_DATETIME => array('DATETIME', '2007-08-20 18:42:01'),
7979
MYSQLI_TYPE_YEAR => array('YEAR', '2007'),
80-
MYSQLI_TYPE_ENUM => array('ENUM("everything", "is", "just", "wonderful")', 'is'),
81-
// MYSQLI_TYPE_SET => array('SET("I", "smash", "the")', 'I,smash,the'), - string
82-
// MYSQLI_TYPE_TINY_BLOB => array("TINYBLOB", "I got a tiny blog"), - blob
83-
// MYSQLI_TYPE_MEDIUM_BLOB => array("MEDIUMBLOB", "No blob for masses"), - blob
84-
// MYSQLI_TYPE_LONG_BLOB => array("LONGBLOB", "Small is beautiful?"), - blob
85-
MYSQLI_TYPE_BLOB => array("LONGBLOB", 'MySQL does not report proper type. Use Length to distinct BLOB types'),
86-
MYSQLI_TYPE_BLOB => array("MEDIUMBLOB", 'MySQL does not report proper type. Use Length to distinct BLOB types'),
87-
MYSQLI_TYPE_BLOB => array("TINYBLOB", 'MySQL does not report proper type. Use Length to distinct BLOB types'),
80+
// MYSQLI_TYPE_ENUM => array('ENUM("everything", "is", "just", "wonderful")', 'is'), // We cannot test ENUM because every ENUM value is just a plain string => MYSQLI_TYPE_STRING
81+
// MYSQLI_TYPE_SET => array('SET("I", "smash", "the")', 'I,smash,the'), // We cannot test SET because every SET value is just a plain string => MYSQLI_TYPE_STRING
82+
// MYSQLI_TYPE_BLOB => array("LONGBLOB", 'MySQL does not report proper type. Use Length to distinct BLOB types'),
83+
// MYSQLI_TYPE_BLOB => array("MEDIUMBLOB", 'MySQL does not report proper type. Use Length to distinct BLOB types'),
84+
// MYSQLI_TYPE_BLOB => array("TINYBLOB", 'MySQL does not report proper type. Use Length to distinct BLOB types'),
8885
MYSQLI_TYPE_BLOB => array("BLOB", 'silly'),
8986
MYSQLI_TYPE_VAR_STRING => array("VARCHAR(32768)", 'varchar'),
90-
MYSQLI_TYPE_STRING => 'MYSQLI_TYPE_STRING - TODO add testing',
9187
MYSQLI_TYPE_STRING => array('CHAR(1)', 'a'),
92-
MYSQLI_TYPE_STRING => array("SET('I', 'smash', 'the')", 'smash'),
93-
MYSQLI_TYPE_NULL => 'MYSQLI_TYPE_NULL - TODO add testing',
94-
MYSQLI_TYPE_NEWDATE => 'MYSQLI_TYPE_NEWDATE - TODO add testing',
95-
MYSQLI_TYPE_GEOMETRY => 'MYSQLI_TYPE_GEOMETRY - TODO add testing',
88+
// MYSQLI_TYPE_NULL => array('CHAR(1) NULL', null), // We cannot test NULL because MySQL doesn't have standalone NULL type, only nullable types
89+
// MYSQLI_TYPE_NEWDATE => 'MYSQLI_TYPE_NEWDATE - TODO add testing', // This is an internal type, not a real MySQL type
90+
// MYSQLI_TYPE_GEOMETRY => array('GEOMETRY', 'TODO add testing'),
91+
MYSQLI_TYPE_NEWDECIMAL => array('DECIMAL', '1.1'),
92+
MYSQLI_TYPE_BIT => array('BIT', 0),
9693
);
9794

98-
$datatypes[MYSQLI_TYPE_NEWDECIMAL] = array('DECIMAL', '1.1');
99-
$datatypes[MYSQLI_TYPE_BIT] = array('BIT', 0);
100-
10195
foreach ($datatypes as $php_type => $datatype) {
102-
if (is_array($datatype))
103-
mysqli_field_datatypes($link, $datatype[0], $datatype[1], $php_type, $datatypes);
96+
mysqli_field_datatypes($link, $datatype[0], $datatype[1], $php_type, $datatypes);
10497
}
10598

10699
mysqli_close($link);

0 commit comments

Comments
 (0)