On Tue, Feb 13, 2007 at 05:15:30PM +0100, Lutz Steinborn wrote:
> every time then we are getting an object from the database
> (postgres) with myClass.select(myQuery) two queries are in the
> DB log. The first on did an "select count(*)" and the second
> gets the data with limit.
Really? It is not so for me with SQLObject 0.7.3. The following simple
program
from sqlobject import *
from sqlobject.sqlbuilder import *
__connection__ = "postgres:/test?debug=1"
class Test(SQLObject):
dt = DateTimeCol()
Test.createTable()
from datetime import datetime
Test(dt=datetime(1967, 12, 21))
Test(dt=datetime(1984, 1, 1))
print list(Test.select())
produces the following output:
1/Query : CREATE TABLE test (
id SERIAL PRIMARY KEY,
dt TIMESTAMP
)
1/COMMIT : auto
1/QueryIns: INSERT INTO test (id, dt) VALUES (1, '1967-12-21 00:00:00')
1/COMMIT : auto
1/QueryOne: SELECT dt FROM test WHERE id = (1)
1/COMMIT : auto
1/QueryIns: INSERT INTO test (id, dt) VALUES (2, '1984-01-01 00:00:00')
1/COMMIT : auto
1/QueryOne: SELECT dt FROM test WHERE id = (2)
1/COMMIT : auto
1/Select : SELECT test.id, test.dt FROM test WHERE 1 = 1
1/COMMIT : auto
[<Test 1L dt='datetime.datetime...)'>, <Test 2L dt='datetime.datetime...)'>]
One SELECT for Test.select().
> As far as I know you can get the row counting after the query
> with psycopg.
Patches will be gladly accepted.
Oleg.
--
Oleg Broytmann http://phd.pp.ru/ [EMAIL PROTECTED]
Programmers don't die, they just GOSUB without RETURN.
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss