Skip to content

Commit

Permalink
🚿
Browse files Browse the repository at this point in the history
  • Loading branch information
codemasher committed Aug 27, 2024
1 parent 362c3ec commit 871bfee
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 44 deletions.
37 changes: 0 additions & 37 deletions examples/common.php

This file was deleted.

10 changes: 5 additions & 5 deletions src/Dialects/Postgres.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,11 @@ public function fieldspec(
if($defaultType === 'USER_DEFINED'){

$field[] = match (true) {
$type === 'TIMESTAMP' && intval($defaultValue) === 0 => 'DEFAULT 0',
$type === 'BIT' || $type === 'VARBIT' => 'DEFAULT b\''.preg_replace('/[^01]/', '0', $defaultValue).'\'',
$type === 'BOOLEAN' => 'DEFAULT '.(preg_match('/^1|T|TRUE|YES$/i', $defaultValue) ? 'TRUE' : 'FALSE'),
strtoupper($defaultValue) === 'NULL' && $isNull === true => 'DEFAULT NULL',
default => 'DEFAULT \''.$defaultValue.'\'',
$type === 'TIMESTAMP' && intval($defaultValue) === 0 => 'DEFAULT 0',
$type === 'BIT' || $type === 'VARBIT' => 'DEFAULT b\''.preg_replace('/[^01]/', '0', $defaultValue).'\'',
$type === 'BOOLEAN' => 'DEFAULT '.(preg_match('/^1|T|TRUE|YES$/i', $defaultValue) ? 'TRUE' : 'FALSE'),
strtoupper((string)$defaultValue) === 'NULL' && $isNull === true => 'DEFAULT NULL',
default => 'DEFAULT \''.$defaultValue.'\'',
};

}
Expand Down
1 change: 1 addition & 0 deletions src/Drivers/DriverAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public function __construct(
){
$this->options = $options;
$this->cache = $cache;
/** @phan-suppress-next-line PhanEmptyFQSENInClasslike, PhanTypeExpectedObjectOrClassName */
$this->dialect = new (static::DIALECT);

$this->setLogger($logger);
Expand Down
1 change: 0 additions & 1 deletion src/Drivers/DriverInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace chillerlan\Database\Drivers;

use chillerlan\Database\Dialects\Dialect;
use chillerlan\Database\Result;
use chillerlan\Settings\SettingsContainerInterface;
use Closure;
Expand Down
2 changes: 1 addition & 1 deletion src/Query/Update.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function set(array $set, bool|null $bind = null):static{

foreach($set as $k => $v){

if($v instanceof Statement){
if($v instanceof Query){
$this->set[] = $this->dialect->quote($k).' = ('.$v->getSQL().')';

if($v instanceof BindValues){
Expand Down

0 comments on commit 871bfee

Please sign in to comment.