Пример #1
0
 function toDialectString(IDialect $dialect)
 {
     //
     // FIXME move to IDialect
     //
     return 'DROP INDEX ' . $dialect->quoteIdentifier($this->index->getName()) . ($dialect->getDBDriver()->is(DBDriver::MYSQL) ? ' ON ' . $dialect->quoteIdentifier($this->index->getTable()->getName()) : '') . ($dialect->getDBDriver()->is(DBDriver::PGSQL) ? ' CASCADE ' : '') . ';';
 }
Пример #2
0
 function toDialectString(IDialect $dialect)
 {
     $sqlSlices = array();
     if ($this->table) {
         $sqlSlices[] = $dialect->quoteIdentifier($this->table);
     }
     $sqlSlices[] = $dialect->quoteIdentifier($this->field);
     $identifier = join('.', $sqlSlices);
     return $identifier;
 }
Пример #3
0
 function toDialectString(IDialect $dialect)
 {
     $processedPathChunks = array();
     foreach ($this->path as $pathChunk) {
         $processedPathChunks[] = $dialect->quoteIdentifier($pathChunk);
     }
     return join('.', $processedPathChunks);
 }
Пример #4
0
 function toDialectString(IDialect $dialect)
 {
     $fieldValueCompiledPairs = array();
     foreach ($this->toArray() as $field => $value) {
         $fieldValueCompiledPairs[] = $dialect->quoteIdentifier($field) . '=' . $value->toDialectString($dialect);
     }
     $compiledCollection = join(', ', $fieldValueCompiledPairs);
     return $compiledCollection;
 }
Пример #5
0
 function toDialectString(IDialect $dialect)
 {
     $quotedFields = array();
     foreach ($this->getList() as $field) {
         $quotedFields[] = $dialect->quoteIdentifier($field);
     }
     $joinedFields = join(', ', $quotedFields);
     return $joinedFields;
 }
 function toDialectString(IDialect $dialect)
 {
     $table = $dialect->quoteIdentifier($this->constraint->getTable()->getName());
     $ct = $dialect->quoteIdentifier($this->constraint->getName());
     if ($dialect->getDBDriver()->is(DBDriver::MYSQL)) {
         if ($this->constraint instanceof DBUniqueConstraint) {
             return 'ALTER TABLE ' . $table . ' DROP INDEX ' . $ct;
         } else {
             if ($this->constraint instanceof DBPrimaryKeyConstraint) {
                 return 'ALTER TABLE ' . $table . ' DROP PRIMARY KEY';
             } else {
                 if ($this->constraint instanceof DBOneToOneConstraint || $this->constraint instanceof DBForeignKeyConstraint) {
                     return 'ALTER TABLE ' . $table . ' DROP FOREIGN KEY ' . $ct;
                 }
             }
         }
         Assert::isUnreachable('Do not know how to remove constraint %s from MySQL', get_class($this->constraint));
     }
     return 'ALTER TABLE ' . $table . ' DROP CONSTRAINT ' . $ct . ' CASCADE;';
 }
Пример #7
0
 function toDialectString(IDialect $dialect)
 {
     $querySlices = array();
     $querySlices[] = 'DELETE FROM';
     $querySlices[] = $dialect->quoteIdentifier($this->table);
     if ($this->condition) {
         $querySlices[] = 'WHERE';
         $querySlices[] = $this->condition->toDialectString($dialect);
     }
     $compiledQuery = join(' ', $querySlices);
     return $compiledQuery;
 }
Пример #8
0
 function toDialectString(IDialect $dialect)
 {
     $queryParts = array();
     $this->commaSeparatedQueryParts = array();
     $queryParts[] = 'CREATE TABLE ';
     $queryParts[] = $dialect->quoteIdentifier($this->table->getName());
     $queryParts[] = '(';
     $this->makeColumns($dialect);
     $queryParts[] = join(',', $this->commaSeparatedQueryParts);
     $queryParts[] = StringUtils::DELIM_STANDART;
     $queryParts[] = ');';
     return join('', $queryParts);
 }
Пример #9
0
 function toDialectString(IDialect $dialect)
 {
     $querySlices = array();
     $querySlices[] = 'INSERT INTO';
     $querySlices[] = $dialect->quoteIdentifier($this->tableName);
     $querySlices[] = '(';
     $querySlices[] = $this->getCompiledFields($dialect);
     $querySlices[] = ')';
     $querySlices[] = 'VALUES';
     $querySlices[] = '(';
     $querySlices[] = $this->getCompiledValues($dialect);
     $querySlices[] = ')';
     $compiledQuery = join(' ', $querySlices);
     return $compiledQuery;
 }
Пример #10
0
 function toDialectString(IDialect $dialect)
 {
     $queryParts[] = $dialect->quoteIdentifier($this->name);
     $queryParts[] = ' ';
     $queryParts[] = $this->type->toDialectString($dialect);
     if ($this->defaultValue) {
         $queryParts[] = ' DEFAULT ';
         $queryParts[] = $this->defaultValue->toDialectString($dialect);
     }
     $string = join('', $queryParts);
     return $string;
 }
Пример #11
0
 function toDialectString(IDialect $dialect)
 {
     return 'ALTER TABLE ' . $dialect->quoteIdentifier($this->column->getTable()->getName()) . ' ADD COLUMN ' . $this->column->toDialectString($dialect) . ';';
 }
Пример #12
0
 function toDialectString(IDialect $dialect)
 {
     return $dialect->quoteIdentifier($this->id);
 }
Пример #13
0
 function toDialectString(IDialect $dialect)
 {
     return 'DROP TABLE ' . $dialect->quoteIdentifier($this->table->getName()) . ' CASCADE;';
 }
Пример #14
0
 /**
  * Gets the SQL representation of the constraint's head
  *
  * @param IDialect $dialect
  *
  * @return string
  */
 protected function getHead(IDialect $dialect)
 {
     return 'CONSTRAINT ' . $dialect->quoteIdentifier($this->name);
 }
Пример #15
0
 function toDialectString(IDialect $dialect)
 {
     return 'INDEX ' . $dialect->quoteIdentifier($this->name) . ' ON ' . $dialect->quoteIdentifier($this->table->getName()) . ' (' . $this->getFieldsAsString($dialect) . ')';
 }
 function toDialectString(IDialect $dialect)
 {
     return 'ALTER TABLE ' . $dialect->quoteIdentifier($this->table->getName()) . ' ADD ' . $this->constraint->toDialectString($dialect) . ';';
 }