Using the DB API to test against a trimmed value? I want to use the DB API (Drupal 7) to do a query like:

select my_field from table where trim(my_field) &lt;&gt; ''


where my_field is a text field.  My goal is to not get any values in the result that are made up of one or more spaces. (This is a greatly simplified example query, but you get the idea.) Is there any way to get that call to trim() in there? The only thing I could imagine trying was:

$query-&gt;condition('trim(my_field)', '', '&lt;&gt;');


which doesn't work at all.  Any thoughts?  Thanks!
You can use SelectQuery::where() for more complex requirements:

$query-&gt;where('trim(my_field) &lt;&gt; :val', ['val' =&gt; '']);