-----BEGIN PGP SIGNED MESSAGE-----
Ian Bicking escribi=F3:
| Josu Oyanguren wrote:
|> -----BEGIN PGP SIGNED MESSAGE-----
|> Hash: SHA1
|> Hi all,
|> i don't know if this is discussed.
|> I'm trying to use SelectResults.sum to get the total for a column of
|> floats. I think that it is trying to convert the result to an integer.
| I think this is a bug. Oddly, it was put in there specifically; I'm
| suspecting this is because SQLite is typeless, and you can almost forge=
| that except in the case of a computed value like SUM(), where PySQLite
| doesn't get the metadata to figure out what the type is. I'm not sure
| if there's a good way to support SQLite in this case.
I don't know the code enough to be sure, but i think it would be
possible to do something like this:
* DBAPI.accumulateSelect -> return the raw value
and in main.py
* SelectResults.count -> convert value to integer
* SelectResults.sum -> convert value to the column type
perhaps, an argument can be added to SelectResults.accumulate like this
def accumulate(self, expression, converter=3DNone):
~ if converter:
~ return converter(result)
~ return result
opening the door for other accumulates besides sum and count.
(just thinking aloud)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----
Get latest updates about Open Source Projects, Conferences and News.