Skip to content

Commit 87b6cc8

Browse files
committed
Add array support to post params.
1 parent 0458c19 commit 87b6cc8

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/Query/Query.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function getFormat()
110110
public function isUseInUrlBindingsParams():bool
111111
{
112112
// 'query=select {p1:UInt8} + {p2:UInt8}' -F "param_p1=3" -F "param_p2=4"
113-
return preg_match('#{[\w+]+:[\w+]+}#',$this->sql);
113+
return preg_match('#{[\w+]+:[\w+()]+}#',$this->sql);
114114

115115
}
116116
public function getUrlBindingsParams():array

tests/BindingsPostTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,16 @@ public function testSelectAsKeys()
5757
}
5858
}
5959

60+
public function testArrayAsPostParam()
61+
{
62+
$arr = [1,3,6];
63+
$result = $this->client->select(
64+
'SELECT {arr:Array(UInt8)} as arr',
65+
[
66+
'arr'=>json_encode($arr)
67+
]
68+
);
69+
$this->assertEquals($arr, $result->fetchRow('arr'));
70+
}
71+
6072
}

0 commit comments

Comments
 (0)