codeigniter-base-model icon indicating copy to clipboard operation
codeigniter-base-model copied to clipboard

Case sensitivity?

Open paulcanning opened this issue 11 years ago • 3 comments
trafficstars

Is there a way to get records with case sensitivity in mind?

If not, how would I go about adding it in?

paulcanning avatar Apr 16 '14 09:04 paulcanning

Hi Paul,

I'm sorry, I don't think I understand. Case sensitive WHEREs on specific fields?

Jamie

On 16 April 2014 10:10, paulcanning [email protected] wrote:

Is there a way to get records with case sensitivity in mind?

If not, how would I go about adding it in?

Reply to this email directly or view it on GitHubhttps://github.com/jamierumbelow/codeigniter-base-model/issues/167 .

Jamie Rumbelow [email protected]

jamierumbelow avatar Apr 16 '14 09:04 jamierumbelow

Yes, that's right :)

I understand that you can use "BINARY" in a WHERE statement to make it case sensitive.

I made my own function in a model using active record, but it'd be nice to have an option that can be set for a normal "get" function.

Below is my new function:

$this->db->where("BINARY column_name = '$var'", null, false); $query = $this->db->get('table_name');

return $query->row();

paulcanning avatar Apr 16 '14 09:04 paulcanning

@paulcanning Thank you for ur function. It works!

Ninger avatar Nov 08 '14 05:11 Ninger