예제 #1
0
 /**
  * Expands a SQL string
  *
  * Clauses defined here:
  *   {key}      - the $key property, sql quoted
  *   {keybind}  - a string like ":table_id" for use as a named placeholder
  *
  * @param sql string
  * @return string
  * @see $key, DatabaseObjectAbstractMeta::expandSQL
  */
 protected function expandSQL($sql)
 {
     $sql = parent::expandSQL($sql);
     $sql = str_replace('{key}', "`{$this->key}`", $sql);
     $sql = str_replace('{keybind}', ":{$this->key}", $sql);
     return $sql;
 }
 protected function expandSQL($sql)
 {
     $sql = parent::expandSQL($sql);
     $auto = $this->getAutomaticColumns();
     if (count($auto)) {
         $colspec = ', ' . $this->getColumnsSQL($auto, null);
         $fieldset = ', ' . $this->getFieldSetSQL($auto, false);
     } else {
         $colspec = '';
         $fieldset = '';
     }
     $sql = str_replace('{+colspec}', $colspec, $sql);
     $sql = str_replace('{+fieldset}', $fieldset, $sql);
     if (isset($this->additionalKey)) {
         $addkey = ', ' . $this->getColumnsSQL($this->additionalKey, null);
     } else {
         $addkey = '';
     }
     $sql = str_replace('{+addkey}', $addkey, $sql);
     $sql = str_replace('{orderfrom}', $this->linkOrderClause[0], $sql);
     $sql = str_replace('{orderto}', $this->linkOrderClause[1], $sql);
     $sql = str_replace('{from_key}', $this->getFromKey(), $sql);
     $sql = str_replace('{to_key}', $this->getToKey(), $sql);
     $keyList = $this->getKeyColumns();
     $sql = str_replace('{keyspec}', $this->getFieldSetSQL($keyList), $sql);
     return $sql;
 }