fieldExists() public method

Determines whether a field exists in a table.
public fieldExists ( $table, $fieldName ) : bool:
$table string
$fieldName string
return bool:
Example #1
0
 /**
  * Migrate form legacy column set editor.
  *
  * @return void
  */
 private function migrateFromLegacy()
 {
     if (!$this->database->fieldExists('bootstrap_grid', 'tl_content') && $this->database->fieldExists('columnset_id', 'tl_content')) {
         $this->database->query('ALTER TABLE tl_content ADD bootstrap_grid int(10) unsigned NOT NULL default \'0\';');
         $this->database->query('UPDATE tl_content SET bootstrap_grid=columnset_id WHERE bootstrap_grid = 0');
     }
 }
Example #2
0
 /**
  * Update CategoryLinks collation
  */
 protected function doCollationUpdate()
 {
     global $wgCategoryCollation;
     if ($this->db->fieldExists('categorylinks', 'cl_collation', __METHOD__)) {
         if ($this->db->selectField('categorylinks', 'COUNT(*)', 'cl_collation != ' . $this->db->addQuotes($wgCategoryCollation), __METHOD__) == 0) {
             $this->output("...collations up-to-date.\n");
             return;
         }
         $this->output("Updating category collations...");
         $task = $this->maintenance->runChild('UpdateCollation');
         $task->execute();
         $this->output("...done.\n");
     }
 }
 /**
  * Check if a property with the given name exists in the table.
  *
  * @param string $strField The name of the property to search.
  *
  * @return boolean
  */
 public function fieldExists($strField)
 {
     return $this->objDatabase->fieldExists($strField, $this->strSource);
 }