I've a project that use PostgreSQL and new with it. Below is the error that i was facing. I also has searched on google but cannot find the solution.
Fatal error: Call to undefined method CI_DB_postgre_driver::ilike() in D:\htdocs\poes\system\application\rapyd\classes\datafilter.php on line 162
I'm using codeigniter framework. This code is from datafilter.php $this->db->ilike($name, $value);
On my controller,
$query1 = "SELECT DISTINCT users.* FROM users LEFT JOIN login ON users.user_id=login.login_user_id;";
$filter->db->query($query1);
$filter->name = new inputField("Name :", "user_name");
$filter->name->clause = "ilike";
I just solve the issue, need to add this function in system/database/DB_active_rec.php to use ilike
function ilike($field, $match = '', $side = 'both')
{
return $this->_ilike($field, $match, 'AND ', $side);
}
function _ilike($field, $match = '', $type = 'AND ', $side = 'both', $not = '')
{
if ( ! is_array($field))
{
$field = array($field => $match);
}
foreach ($field as $k => $v)
{
$k = $this->_protect_identifiers($k);
$prefix = (count($this->ar_like) == 0) ? '' : $type;
$v = $this->escape_like_str($v);
if ($side == 'before')
{
$like_statement = $prefix." $k $not ILIKE '%{$v}'";
}
elseif ($side == ‘after’)
{
$like_statement = $prefix." $k $not ILIKE '{$v}%'";
}
else
{
$like_statement = $prefix." $k $not ILIKE '%{$v}%'";
}
// some platforms require an escape sequence definition for ILIKE wildcards
if ($this->_like_escape_str != ‘’)
{
$like_statement = $like_statement.sprintf($this->_like_escape_str, $this->_like_escape_chr);
}
$this->ar_like[] = $like_statement;
if ($this->ar_caching === TRUE)
{
$this->ar_cache_ilike[] = $like_statement;
$this->ar_cache_exists[] = 'ilike';
}
}
return $this;
}
source from https://ellislab.com/forums/viewthread/87725/#808269