Changeset 2302
- Timestamp:
- 12/16/10 07:04:29 (17 months ago)
- Files:
-
- 1 modified
-
branches/1.5/libs/Database.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/1.5/libs/Database.php
r2295 r2302 349 349 public function table_exists($table_name) 350 350 { 351 $tables = $this->get_col("SHOW TABLES", 0); 352 return (bool) in_array(DB_PREFIX.$table_name, $tables); 351 return (bool) $this->query("SHOW TABLES LIKE '".DB_PREFIX.$table_name."'"); 353 352 } 354 353 … … 364 363 public function column_exists($table_name, $column) 365 364 { 366 $sql = "SHOW COLUMNS FROM ".DB_PREFIX.$table_name; 367 foreach ($this->get_col($sql, 0) as $column_name) { 368 if ($column_name == $column) { 369 return FALSE; 370 } 371 } 372 373 return FALSE; 365 return (bool) $this->query("SHOW COLUMNS FROM `".DB_PREFIX.$table_name."` LIKE '".$column."'"); 374 366 } 375 367