@@ -94,8 +94,8 @@ public function __construct() {
9494 FROM
9595 "INFORMATION_SCHEMA"."COLUMNS"
9696 WHERE
97- "TABLE_SCHEMA " = ? AND
98- "TABLE_NAME " = ?
97+ "TABLE_NAME " = ? AND
98+ "TABLE_SCHEMA " = ?
9999 ORDER BY
100100 "ORDINAL_POSITION" '
101101 );
@@ -249,13 +249,15 @@ public function __construct() {
249249 from
250250 "information_schema"."tables"
251251 where
252+ "table_schema" = \'public \' and
252253 "table_catalog" = ? ' ,
253254 'reflect_table ' =>'select
254255 "table_name"
255256 from
256257 "information_schema"."tables"
257258 where
258259 "table_name" = ? and
260+ "table_schema" = \'public \' and
259261 "table_catalog" = ? ' ,
260262 'reflect_pk ' =>'select
261263 "column_name"
@@ -266,6 +268,7 @@ public function __construct() {
266268 tc."constraint_type" = \'PRIMARY KEY \' and
267269 tc."constraint_name" = ku."constraint_name" and
268270 ku."table_name" = ? and
271+ ku."table_schema" = \'public \' and
269272 ku."table_catalog" = ? ' ,
270273 'reflect_belongs_to ' =>'select
271274 cu1."table_name",cu1."column_name",
@@ -279,6 +282,8 @@ public function __construct() {
279282 cu2."constraint_name" = rc."unique_constraint_name" and
280283 cu1."table_name" = ? and
281284 cu2."table_name" in ? and
285+ cu1."table_schema" = \'public \' and
286+ cu2."table_schema" = \'public \' and
282287 cu1."table_catalog" = ? and
283288 cu2."table_catalog" = ? ' ,
284289 'reflect_has_many ' =>'select
@@ -293,6 +298,8 @@ public function __construct() {
293298 cu2."constraint_name" = rc."unique_constraint_name" and
294299 cu1."table_name" in ? and
295300 cu2."table_name" = ? and
301+ cu1."table_schema" = \'public \' and
302+ cu2."table_schema" = \'public \' and
296303 cu1."table_catalog" = ? and
297304 cu2."table_catalog" = ? ' ,
298305 'reflect_habtm ' =>'select
@@ -316,6 +323,10 @@ public function __construct() {
316323 cub1."table_catalog" = ? and
317324 cua2."table_catalog" = ? and
318325 cub2."table_catalog" = ? and
326+ cua1."table_schema" = \'public \' and
327+ cub1."table_schema" = \'public \' and
328+ cua2."table_schema" = \'public \' and
329+ cub2."table_schema" = \'public \' and
319330 cua1."table_name" = cub1."table_name" and
320331 cua2."table_name" = ? and
321332 cub2."table_name" in ? ' ,
@@ -324,7 +335,8 @@ public function __construct() {
324335 from
325336 "information_schema"."columns"
326337 where
327- "table_name" like ? and
338+ "table_name" = ? and
339+ "table_schema" = \'public \' and
328340 "table_catalog" = ?
329341 order by
330342 "ordinal_position" '
@@ -2248,7 +2260,7 @@ protected function swagger($settings) {
22482260 foreach ($ primaryKeys as $ primaryKey ) {
22492261 $ table_fields [$ table ['name ' ]][$ primaryKey ]->primaryKey = true ;
22502262 }
2251- $ result = $ this ->db ->query ($ this ->db ->getSql ('reflect_columns ' ),array ($ database , $ table_list [0 ]));
2263+ $ result = $ this ->db ->query ($ this ->db ->getSql ('reflect_columns ' ),array ($ table_list [0 ], $ database ));
22522264 while ($ row = $ this ->db ->fetchRow ($ result )) {
22532265 if ($ row [1 ]!==null ) $ table_fields [$ table ['name ' ]][$ row [0 ]]->default = $ row [1 ];
22542266 $ table_fields [$ table ['name ' ]][$ row [0 ]]->required = strtolower ($ row [2 ])=='no ' && $ row [1 ]===null ;
0 commit comments