Gregor Horvath wrote:
> Ilias Lazaridis schrieb:
>> Gregor Horvath wrote:
>> ...
>>
>>> I don't want to define the name attribute in every single SQLObject class.
>>>
>>> I came up with a solution:
>>>
>>> class Person(SQLObject):
>>> name = StringCol()
>>>
>>> class Professor(Person, SQLObject):
>>> timetable = StringCol()
>>>
>>> class Student(Person, SQLObject):
>>> year = StringCol()
>>
>> I'm asking just out of curiosity:
>>
>> wouldn't the typical implementation be:
>>
>> class Person(SQLObject):
>> name = StringCol()
>>
>> class Professor(Person):
>> timetable = StringCol()
>>
>> class Student(Person):
>> year = StringCol()
>>
>> ?
>
> Yes, but this doesn't work because the tables are not generated by
> createTable if the object is not directly inherited from SQLObject.
I see, possibly this would work:
class SOAbstract(SQLObject):
pass
class Person(SOAbstract):
name = StringCol()
class Professor(Person, SQLObject):
timetable = StringCol()
class Student(Person, SQLObject):
year = StringCol()
> There's always room for improvement and patches are welcome
of course.
A simple way would possibly be to introduce a tag to the classes, which
createTable would check.
@noTable
class Professor(SQLObject)
...
.
--
http://lazaridis.com
-------------------------------------------------------------------------
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