File tree Expand file tree Collapse file tree 3 files changed +40
-0
lines changed Expand file tree Collapse file tree 3 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,7 @@ require_once 'skipifconnectfailure.inc';
9090 // MYSQLI_TYPE_GEOMETRY => array('GEOMETRY', 'TODO add testing'),
9191 MYSQLI_TYPE_NEWDECIMAL => array ('DECIMAL ' , '1.1 ' ),
9292 MYSQLI_TYPE_BIT => array ('BIT ' , 0 ),
93+ MYSQLI_TYPE_JSON => array ('JSON ' , '[] ' ),
9394 );
9495
9596 foreach ($ datatypes as $ php_type => $ datatype ) {
Original file line number Diff line number Diff line change @@ -746,6 +746,12 @@ static char *type_to_name_native(int type) /* {{{ */
746746 PDO_MYSQL_NATIVE_TYPE_NAME (DATE )
747747#ifdef FIELD_TYPE_NEWDATE
748748 PDO_MYSQL_NATIVE_TYPE_NAME (NEWDATE )
749+ #endif
750+ #ifdef FIELD_TYPE_VECTOR
751+ PDO_MYSQL_NATIVE_TYPE_NAME (VECTOR )
752+ #endif
753+ #ifdef FIELD_TYPE_JSON
754+ PDO_MYSQL_NATIVE_TYPE_NAME (JSON )
749755#endif
750756 PDO_MYSQL_NATIVE_TYPE_NAME (TIME )
751757 PDO_MYSQL_NATIVE_TYPE_NAME (DATETIME )
Original file line number Diff line number Diff line change 1+ --TEST--
2+ GH-20122 (getColumnMeta() for JSON-column in MySQL)
3+ --EXTENSIONS--
4+ pdo
5+ pdo_mysql
6+ --SKIPIF--
7+ <?php
8+ require __DIR__ . '/config.inc ' ;
9+ require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc ' ;
10+ PDOTest::skip ();
11+ ?>
12+ --FILE--
13+ <?php
14+ require __DIR__ . '/config.inc ' ;
15+ require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc ' ;
16+ $ db = PDOTest::test_factory (__DIR__ . '/common.phpt ' );
17+
18+ $ db ->exec ('CREATE TABLE test (bar JSON) ' );
19+ $ db ->exec ('INSERT INTO test VALUES("[]") ' );
20+
21+ $ stmt = $ db ->query ('SELECT * from test ' );
22+ $ meta = $ stmt ->getColumnMeta (0 );
23+
24+ // Note: JSON is an alias for LONGTEXT on MariaDB!
25+ echo $ meta ['native_type ' ], "\n" ;
26+ ?>
27+ --CLEAN--
28+ <?php
29+ require __DIR__ . '/mysql_pdo_test.inc ' ;
30+ MySQLPDOTest::dropTestTable ();
31+ ?>
32+ --EXPECTF--
33+ %r(JSON|LONGTEXT)%r
You can’t perform that action at this time.
0 commit comments