File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed
dev/tests/integration/testsuite/Magento/Framework/DB/Adapter/Pdo
lib/internal/Magento/Framework/DB/Adapter/Pdo Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,30 @@ protected function tearDown(): void
3434 restore_error_handler ();
3535 }
3636
37+ /**
38+ * Check PDO stringify fetches options
39+ */
40+ public function testStringifyFetchesTrue (): void
41+ {
42+ $ tableName = $ this ->resourceConnection ->getTableName ('table_with_int_column ' );
43+ $ columnId = 'integer_column ' ;
44+ $ adapter = $ this ->getDbAdapter ();
45+
46+ $ table = $ adapter
47+ ->newTable ($ tableName )
48+ ->addColumn ($ columnId , Table::TYPE_INTEGER );
49+ $ adapter ->createTable ($ table );
50+ $ adapter ->insert ($ tableName , [$ columnId => 100 ]);
51+
52+ $ select = $ adapter ->select ()
53+ ->from ($ tableName )
54+ ->columns ([$ columnId ])
55+ ->limit (1 );
56+ $ result = $ adapter ->fetchOne ($ select );
57+ $ this ->assertIsString ($ result );
58+ $ adapter ->dropTable ($ tableName );
59+ }
60+
3761 /**
3862 * Test lost connection re-initializing
3963 *
Original file line number Diff line number Diff line change @@ -420,6 +420,10 @@ protected function _connect()
420420 $ this ->_config ['driver_options ' ][\PDO ::MYSQL_ATTR_MULTI_STATEMENTS ] = false ;
421421 }
422422
423+ if (!isset ($ this ->_config ['driver_options ' ][\PDO ::ATTR_STRINGIFY_FETCHES ])) {
424+ $ this ->_config ['driver_options ' ][\PDO ::ATTR_STRINGIFY_FETCHES ] = true ;
425+ }
426+
423427 $ this ->logger ->startTimer ();
424428 parent ::_connect ();
425429 $ this ->logger ->logStats (LoggerInterface::TYPE_CONNECT , '' );
You can’t perform that action at this time.
0 commit comments