Re: Strange behavoir of batches - Mailing list pgsql-jdbc

From Oliver Jowett
Subject Re: Strange behavoir of batches
Date
Msg-id 4325FA5D.2060402@opencloud.com
Whole thread Raw
In response to Strange behavoir of batches  (Angelo Neuschitzer <an@jenomics.net>)
Responses Re: Strange behavoir of batches  (Angelo Neuschitzer <an@jenomics.net>)
List pgsql-jdbc
Angelo Neuschitzer wrote:

>> PreparedStatemet pStmt = con.prepareStatement("INSERT INTO table_a
>> VALUES (...)");
>> for(0 to 93)
>> {
>>    [fill values into pStmt]
>>    if(not last row)
>>    {
>>       pStmt.addBatch();
>>    }
>> }
>> pStmt.executeBatch();
>> pStmt.clearBatch();

AFAIK, this "not last row" logic seems wrong. Calling executeBatch()
only executes those queries that have been added to the batch via
addBatch(), so the loop will lose the last INSERT.

-O

pgsql-jdbc by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: XADataSource implementation
Next
From: Oliver Jowett
Date:
Subject: Re: Strange behavoir of batches