On May 24, 2012, at 9:04 AM, Jacques Le Roux wrote:

> From: "Jacopo Cappellato" <jacopo.cappell...@hotwaxmedia.com>
>> On May 23, 2012, at 9:25 PM, Adam Heath wrote:
>> 
>>> On 05/23/2012 01:13 PM, Jacopo Cappellato wrote:
>>>> Using count() was simply a trick to be sure to get a record back even if 
>>>> the entity is empty... but if we use an entity that we are sure is 
>>>> populated we don't have to use it, of course. Of course if we use count(*) 
>>>> we have to use it in an entity with a very low number of rows... but I too 
>>>> would prefer to avoid it.
>>> 
>>> select 1;
>> 
>> Thank you Adam, this is the "trick" I was looking for when I mentioned 
>> option #3 in my first email.
>> I will test the system with it and then commit.
>> 
>> Jacopo
> 
> Which entity will you use Jacopo?

When I first saw Adam's comment I thought he was suggesting to simply execute

"select 1"

in order to run a "query" with no table to return a "record" with one field 
containing 1.
But I maybe misunderstood the suggestion and at least on Derby this doesn't 
seem to work; but I still need to fully test.
In my opinion adding a new entity for this would be an overkill; one solution 
could be the following:

select count(key_name) from entity_key_store where 1 = 2

that always returns one record and should be efficient on mostly all dbs.

Jacopo


> 
> Jacques 

Reply via email to