@@ 71-87 (lines=17) @@ | ||
68 | * |
|
69 | * @return bool |
|
70 | */ |
|
71 | public function insert(array $values) |
|
72 | { |
|
73 | if (empty($values)) { |
|
74 | return true; |
|
75 | } |
|
76 | $values = $this->detectValues($values); |
|
77 | $bindings = []; |
|
78 | foreach ($values as $record) { |
|
79 | foreach ($record as $key => $value) { |
|
80 | $bindings[$key] = $value; |
|
81 | } |
|
82 | } |
|
83 | ||
84 | $sql = $this->grammar->compileInsert($this, $values); |
|
85 | ||
86 | return $this->connection->insert($sql, $bindings); |
|
87 | } |
|
88 | ||
89 | /** |
|
90 | * supported N1QL upsert query. |
|
@@ 96-112 (lines=17) @@ | ||
93 | * |
|
94 | * @return bool|mixed |
|
95 | */ |
|
96 | public function upsert(array $values) |
|
97 | { |
|
98 | if (empty($values)) { |
|
99 | return true; |
|
100 | } |
|
101 | $values = $this->detectValues($values); |
|
102 | $bindings = []; |
|
103 | foreach ($values as $record) { |
|
104 | foreach ($record as $key => $value) { |
|
105 | $bindings[$key] = $value; |
|
106 | } |
|
107 | } |
|
108 | ||
109 | $sql = $this->grammar->compileUpsert($this, $values); |
|
110 | ||
111 | return $this->connection->upsert($sql, $bindings); |
|
112 | } |
|
113 | ||
114 | /** |
|
115 | * @param string|int|array $values |