Пример #1
0
 public function toDialectString(Dialect $dialect)
 {
     $query = 'INSERT INTO ' . $dialect->quoteTable($this->table) . ' ';
     if ($this->select === null) {
         $query = $this->toDialectStringValues($query, $dialect);
     } else {
         $query = $this->toDialectStringSelect($query, $dialect);
     }
     $query .= parent::toDialectString($dialect);
     return $query;
 }
Пример #2
0
 public function toDialectString(Dialect $dialect)
 {
     $query = 'UPDATE ' . $dialect->quoteTable($this->table) . ' SET ';
     $sets = [];
     foreach ($this->fields as $var => $val) {
         if ($val instanceof DialectString) {
             $sets[] = $dialect->quoteField($var) . ' = (' . $val->toDialectString($dialect) . ')';
         } elseif ($val === null) {
             $sets[] = $dialect->quoteField($var) . ' = ' . $dialect->literalToString(Dialect::LITERAL_NULL);
         } elseif (true === $val) {
             $sets[] = $dialect->quoteField($var) . ' = ' . $dialect->literalToString(Dialect::LITERAL_TRUE);
         } elseif (false === $val) {
             $sets[] = $dialect->quoteField($var) . ' = ' . $dialect->literalToString(Dialect::LITERAL_FALSE);
         } else {
             $sets[] = $dialect->quoteField($var) . ' = ' . $dialect->quoteValue($val);
         }
     }
     return $query . implode(', ', $sets) . $this->joiner->toDialectString($dialect) . parent::toDialectString($dialect);
 }