Case sensitivity of select single options - how to prevent?

nmcgann

New member
I've got some enums in my records and mysql isn't case sensitive (on the default character sets) so I can search these with mixed case no problem.

However, dadabik has to match the field's case exactly with the "Option to include" field in the configration (e.g. "TheName" in a select_single configuration field won't match "thename" in the database). I'd prefer it to be case insensitive so I can use capitalisation to make it look nicer as seen by the user, but it will match whatever is in the database.

This is going to be an easy hack forcing a case-insensitive comparison if I knew where to look - any clues?

Neil
 

DebbieS

DaDaBIK Guru
Don't know if you've solved this, but you can try adding UPPER() or LOWER() around the variables in the where clause inside the function build_where_clause( ...

This is just a sample of how you can try it (only needed on the default and select options - the date does not need this):

[pre]
$where_clause .= "LOWER(".$quote.$table_name.$quote.'.'.$quote.$field_name_temp.$quote.") = LOWER('".$_POST[$field_name_temp]."')";
[/pre]

This should convert all text to lower case before doing any comparison.
 

eugenio

Administrator
Staff member
Hi Neil,
I've just tried to change the case (from lower to upper) of one of the option of an installation but it still works, selecting all the records having that option in the database (in lower case); can you try again and/or give us more details?
 

DebbieS

DaDaBIK Guru
Eugenio

Do you mean that if you put the UPPER() in the code, searching on something returns records where the search term is stored as lower case? If so, isn't that what Neil asked for?

Maybe I just don't understand today (been a loooooooooooooooong day at work).
 

eugenio

Administrator
Staff member
I meant that in my test, the select_single field is case INSENSITIVE when you perform a search; even if the options are stored in upper case, you also match the record having lower case values. I didn't change the code, I've just changed the options (made them upper case) via the interface configurator.
 
Top