Fix issue with Query_Builder->where_in() method

This commit is contained in:
Timothy Warren 2012-08-24 16:17:08 +00:00
parent a4f730b081
commit 4c546ed3e9
3 changed files with 16 additions and 3 deletions

View File

@ -698,12 +698,12 @@ class Query_Builder {
$key = $this->quote_ident($key);
$params = array_fill(0, count($val), '?');
foreach($val as &$v)
foreach($val as $v)
{
$this->values[] = $v;
}
$string = $key . " {$in} ".implode(',', $params).') ';
$string = $key . " {$in} (".implode(',', $params).') ';
$this->query_map[] = array(
'type' => 'where_in',

View File

@ -173,6 +173,19 @@ abstract class QBTest extends UnitTestCase {
// --------------------------------------------------------------------------
public function TestWhereIn()
{
if (empty($this->db)) return;
$query = $this->db->from('create_test')
->where_in('id', array(0, 6, 56, 563, 341))
->get();
$this->assertIsA($query, 'PDOStatement');
}
// --------------------------------------------------------------------------
public function TestSelectAvg()
{
if (empty($this->db)) return;

Binary file not shown.