@@ -83,7 +83,7 @@ public function formatDateInterval(\DateInterval $value): string
8383
8484 public function formatLike (string $ value , int $ pos ): string
8585 {
86- $ value = addcslashes (substr ($ this ->connection ->quote ($ value ), 1 , -1 ), '%_ \\' );
86+ $ value = addcslashes (substr ($ this ->pdo ->quote ($ value ), 1 , -1 ), '%_ \\' );
8787 return ($ pos <= 0 ? "'% " : "' " ) . $ value . ($ pos >= 0 ? "%' " : "' " ) . " ESCAPE ' \\' " ;
8888 }
8989
@@ -106,15 +106,15 @@ public function applyLimit(string &$sql, ?int $limit, ?int $offset): void
106106 public function getTables (): array
107107 {
108108 $ tables = [];
109- foreach ($ this ->connection ->query ("
109+ foreach ($ this ->pdo ->query ("
110110 SELECT name, type = 'view' as view FROM sqlite_master WHERE type IN ('table', 'view') AND name NOT LIKE 'sqlite_%'
111111 UNION ALL
112112 SELECT name, type = 'view' as view FROM sqlite_temp_master WHERE type IN ('table', 'view') AND name NOT LIKE 'sqlite_%'
113113 ORDER BY name
114114 " ) as $ row ) {
115115 $ tables [] = [
116- 'name ' => $ row-> name ,
117- 'view ' => (bool ) $ row-> view ,
116+ 'name ' => $ row[ ' name ' ] ,
117+ 'view ' => (bool ) $ row[ ' view ' ] ,
118118 ];
119119 }
120120
@@ -124,14 +124,14 @@ public function getTables(): array
124124
125125 public function getColumns (string $ table ): array
126126 {
127- $ meta = $ this ->connection ->query ("
128- SELECT sql FROM sqlite_master WHERE type = 'table' AND name = {$ this ->connection ->quote ($ table )}
127+ $ meta = $ this ->pdo ->query ("
128+ SELECT sql FROM sqlite_master WHERE type = 'table' AND name = {$ this ->pdo ->quote ($ table )}
129129 UNION ALL
130- SELECT sql FROM sqlite_temp_master WHERE type = 'table' AND name = {$ this ->connection ->quote ($ table )}
130+ SELECT sql FROM sqlite_temp_master WHERE type = 'table' AND name = {$ this ->pdo ->quote ($ table )}
131131 " )->fetch ();
132132
133133 $ columns = [];
134- foreach ($ this ->connection ->query ("PRAGMA table_info( {$ this ->delimite ($ table )}) " ) as $ row ) {
134+ foreach ($ this ->pdo ->query ("PRAGMA table_info( {$ this ->delimite ($ table )}) " ) as $ row ) {
135135 $ column = $ row ['name ' ];
136136 $ pattern = "/( \"$ column \"|` $ column`| \\[ $ column \\]| $ column) \\s+[^,]+ \\s+PRIMARY \\s+KEY \\s+AUTOINCREMENT/Ui " ;
137137 $ type = explode ('( ' , $ row ['type ' ]);
@@ -140,11 +140,11 @@ public function getColumns(string $table): array
140140 'table ' => $ table ,
141141 'nativetype ' => strtoupper ($ type [0 ]),
142142 'size ' => isset ($ type [1 ]) ? (int ) $ type [1 ] : null ,
143- 'nullable ' => $ row ['notnull ' ] === 0 ,
143+ 'nullable ' => ! $ row ['notnull ' ],
144144 'default ' => $ row ['dflt_value ' ],
145145 'autoincrement ' => $ meta && preg_match ($ pattern , (string ) $ meta ['sql ' ]),
146146 'primary ' => $ row ['pk ' ] > 0 ,
147- 'vendor ' => ( array ) $ row ,
147+ 'vendor ' => $ row ,
148148 ];
149149 }
150150 return $ columns ;
@@ -154,14 +154,14 @@ public function getColumns(string $table): array
154154 public function getIndexes (string $ table ): array
155155 {
156156 $ indexes = [];
157- foreach ($ this ->connection ->query ("PRAGMA index_list( {$ this ->delimite ($ table )}) " ) as $ row ) {
157+ foreach ($ this ->pdo ->query ("PRAGMA index_list( {$ this ->delimite ($ table )}) " ) as $ row ) {
158158 $ indexes [$ row ['name ' ]]['name ' ] = $ row ['name ' ];
159159 $ indexes [$ row ['name ' ]]['unique ' ] = (bool ) $ row ['unique ' ];
160160 $ indexes [$ row ['name ' ]]['primary ' ] = false ;
161161 }
162162
163163 foreach ($ indexes as $ index => $ values ) {
164- $ res = $ this ->connection ->query ("PRAGMA index_info( {$ this ->delimite ($ index )}) " );
164+ $ res = $ this ->pdo ->query ("PRAGMA index_info( {$ this ->delimite ($ index )}) " );
165165 while ($ row = $ res ->fetch ()) {
166166 $ indexes [$ index ]['columns ' ][$ row ['seqno ' ]] = $ row ['name ' ];
167167 }
@@ -198,7 +198,7 @@ public function getIndexes(string $table): array
198198 public function getForeignKeys (string $ table ): array
199199 {
200200 $ keys = [];
201- foreach ($ this ->connection ->query ("PRAGMA foreign_key_list( {$ this ->delimite ($ table )}) " ) as $ row ) {
201+ foreach ($ this ->pdo ->query ("PRAGMA foreign_key_list( {$ this ->delimite ($ table )}) " ) as $ row ) {
202202 $ keys [$ row ['id ' ]]['name ' ] = $ row ['id ' ]; // foreign key name
203203 $ keys [$ row ['id ' ]]['local ' ] = $ row ['from ' ]; // local columns
204204 $ keys [$ row ['id ' ]]['table ' ] = $ row ['table ' ]; // referenced table
0 commit comments