Skip to content

Commit 50f596f

Browse files
committed
ok
1 parent 8be73ba commit 50f596f

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/ClickHouseQuery.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,8 @@ public function quotePar($str, $quote = "'")
600600
$lc = substr($str, -1);
601601
return (is_numeric($str) ||
602602
(($fc === '"' || $fc === "'") && ($fc === $lc)) ||
603-
(($lc === ')' && strpos($str, '(') !== false))
603+
(($lc === ')' && strpos($str, '(') !== false)) ||
604+
(($fc === '[' && $lc ===']'))
604605
) ? $str : $quote . addcslashes($str, "'\t\n\r\0") . $quote;
605606
}
606607

tests/src/ClickHouseFunctionsTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,16 @@ public function testParseFieldsArr()
567567
'bytes' => 1
568568
]], $arr);
569569

570+
$arr = $ch->parseFieldsArr(['id' => ["Array(UInt8)",'[1]']]);
571+
$this->assertEquals(['id' => [
572+
'create' => "id Array(UInt8) DEFAULT [1]",
573+
'type_full' => "Array(UInt8)",
574+
'type_name' => 'Array',
575+
'type_src' => "Array(UInt8)",
576+
'default' => "[1]",
577+
'bytes' => 0
578+
]], $arr);
579+
570580
$this->setExpectedException("\Exception");
571581
$arr = $ch->parseFieldsArr(['id' => 'UnknownType']);
572582
$this->assertFalse("This line will not be executed");

0 commit comments

Comments
 (0)