Started query queue with like method
This commit is contained in:
parent
521c0d32da
commit
3f7236c706
@ -24,7 +24,6 @@ class Query_Builder {
|
||||
private $select_string,
|
||||
$from_string,
|
||||
$where_string,
|
||||
$like_string,
|
||||
$insert_string,
|
||||
$update_string,
|
||||
$set_string,
|
||||
@ -46,6 +45,9 @@ class Query_Builder {
|
||||
// Alias to $this->db->sql
|
||||
private $sql;
|
||||
|
||||
// Query component order mapping
|
||||
private $query_map;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -165,8 +167,6 @@ class Query_Builder {
|
||||
*/
|
||||
public function like($field, $val, $pos='both')
|
||||
{
|
||||
// @todo Add to where string in the appropriate location
|
||||
|
||||
$field = $this->db->quote_ident($field);
|
||||
|
||||
$this->like_array[$field] = array(
|
||||
@ -174,10 +174,7 @@ class Query_Builder {
|
||||
'pos' => $post
|
||||
);
|
||||
|
||||
$likes = array();
|
||||
|
||||
foreach($this->like_array as $field => $array)
|
||||
{
|
||||
// Add the like string into the order map
|
||||
$l = $field. ' LIKE ';
|
||||
|
||||
if ($pos == 'before')
|
||||
@ -193,10 +190,12 @@ class Query_Builder {
|
||||
$l .= '%?%';
|
||||
}
|
||||
|
||||
$likes[] = $l;
|
||||
}
|
||||
|
||||
$this->like_string = implode(' AND ', $likes);
|
||||
$this->query_map[] = array(
|
||||
'type' => 'like',
|
||||
'conjunction' => (empty($this->query_map)) ? 'WHERE ' : ' AND ',
|
||||
'string' => $l,
|
||||
'value' => $val
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
@ -712,7 +711,7 @@ class Query_Builder {
|
||||
break;
|
||||
}
|
||||
|
||||
echo $sql.'<br />';
|
||||
//echo $sql.'<br />';
|
||||
|
||||
return $sql;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ class FirebirdQBTest extends UnitTestCase {
|
||||
$params->pass = 'masterkey';
|
||||
$this->qb = new Query_Builder($params);
|
||||
|
||||
echo '<hr /> Firebird Queries <hr />';
|
||||
//echo '<hr /> Firebird Queries <hr />';
|
||||
}
|
||||
|
||||
function TestGet()
|
||||
|
@ -28,7 +28,7 @@
|
||||
$params->host = 'localhost';
|
||||
$this->qb = new Query_Builder($params);
|
||||
|
||||
echo '<hr /> SQLite Queries <hr />';
|
||||
//echo '<hr /> SQLite Queries <hr />';
|
||||
}
|
||||
|
||||
function TestGet()
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user