Skip to content

Commit

Permalink
version
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Jan 13, 2021
2 parents 13ae12f + 49563a8 commit a1760b1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
4 changes: 4 additions & 0 deletions DetectsLostConnections.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ protected function causedByLostConnection(Throwable $e)
'running with the --read-only option so it cannot execute this statement',
'The connection is broken and recovery is not possible. The connection is marked by the client driver as unrecoverable. No attempt was made to restore the connection.',
'SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Try again',
'SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known',
'SQLSTATE[HY000]: General error: 7 SSL SYSCALL error: EOF detected',
'SQLSTATE[HY000] [2002] Connection timed out',
'SSL: Connection timed out',
'SQLSTATE[HY000]: General error: 1105 The last transaction was aborted due to Seamless Scaling. Please retry.',
]);
}
}
18 changes: 14 additions & 4 deletions Query/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ public function where($column, $operator = null, $value = null, $boolean = 'and'
);

if (! $value instanceof Expression) {
$this->addBinding($value, 'where');
$this->addBinding(is_array($value) ? head($value) : $value, 'where');
}

return $this;
Expand Down Expand Up @@ -1078,7 +1078,7 @@ public function whereBetween($column, array $values, $boolean = 'and', $not = fa

$this->wheres[] = compact('type', 'column', 'values', 'boolean', 'not');

$this->addBinding($this->cleanBindings($values), 'where');
$this->addBinding(array_slice($this->cleanBindings($values), 0, 2), 'where');

return $this;
}
Expand Down Expand Up @@ -1201,6 +1201,8 @@ public function whereDate($column, $operator, $value = null, $boolean = 'and')
$value, $operator, func_num_args() === 2
);

$value = is_array($value) ? head($value) : $value;

if ($value instanceof DateTimeInterface) {
$value = $value->format('Y-m-d');
}
Expand Down Expand Up @@ -1240,6 +1242,8 @@ public function whereTime($column, $operator, $value = null, $boolean = 'and')
$value, $operator, func_num_args() === 2
);

$value = is_array($value) ? head($value) : $value;

if ($value instanceof DateTimeInterface) {
$value = $value->format('H:i:s');
}
Expand Down Expand Up @@ -1279,6 +1283,8 @@ public function whereDay($column, $operator, $value = null, $boolean = 'and')
$value, $operator, func_num_args() === 2
);

$value = is_array($value) ? head($value) : $value;

if ($value instanceof DateTimeInterface) {
$value = $value->format('d');
}
Expand Down Expand Up @@ -1322,6 +1328,8 @@ public function whereMonth($column, $operator, $value = null, $boolean = 'and')
$value, $operator, func_num_args() === 2
);

$value = is_array($value) ? head($value) : $value;

if ($value instanceof DateTimeInterface) {
$value = $value->format('m');
}
Expand Down Expand Up @@ -1365,6 +1373,8 @@ public function whereYear($column, $operator, $value = null, $boolean = 'and')
$value, $operator, func_num_args() === 2
);

$value = is_array($value) ? head($value) : $value;

if ($value instanceof DateTimeInterface) {
$value = $value->format('Y');
}
Expand Down Expand Up @@ -1673,7 +1683,7 @@ public function whereJsonLength($column, $operator, $value = null, $boolean = 'a
$this->wheres[] = compact('type', 'column', 'operator', 'value', 'boolean');

if (! $value instanceof Expression) {
$this->addBinding($value);
$this->addBinding((int) $value);
}

return $this;
Expand Down Expand Up @@ -1822,7 +1832,7 @@ public function having($column, $operator = null, $value = null, $boolean = 'and
$this->havings[] = compact('type', 'column', 'operator', 'value', 'boolean');

if (! $value instanceof Expression) {
$this->addBinding($value, 'having');
$this->addBinding(is_array($value) ? head($value) : $value, 'having');
}

return $this;
Expand Down

0 comments on commit a1760b1

Please # to comment.