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;
 }
 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;
 }
 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) . ';';
 }