1: <?php
2:
3: namespace Yajra\Oci8\Query;
4:
5: use Illuminate\Database\Query\Builder;
6:
7: class OracleBuilder extends Builder
8: {
9: 10: 11: 12: 13: 14: 15: 16:
17: public function insertLob(array $values, array $binaries, $sequence = 'id')
18: {
19:
20: $grammar = $this->grammar;
21: $sql = $grammar->compileInsertLob($this, $values, $binaries, $sequence);
22:
23: $values = $this->cleanBindings($values);
24: $binaries = $this->cleanBindings($binaries);
25:
26:
27: $processor = $this->processor;
28:
29: return $processor->saveLob($this, $sql, $values, $binaries);
30: }
31:
32: 33: 34: 35: 36: 37: 38: 39:
40: public function updateLob(array $values, array $binaries, $sequence = 'id')
41: {
42: $bindings = array_values(array_merge($values, $this->getBindings()));
43:
44:
45: $grammar = $this->grammar;
46: $sql = $grammar->compileUpdateLob($this, $values, $binaries, $sequence);
47:
48: $values = $this->cleanBindings($bindings);
49: $binaries = $this->cleanBindings($binaries);
50:
51:
52: $processor = $this->processor;
53:
54: return $processor->saveLob($this, $sql, $values, $binaries);
55: }
56:
57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67:
68: public function whereIn($column, $values, $boolean = 'and', $not = false)
69: {
70: $type = $not ? 'NotIn' : 'In';
71:
72: if (count($values) > 1000) {
73: $chunks = array_chunk($values, 1000);
74:
75: return $this->where(function ($query) use ($column, $chunks, $type) {
76: $firstIteration = true;
77: foreach ($chunks as $ch) {
78: $sqlClause = $firstIteration ? 'where' . $type : 'orWhere' . $type;
79: $query->$sqlClause($column, $ch);
80: $firstIteration = false;
81: }
82: }, null, null, $boolean);
83: }
84:
85: return parent::whereIn($column, $values, $boolean, $not);
86: }
87:
88: 89: 90: 91: 92:
93: protected function runSelect()
94: {
95: if ($this->lock) {
96: $this->connection->beginTransaction();
97: $result = $this->connection->select($this->toSql(), $this->getBindings(), ! $this->useWritePdo);
98: $this->connection->commit();
99:
100: return $result;
101: }
102:
103: return $this->connection->select($this->toSql(), $this->getBindings(), ! $this->useWritePdo);
104: }
105: }
106: