On Tue, May 23, 2006 at 06:41:48PM +0100, Fadhley, Salim (FID) wrote:
> today = datetime.datetime.now()
You have forgotten to import datetime! ;)
> class Test( sqlobject.SQLObject ):
> name = sqlobject.StringCol( length=64 )
> startTime = sqlobject.DateTimeCol( )
>
> Test.createTable( ifNotExists = True )
>
> print repr( today )
>
> fod = Test( name="test object", startTime=today )
The program works for me like a charm. The output with SQLite:
1/QueryOne: SELECT tbl_name FROM sqlite_master WHERE type='table' AND
tbl_name = 'test'
1/QueryR : SELECT tbl_name FROM sqlite_master WHERE type='table' AND
tbl_name = 'test'
2/Query : CREATE TABLE test (
id INTEGER PRIMARY KEY,
name VARCHAR(64),
start_time TIMESTAMP
)
2/QueryR : CREATE TABLE test (
id INTEGER PRIMARY KEY,
name VARCHAR(64),
start_time TIMESTAMP
)
datetime.datetime(2006, 5, 23, 21, 48, 36, 980909)
3/QueryIns: INSERT INTO test (name, start_time) VALUES ('test object',
'2006-05-23 21:48:36')
4/QueryOne: SELECT name, start_time FROM test WHERE id = 1
4/QueryR : SELECT name, start_time FROM test WHERE id = 1
With Postgres:
1/QueryOne:
SELECT COUNT(relname) FROM pg_class
WHERE relname = 'test'
1/QueryR :
SELECT COUNT(relname) FROM pg_class
WHERE relname = 'test'
1/COMMIT : auto
1/Query : CREATE TABLE test (
id SERIAL PRIMARY KEY,
name VARCHAR(64),
start_time TIMESTAMP
)
1/QueryR : CREATE TABLE test (
id SERIAL PRIMARY KEY,
name VARCHAR(64),
start_time TIMESTAMP
)
1/COMMIT : auto
datetime.datetime(2006, 5, 23, 21, 51, 57, 635690)
1/QueryIns: INSERT INTO test (id, name, start_time) VALUES (1, 'test object',
'2006-05-23 21:51:57')
1/COMMIT : auto
1/QueryOne: SELECT name, start_time FROM test WHERE id = 1
1/QueryR : SELECT name, start_time FROM test WHERE id = 1
1/COMMIT : auto
Are you sure you have really installed 0.7.1b1?
Oleg.
--
Oleg Broytmann http://phd.pp.ru/ [EMAIL PROTECTED]
Programmers don't die, they just GOSUB without RETURN.
-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss