commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henri Yandell" <flame...@gmail.com>
Subject Re: Common DbUtils
Date Wed, 27 Aug 2008 19:18:53 GMT
Ah I see.

You build the ? marks up using something like
StringUtils.repeat(",?").substring(1).

I don't think we have named parameters in there - though Brian
McCallister's JDBI does and might be worth a look:

 http://jdbi.org/

Hen

On Wed, Aug 27, 2008 at 12:12 AM, santurelli@inwind.it
<santurelli@inwind.it> wrote:
> But I have only one paramter in query. I can't pass an array parameter.
> Again, the number of parameter is unknown and for this I use the IN statement in sql.
>
> Thanks,
> Pietro
>
>
>
>> Try:
>>
>> String[] params = {"1", "2"};
>>
>> Hen
>>
>> On Mon, Aug 25, 2008 at 2:12 PM, Pietro Santurelli <santurelli@inwind.it> wrote:
>> > Hi all,
>> > I'm using common DbUtils 1.1 to execute this query:
>> > SELECT column1 FROM table WHERE id_table IN (?).
>> >
>> > Java fragment code is:
>> > String params = "1,2";
>> > String query = "SELECT column1 FROM table WHERE id_table IN (?)";
>> > QueryRunner qRunner = new QueryRunner();
>> > ArrayList<Store> stores =
>> > (ArrayList<Incasso>)qRunner.query(connection,query, params, new
>> > BeanListHandler(Store.class));
>> >
>> > The ArrayList obtained is populated only with stores with id = 1. In other
>> > words, the stores with id = 2 aren't retrieved. The semicolon seems to be
>> > the problem.
>> > Is this a bug of common DbUtils?
>> >
>> > Thanks in advance,
>> > Pietro
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>> > For additional commands, e-mail: user-help@commons.apache.org
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>> For additional commands, e-mail: user-help@commons.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message