@@ -57,16 +57,14 @@ function wp_get_db_schema() {
57
57
public function setUp (): void {
58
58
$ this ->sqlite = new PDO ( 'sqlite::memory: ' );
59
59
$ this ->engine = new WP_SQLite_Driver (
60
- array (
61
- 'connection ' => $ this ->sqlite ,
62
- 'database ' => 'wp ' ,
63
- )
60
+ new WP_SQLite_Connection ( array ( 'pdo ' => $ this ->sqlite ) ),
61
+ 'wp '
64
62
);
65
63
66
64
$ builder = new WP_SQLite_Information_Schema_Builder (
67
65
'wp ' ,
68
66
WP_SQLite_Driver::RESERVED_PREFIX ,
69
- array ( $ this ->engine , ' execute_sqlite_query ' )
67
+ $ this ->engine -> get_connection ( )
70
68
);
71
69
72
70
$ this ->reconstructor = new WP_SQLite_Information_Schema_Reconstructor (
@@ -76,7 +74,7 @@ public function setUp(): void {
76
74
}
77
75
78
76
public function testReconstructTable (): void {
79
- $ this ->engine ->get_pdo ()->exec (
77
+ $ this ->engine ->get_connection ()->query (
80
78
'
81
79
CREATE TABLE t (
82
80
id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -90,8 +88,8 @@ public function testReconstructTable(): void {
90
88
)
91
89
'
92
90
);
93
- $ this ->engine ->get_pdo ()->exec ( 'CREATE INDEX idx_score ON t (score) ' );
94
- $ this ->engine ->get_pdo ()->exec ( 'CREATE INDEX idx_role_score ON t (role, priority) ' );
91
+ $ this ->engine ->get_connection ()->query ( 'CREATE INDEX idx_score ON t (score) ' );
92
+ $ this ->engine ->get_connection ()->query ( 'CREATE INDEX idx_role_score ON t (role, priority) ' );
95
93
$ result = $ this ->assertQuery ( 'SELECT * FROM information_schema.tables WHERE table_name = "t" ' );
96
94
$ this ->assertEquals ( 0 , count ( $ result ) );
97
95
@@ -126,7 +124,7 @@ public function testReconstructTable(): void {
126
124
127
125
public function testReconstructWpTable (): void {
128
126
// Create a WP table with any columns.
129
- $ this ->engine ->get_pdo ()->exec ( 'CREATE TABLE wp_posts ( id INTEGER ) ' );
127
+ $ this ->engine ->get_connection ()->query ( 'CREATE TABLE wp_posts ( id INTEGER ) ' );
130
128
131
129
// Reconstruct the information schema.
132
130
$ this ->reconstructor ->ensure_correct_information_schema ();
@@ -176,18 +174,18 @@ public function testReconstructWpTable(): void {
176
174
}
177
175
178
176
public function testReconstructTableFromMysqlDataTypesCache (): void {
179
- $ pdo = $ this ->engine ->get_pdo ();
177
+ $ connection = $ this ->engine ->get_connection ();
180
178
181
- $ pdo -> exec ( self ::CREATE_DATA_TYPES_CACHE_TABLE_SQL );
182
- $ pdo -> exec ( "INSERT INTO _mysql_data_types_cache (`table`, column_or_index, mysql_type) VALUES ('t', 'id', 'int unsigned') " );
183
- $ pdo -> exec ( "INSERT INTO _mysql_data_types_cache (`table`, column_or_index, mysql_type) VALUES ('t', 'name', 'varchar(255)') " );
184
- $ pdo -> exec ( "INSERT INTO _mysql_data_types_cache (`table`, column_or_index, mysql_type) VALUES ('t', 'description', 'text') " );
185
- $ pdo -> exec ( "INSERT INTO _mysql_data_types_cache (`table`, column_or_index, mysql_type) VALUES ('t', 'shape', 'geomcollection') " );
186
- $ pdo -> exec ( "INSERT INTO _mysql_data_types_cache (`table`, column_or_index, mysql_type) VALUES ('t', 't__idx_name', 'KEY') " );
187
- $ pdo -> exec ( "INSERT INTO _mysql_data_types_cache (`table`, column_or_index, mysql_type) VALUES ('t', 't__idx_description', 'FULLTEXT') " );
188
- $ pdo -> exec ( "INSERT INTO _mysql_data_types_cache (`table`, column_or_index, mysql_type) VALUES ('t', 't__idx_shape', 'SPATIAL') " );
179
+ $ connection -> query ( self ::CREATE_DATA_TYPES_CACHE_TABLE_SQL );
180
+ $ connection -> query ( "INSERT INTO _mysql_data_types_cache (`table`, column_or_index, mysql_type) VALUES ('t', 'id', 'int unsigned') " );
181
+ $ connection -> query ( "INSERT INTO _mysql_data_types_cache (`table`, column_or_index, mysql_type) VALUES ('t', 'name', 'varchar(255)') " );
182
+ $ connection -> query ( "INSERT INTO _mysql_data_types_cache (`table`, column_or_index, mysql_type) VALUES ('t', 'description', 'text') " );
183
+ $ connection -> query ( "INSERT INTO _mysql_data_types_cache (`table`, column_or_index, mysql_type) VALUES ('t', 'shape', 'geomcollection') " );
184
+ $ connection -> query ( "INSERT INTO _mysql_data_types_cache (`table`, column_or_index, mysql_type) VALUES ('t', 't__idx_name', 'KEY') " );
185
+ $ connection -> query ( "INSERT INTO _mysql_data_types_cache (`table`, column_or_index, mysql_type) VALUES ('t', 't__idx_description', 'FULLTEXT') " );
186
+ $ connection -> query ( "INSERT INTO _mysql_data_types_cache (`table`, column_or_index, mysql_type) VALUES ('t', 't__idx_shape', 'SPATIAL') " );
189
187
190
- $ this -> engine -> get_pdo ()-> exec (
188
+ $ connection -> query (
191
189
'
192
190
CREATE TABLE t (
193
191
id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -197,9 +195,9 @@ public function testReconstructTableFromMysqlDataTypesCache(): void {
197
195
)
198
196
'
199
197
);
200
- $ this -> engine -> get_pdo ()-> exec ( 'CREATE INDEX t__idx_name ON t (name) ' );
201
- $ this -> engine -> get_pdo ()-> exec ( 'CREATE INDEX t__idx_description ON t (description) ' );
202
- $ this -> engine -> get_pdo ()-> exec ( 'CREATE INDEX t__idx_shape ON t (shape) ' );
198
+ $ connection -> query ( 'CREATE INDEX t__idx_name ON t (name) ' );
199
+ $ connection -> query ( 'CREATE INDEX t__idx_description ON t (description) ' );
200
+ $ connection -> query ( 'CREATE INDEX t__idx_shape ON t (shape) ' );
203
201
204
202
$ this ->reconstructor ->ensure_correct_information_schema ();
205
203
$ result = $ this ->assertQuery ( 'SHOW CREATE TABLE t ' );
@@ -224,7 +222,7 @@ public function testReconstructTableFromMysqlDataTypesCache(): void {
224
222
}
225
223
226
224
public function testDefaultValues (): void {
227
- $ this ->engine ->get_pdo ()->exec (
225
+ $ this ->engine ->get_connection ()->query (
228
226
"
229
227
CREATE TABLE t (
230
228
col1 text DEFAULT abc,
0 commit comments