As detailed in this discussion: http://moodle.org/mod/forum/discuss.php?d=176081
When using $DB->get_record() to compare text field with a value, the following error is produced:
Comparisons of text column conditions are not allowed. Please use sql_compare_text() in your query.
As you don't write the SQL yourself when using get_record(), this message is useless.
Either get_record should make appropriate use of sql_compare_text() to cirumvent the problem for you,
Or the error message should be a coding error telling you to use a more appropriate $DB method such as get_record_select, allowing you to specify a where clause using sql_compare_text().