I don't know for sure this will help you, but when I write SQL statements that use a decimal/floating point value in the where clause, I always use something like where abs(the value I want to check - Field I'm checking) < 0.001

You can use the ? operator with that, you just have to determine how big a round off error you can tolerate and whether you will return more than one row (you can always limit it to 1 result and order by the difference in value). You can't check for absolute matches with decimal/real/floating point numbers because of rounding.


Sincerely,

Brad Gies
-----------------------------------------------------------------------
Bistro Bot - Bistro Blurb
http://bgies.com            http://nocrappyapps.com
http://bistroblurb.com      http://forcethetruth.com
http://ihottonight.com
-----------------------------------------------------------------------
Everything in moderation, including abstinence (paraphrased)

Every person is born with a brain... Those who use it well are the successful 
happy ones - Brad Gies

Adversity can make or break you... It's your choice... Choose wisely - Brad Gies

Never doubt that a small group of thoughtful, committed people can
change the world. Indeed. It is the only thing that ever has - Margaret Mead


On 22/02/2011 7:43 PM, Nathan wrote:
I'm seeing this

Reached MAX size for compiled-sql statement cache for database "";
i.e., NO space for this sql statement in cache:

Please change your sql statements to use '?' for bindargs, instead of
using actual values

I would follow that advice, except for one simple fact, which I noted
a year ago:

IT DOESN'T WORK WITH FLOATING POINT.

I can and have proved it. You can set up a query with '?' and floating
point, and the same query with good old fashioned string
concatenation. They both return an answer, but the answer for the
bindargs one is *wrong*.  The float columns are analyzed using a
string comparison. I can't necessarily say this is a bug in
SQliteDatabase.query because it does say 'The values will be bound as
Strings'.

So here's my question.

Is there anything I can do to prevent the above error? Since there is
no use for caching this statement given the bindings don't work, can I
stop it from caching the statement in the first place?

What adverse effects do I expect with the error? It doesn't crash
right away, but it doesn't sound good.

Nathan


--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to