Fix some issues with SQL filtering and comparison

These changes fix an issue noticed upstream in GeoServer with SLD's and PostGIS datastores - http://jira.codehaus.org/browse/GEOS-6150

FilterToSQL - If a value (such as '1.0') cannot be converted to the target type (such as int), try converting it to a generic Number before treating it as a String.  Otherwise, Postgres will throw an exception when the query is run if the numeric value is enclosed in single quotes.

CompareFilterImpl: Check for and handle condition where both values to be compared are strings that can be converted to numbers.