On Wed, Mar 04, 2009 at 10:31:31AM +0000, [email protected] wrote:
> from sqlobject import *
>
> class titles( SQLObject ):
>
> title_id = IntCol()
> title = StringCol()
>
> class sqlmeta:
> print 'class sqlmeta'
> idName = 'title_id'
[skip]
> newKey = 1234
> newTitle = "Mystery Book"
> book_b = titles.titles(title_id=newKey, title=newTitle)
Throughout entire SQLObject the 'id' column is called 'id'. After you
named your column 'title_id' in sqlmeta you have to use 'id' name for the
column:
book_b = titles.titles(id=newKey, title=newTitle)
Without that SQLObject thinks id is None and creates a new id by asking
the backend - see sqlobject/sybase/sybaseconnection.py, methods
_queryInsertId() and insert_id(). insert_id() creates a new id (0) and then
SQLObject tries to SELECT the row back by that id.
Oleg.
--
Oleg Broytmann http://phd.pp.ru/ [email protected]
Programmers don't die, they just GOSUB without RETURN.
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss