On Mon, Dec 11, 2006 at 11:48:29AM -0500, David Turner wrote:
> Code:
> from sqlobject import *
> from sqlobject.inheritance import InheritableSQLObject
>
> __connection__ = "sqlite:/:memory:?debug=t"
>
> class Role(InheritableSQLObject):
> department = StringCol()
> persons = RelatedJoin("Person")
>
> class Student(Role):
> year = IntCol()
>
> class Person(SQLObject):
> name = StringCol()
> age = FloatCol()
> roles = RelatedJoin("Role")
>
> Role.createTable()
> Student.createTable()
> Person.createTable()
>
> first_year = Student(department="CS", year=1)
>
> student = Person(name="A student", age=21)
> student.addRole(first_year)
>
> print Student.select().max('year')
>
> ----
> Here's the SQL for that last statement:
> 12/QueryOne: SELECT MAX(year) FROM role WHERE ((role.child_name) =
> ('Student'))
> 12/QueryR : SELECT MAX(year) FROM role WHERE ((role.child_name) =
> ('Student'))
>
> ----
> This gives an error, because year isn't a column in the 'role' table.
>
> The SQL should be 'SELECT MAX(year) FROM student'.
A bug in the inheritance - it doesn't handle RelatedJoin.
Oleg.
--
Oleg Broytmann http://phd.pp.ru/ [EMAIL PROTECTED]
Programmers don't die, they just GOSUB without RETURN.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss