Patches item #1341999, was opened at 2005-10-30 02:16
Message generated for change (Comment added) made by phd
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1341999&group_id=74338
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
>Status: Closed
>Resolution: Accepted
Priority: 5
Submitted By: Leandro Lucarella (llucax)
Assigned to: Oleg Broytmann (phd)
Summary: Adds by[IndexName] method for every unique index.
Initial Comment:
This is the summary of changes (copied from the patch).
User-visible Changes:
Now, fo each DatabaseIndex with unique=True you
have an extra method
by[IndexName] like by[AlternateID], that takes
as parameters the columns
used in the index. You can specify an extra
option when creating
DatabaseIndex, alternateMethodName, just like
with Columns with
alternateID=True.
Internal Changes:
Now dbconnection.DBAPI._SO_selectOneAlt() can
accept a sequence for
'column' and 'value' parameters. Both must have
the same len() and it's
mapped in the query as column[0] = value[0] AND
... column[N] = value[N]
index.SODatabaseIndex() constructor takes an
extra optional parameter
'alternateMethodName' wich is set by default to
by[IndexName].
main.sqlmeta.addIndex() now adds the proper
by[IndexName] method to
soClass, using
main.sqlmeta._SO_fetchAlternateID() to retrieve the data.
main.sqlmeta._SO_fetchAlternateID() now takes
an extra optional
parameter 'idxName' with the index name (when
it's called for an index)
for error reporting purpose. 'column' and
'value' parameters can accept
a sequence just like
dbconnection.DBAPI._SO_selectOneAlt().
----------------------------------------------------------------------
>Comment By: Oleg Broytmann (phd)
Date: 2005-11-02 23:36
Message:
Logged In: YES
user_id=4799
Applied at the revision 1192 to the trunk. Thank you!
----------------------------------------------------------------------
Comment By: Ian Bicking (ianbicking)
Date: 2005-10-31 20:06
Message:
Logged In: YES
user_id=210337
(copied from email comments)
I don't want anymore automatic addition of methods to
SQLObject classes -- I'm not very happy with the ones that
already exist.
Instead, I'd like index objects to become smarter, since
they are already being explicitly named and put on the class
as attributes. Potentially these objects could be callable,
or have a .get() method. So it would be like:
class Contact(SQLObject):
areaCode = StringCol()
number = StringCol()
phoneIndex = DatabaseIndex('areaCode', 'number',
unique=True)
Contact.phoneIndex.get('555', '555-5555')
# Also allowable:
Contact.phoneIndex.get(number='555-5555', areaCode='555')
----------------------------------------------------------------------
Comment By: Leandro Lucarella (llucax)
Date: 2005-10-30 02:20
Message:
Logged In: YES
user_id=240225
Here's a simple example of use.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1341999&group_id=74338
|