You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@empire-db.apache.org by Ivan Nemeth <iv...@gmail.com> on 2015/09/11 12:49:54 UTC
Problem with DBCommand.addWhereConstraints
Hi,
if you add an empty constraint list to DBCommand through
addWhereConstraints, the resulting sql will end with an empty WHERE.
Example:
DBCommand cmd = db.createCommand();
cmd.select(TABLE.getColumns());
cmd.addWhereConstraints(new ArrayList());
The generated sql will be something like this:
"SELECT t0.name FROM table t0 WHERE"
Since we use dynamically built queries we have to check every time whether
the constraint list is empty.
I think a check for an empty list either in DBCommand.addWhereConstraint
method or in DBCommand.addWhere(Stringbuffer...) method would solve this
issue.
Regards,
Ivan
Re: Problem with DBCommand.addWhereConstraints
Posted by ivan nemeth <iv...@forumdigital.net>.
Done.
https://issues.apache.org/jira/browse/EMPIREDB-226
Thanks,
Ivan
On Fri, Sep 11, 2015 at 12:55 PM, Francis De Brabandere <francisdb@gmail.com
> wrote:
> Hi Ivan,
>
> indeed sounds like a good idea, would you mind creating a ticket for this?
> https://issues.apache.org/jira/browse/EMPIREDB
>
> Cheers,
> Francis
>
>
> On 11 September 2015 at 12:49, Ivan Nemeth <iv...@gmail.com> wrote:
>
>> Hi,
>>
>> if you add an empty constraint list to DBCommand through
>> addWhereConstraints, the resulting sql will end with an empty WHERE.
>>
>> Example:
>>
>> DBCommand cmd = db.createCommand();
>> cmd.select(TABLE.getColumns());
>> cmd.addWhereConstraints(new ArrayList());
>>
>> The generated sql will be something like this:
>>
>> "SELECT t0.name FROM table t0 WHERE"
>>
>> Since we use dynamically built queries we have to check every time
>> whether the constraint list is empty.
>>
>> I think a check for an empty list either in DBCommand.addWhereConstraint
>> method or in DBCommand.addWhere(Stringbuffer...) method would solve this
>> issue.
>>
>> Regards,
>> Ivan
>>
>
>
Re: Problem with DBCommand.addWhereConstraints
Posted by Francis De Brabandere <fr...@gmail.com>.
Hi Ivan,
indeed sounds like a good idea, would you mind creating a ticket for this?
https://issues.apache.org/jira/browse/EMPIREDB
Cheers,
Francis
On 11 September 2015 at 12:49, Ivan Nemeth <iv...@gmail.com> wrote:
> Hi,
>
> if you add an empty constraint list to DBCommand through
> addWhereConstraints, the resulting sql will end with an empty WHERE.
>
> Example:
>
> DBCommand cmd = db.createCommand();
> cmd.select(TABLE.getColumns());
> cmd.addWhereConstraints(new ArrayList());
>
> The generated sql will be something like this:
>
> "SELECT t0.name FROM table t0 WHERE"
>
> Since we use dynamically built queries we have to check every time whether
> the constraint list is empty.
>
> I think a check for an empty list either in DBCommand.addWhereConstraint
> method or in DBCommand.addWhere(Stringbuffer...) method would solve this
> issue.
>
> Regards,
> Ivan
>