On 15 Jun 2005, at 11:56, Jonathan H N Chin wrote:

I would be interested to know what version of DBD::SQLite Puneet Kishor
is using, since I believe I have tracked the issue to a test in
the sqlite_st_execute() function in dbdimp.c :

    else if (looks_like_number(value)) {
/* bind ordinary numbers as numbers - otherwise we might sort wrong */
        retval = sqlite3_bind_double(imp_sth->stmt, i+1, SvNV(value));
    }

This test appears in all the versions of DBD::SQLite that I can find
and appears to be what causes the text to be treated as a number.

Does this check actually perform any useful function (as per the comment)
or will it be safe to delete it?

I added it because of another bug report that was incorrectly sorting integer columns based on text sort order. For example if you inserted:

 ("k1", 8);
 ("k2", 9);
 ("k3", 10);
 ("k4", 11);

and then asked for: SELECT * FROM t ORDER BY Column2
you get back:

  k3, 10
  k4, 11
  k1, 8
  k2, 9

Which seems obviously incorrect.

To be honest I'm not entirely sure what the correct fix is - maybe ignore the above bug and tell the requestor he has to: SELECT * FROM t ORDER BY int(Column2)

In answer to your question though, yes you can remove that bit of code, as long as you're aware of the above side effect.

Matt.


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email ______________________________________________________________________

Reply via email to