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
34
34
restore_error_handler ();
35
35
}
36
36
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
+
37
61
/**
38
62
* Test lost connection re-initializing
39
63
*
Original file line number Diff line number Diff line change @@ -420,6 +420,10 @@ protected function _connect()
420
420
$ this ->_config ['driver_options ' ][\PDO ::MYSQL_ATTR_MULTI_STATEMENTS ] = false ;
421
421
}
422
422
423
+ if (!isset ($ this ->_config ['driver_options ' ][\PDO ::ATTR_STRINGIFY_FETCHES ])) {
424
+ $ this ->_config ['driver_options ' ][\PDO ::ATTR_STRINGIFY_FETCHES ] = true ;
425
+ }
426
+
423
427
$ this ->logger ->startTimer ();
424
428
parent ::_connect ();
425
429
$ this ->logger ->logStats (LoggerInterface::TYPE_CONNECT , '' );
You can’t perform that action at this time.
0 commit comments