Changeset 630 for trunk/lib/DB.inc.php
- Timestamp:
- Jun 8, 2018 3:41:16 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/DB.inc.php
r627 r630 78 78 79 79 // Caches. 80 protected $existing_tables;81 protected $table_columns;80 protected static $existing_tables = null; 81 protected static $table_columns = null; 82 82 83 83 /** … … 377 377 } 378 378 379 if ( !isset($this->existing_tables) || !$use_cached_results) {380 $this->existing_tables = array();379 if (is_null(self::$existing_tables) || !$use_cached_results) { 380 self::$existing_tables = array(); 381 381 $qid = $this->query("SHOW TABLES"); 382 382 while (list($row) = mysql_fetch_row($qid)) { 383 $this->existing_tables[] = $row;383 self::$existing_tables[] = $row; 384 384 } 385 385 } 386 if (in_array($table, $this->existing_tables)) { 386 387 if (in_array($table, self::$existing_tables)) { 387 388 return true; 388 389 } else { … … 421 422 } 422 423 423 if (!isset( $this->table_columns[$table]) || !$use_cached_results) {424 if (!isset(self::$table_columns[$table]) || !$use_cached_results) { 424 425 // Populate and cache array of current columns for this table. 425 $this->table_columns[$table] = array();426 self::$table_columns[$table] = array(); 426 427 $qid = $this->query("DESCRIBE $table"); 427 428 while ($row = mysql_fetch_row($qid)) { 428 $this->table_columns[$table][] = $row[0];429 self::$table_columns[$table][] = $row[0]; 429 430 } 430 431 } … … 433 434 // Do an exact comparison of table schemas. 434 435 sort($columns); 435 sort( $this->table_columns[$table]);436 return $this->table_columns[$table] == $columns;436 sort(self::$table_columns[$table]); 437 return self::$table_columns[$table] == $columns; 437 438 } else { 438 439 // Only check that the specified columns are available in the table. 439 $match_columns = array_intersect( $this->table_columns[$table], $columns);440 $match_columns = array_intersect(self::$table_columns[$table], $columns); 440 441 sort($columns); 441 442 sort($match_columns); … … 467 468 public function resetCache() 468 469 { 469 $this->existing_tables = null;470 $this->table_columns = null;470 self::$existing_tables = null; 471 self::$table_columns = null; 471 472 } 472 473
Note: See TracChangeset
for help on using the changeset viewer.