Exemple #1
0
 /**
  * supported N1QL upsert query.
  *
  * @param array $values
  *
  * @return bool|mixed
  */
 public function upsert(array $values)
 {
     if (empty($values)) {
         return true;
     }
     $values = $this->detectValues($values);
     $bindings = [];
     foreach ($values as $record) {
         foreach ($record as $key => $value) {
             $bindings[$key] = $value;
         }
     }
     $sql = $this->grammar->compileUpsert($this, $values);
     return $this->connection->upsert($sql, $bindings);
 }
 public function testShouldReturnDeleteQueryUseKey()
 {
     $this->builder->from('testing')->where('arg', 1)->key('testing');
     $this->assertSame('delete from testing USE KEYS "testing" where arg = ? RETURNING *', $this->grammer->compileDelete($this->builder));
 }