Skip to content

Commit

Permalink
Add array support to post params.
Browse files Browse the repository at this point in the history
  • Loading branch information
Antanas Jasaitis committed May 24, 2023
1 parent 0458c19 commit 87b6cc8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Query/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function getFormat()
public function isUseInUrlBindingsParams():bool
{
// 'query=select {p1:UInt8} + {p2:UInt8}' -F "param_p1=3" -F "param_p2=4"
return preg_match('#{[\w+]+:[\w+]+}#',$this->sql);
return preg_match('#{[\w+]+:[\w+()]+}#',$this->sql);

}
public function getUrlBindingsParams():array
Expand Down
12 changes: 12 additions & 0 deletions tests/BindingsPostTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,16 @@ public function testSelectAsKeys()
}
}

public function testArrayAsPostParam()
{
$arr = [1,3,6];
$result = $this->client->select(
'SELECT {arr:Array(UInt8)} as arr',
[
'arr'=>json_encode($arr)
]
);
$this->assertEquals($arr, $result->fetchRow('arr'));
}

}

0 comments on commit 87b6cc8

Please sign in to comment.