コード例 #1
0
ファイル: UpdateQuery.php プロジェクト: repo2/query-builder
 /**
  * @inheritDoc
  */
 protected function compileBase(DriverInterface $driver)
 {
     if ($this->valuesBag->isEmpty()) {
         throw new CompileException('No values found for update query.');
     }
     return 'UPDATE ' . $this->table->compile($driver) . ' SET ' . $this->valuesBag->concat($driver, ', ');
 }
コード例 #2
0
ファイル: SelectQuery.php プロジェクト: repo2/query-builder
 /**
  * @inheritDoc
  */
 protected function compileBase(DriverInterface $driver)
 {
     if ($this->columnsBag->isEmpty()) {
         throw new CompileException('Select query requires columns list.');
     }
     return 'SELECT ' . $this->columnsBag->concat($driver, ', ') . ' FROM ' . $this->table->compile($driver);
 }
コード例 #3
0
ファイル: CreateTable.php プロジェクト: repo2/query-builder
 /**
  * @inheritDoc
  */
 public function compile(DriverInterface $driver)
 {
     if ($this->columnsBag->isEmpty()) {
         throw new CompileException('The table definition requires columns list.');
     }
     return 'CREATE TABLE ' . $this->table->compile($driver) . '(' . $this->columnsBag->concat($driver, ', ') . ')';
 }
コード例 #4
0
ファイル: Alias.php プロジェクト: repo2/query-builder
 /**
  * @inheritDoc
  */
 public function compile(DriverInterface $driver)
 {
     return parent::compile($driver) . ' AS ' . $driver->quote($this->alias);
 }
コード例 #5
0
ファイル: InsertQuery.php プロジェクト: repo2/query-builder
 /**
  * @inheritDoc
  */
 public function compile(DriverInterface $driver)
 {
     return 'INSERT INTO ' . $this->table->compile($driver) . '(' . $this->compileFields($driver) . ') VALUES ' . $this->compileValues($driver);
 }
コード例 #6
0
ファイル: Assign.php プロジェクト: repo2/query-builder
 /**
  * @inheritDoc
  */
 public function compile(DriverInterface $driver)
 {
     return $this->ref->compile($driver) . ' = "' . $driver->escapeValue($this->value) . '"';
 }
コード例 #7
0
ファイル: DropTable.php プロジェクト: repo2/query-builder
 /**
  * @inheritDoc
  */
 public function compile(DriverInterface $driver)
 {
     return 'DROP TABLE ' . $this->table->compile($driver);
 }
コード例 #8
0
ファイル: Column.php プロジェクト: repo2/query-builder
 /**
  * @inheritDoc
  */
 public function compile(DriverInterface $driver)
 {
     if (!$this->type) {
         throw new CompileException(sprintf('Data type for the column "%s" not defined.', $this->ref));
     }
     $compiled = parent::compile($driver) . ' ' . $this->type->compile();
     if ($this->primary) {
         return $this->compilePrimary($compiled);
     }
     return $this->compileRegular($driver, $compiled);
 }
コード例 #9
0
ファイル: functions.php プロジェクト: repo2/query-builder
/**
 * @param mixed $field
 * @return OrderBy
 */
function orderByDesc($field)
{
    return new OrderBy(Reference::factory($field), OrderBy::DESC);
}
コード例 #10
0
ファイル: DeleteQuery.php プロジェクト: repo2/query-builder
 /**
  * @inheritDoc
  */
 protected function compileBase(DriverInterface $driver)
 {
     return 'DELETE FROM ' . $this->table->compile($driver);
 }