1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/ext/pdo_mysql/tests/gh20122.phpt
Niels Dossche 94284df7b2 Fix GH-20122: getColumnMeta() for JSON-column in MySQL
While at it, also add VECTOR.

Closes GH-20143.
2025-10-16 22:55:17 +02:00

34 lines
754 B
PHP

--TEST--
GH-20122 (getColumnMeta() for JSON-column in MySQL)
--EXTENSIONS--
pdo
pdo_mysql
--SKIPIF--
<?php
require __DIR__ . '/config.inc';
require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
PDOTest::skip();
?>
--FILE--
<?php
require __DIR__ . '/config.inc';
require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
$db = PDOTest::test_factory(__DIR__ . '/common.phpt');
$db->exec('CREATE TABLE test (bar JSON)');
$db->exec('INSERT INTO test VALUES("[]")');
$stmt = $db->query('SELECT * from test');
$meta = $stmt->getColumnMeta(0);
// Note: JSON is an alias for LONGTEXT on MariaDB!
echo $meta['native_type'], "\n";
?>
--CLEAN--
<?php
require __DIR__ . '/mysql_pdo_test.inc';
MySQLPDOTest::dropTestTable();
?>
--EXPECTF--
%r(JSON|LONGTEXT)%r