> On Nov 29, 2014, at 4:09 AM, Aristedes Maniatis <[email protected]> wrote:
> 
> On 29/11/2014 1:01am, Andrus Adamchik wrote:
>> Just added another flavor of select method - 'selectFirst'. Unlike 
>> 'selectOne' intended for queries that expect at most one row back, 
>> 'selectFirst' is a quick way to get the top-of-the-list object, even if the 
>> query matched many objects. I.e. it is equivalent to 
>> "limit(1).selectOne(context)".
> 
> * Does selectOne() throw an exception if it gets back more than one row? Is 
> that the main difference between the functions for a user?

Correct.

> * For performance reasons, should selectOne put LIMIT 2 into the SQL since it 
> will only discard additional objects anyway?

We may. Though since it throws in such cases, it would only be relevant if 
there's a programmer error (query syntax implies > 1 row) or ref integrity 
problem in DB (no unique constraint where it is expected), so this has never 
been a problem in practice.

Andrus

Reply via email to