Interesting problem comparing strings with integer values...
Greg Brunet
gbrunet at nospamsempersoft.com
Wed Jan 15 20:11:56 EST 2003
It seems that you should be asking this question on the newsgroup of the
DB engine you're using. Some have a function that would allow you to
convert the string(s) to a number & then compare it properly. If yours
doesn't, then it would seem that fixed length number strings is the only
other alternative. I'm not sure if you are saying that a variable
length binary string compares correctly, but it doesn't compare any
better than a variable length integer string.
--
Greg
"Chris Spencer" <clspence at one.net> wrote in message
news:mailman.1042676428.15278.python-list at python.org...
The comparison will not be done inside of a Python interpreter, but in
an SQL statement. ie...
select blah from table where value>"999" and value<"3432";
We're storing arbitrary data in text blobs, so we can't make "value"
above an
integer type.
As I mentioned in my first post, while the above SQL statement would be
incorrect, the below SQL code WOULD.
select blah from table where value>"00000999" and value<"00003432";
This just seems incredibly hack-y to me. It means that we'd have a
hardcoded
limit for padding values with zeroes. It gets even more fun when I talk
floating point values...But one step at a time.
Note that this works as well:
select blah from table where value>"1111100111" and
value<"110101101000";
However, I've not been able to find an equivalent to hex() or oct() that
would
turn integers into binary string representation. If there IS such a
beastie,
please let me know.
Chris.
More information about the Python-list
mailing list