Skip to content

Commit fb33c54

Browse files
committed
Update DB.php
1 parent 5a76579 commit fb33c54

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/DB.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ class DB
3939

4040
private $where = array();
4141

42-
public function __construct()
43-
{
42+
public function __construct() {
4443
$this->mount();
4544
}
4645

@@ -90,6 +89,10 @@ protected function buildInsert(array $data, $modifiers = null, $type = null): st
9089
continue;
9190
}
9291

92+
if ($value == "") {
93+
$value = self::raw('NULL');
94+
}
95+
9396
if ($value instanceof Expression) {
9497
$tmp[] = sprintf("%s = %s", $column, $value->getValue());
9598
} else {
@@ -190,8 +193,7 @@ public function commit(): DB
190193
return $this;
191194
}
192195

193-
public static function config(string $filename)
194-
{
196+
public static function config(string $filename) {
195197
self::$config = $filename;
196198
}
197199

@@ -275,8 +277,7 @@ public function delete($modifiers = null): ?int
275277
return $this->sth->rowCount();
276278
}
277279

278-
protected function dump()
279-
{
280+
protected function dump() {
280281
if ($this->debug) {
281282
echo '<pre>';
282283
$this->sth->debugDumpParams();

0 commit comments

Comments
 (0)