#18 Add selectOne and selectOneBy methods

closed-invalid
Oleg Broytman
None
5
2005-09-13
2005-07-12
Andrew Bennetts
No

This patch adds selectOne and selectOneBy methods to
SQLObject, and simple test cases for them.

ForeignKey columns and alternateID columns are great,
but don't satisfy all use-cases. There are times when
you need to use select or selectBy, but you also know
that your query can only ever return one (or zero)
rows. An example is any time you have an UNIQUE
constraint on multiple columns, and you do a selectBy
on the same set of columns.

selectOne and selectOneBy are designed to make this
situation as easy to deal with as possible.

At Canonical, we've played with this for some time and
found it to be a very valuable addition to SQLObject,
eliminating a lot of boilerplate code.

Discussion

  •  
    Attachments
  • Oleg Broytman
    Oleg Broytman
    2005-07-20

    • assigned_to: nobody --> phd
     
  • Oleg Broytman
    Oleg Broytman
    2005-07-20

    Logged In: YES
    user_id=4799

    The patch failed. Please recreate the patch against the
    latest version of SQLObject from the Subversion repository.

     
  • Oleg Broytman
    Oleg Broytman
    2005-09-13

    • status: open --> open-invalid
     
  • Oleg Broytman
    Oleg Broytman
    2005-09-13

    • status: open-invalid --> closed-invalid