pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: Angelo Neuschitzer <an@jenomics.net>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Strange behavoir of batches
Date: Tue, 13 Sep 2005 09:59:57 +1200
Message-ID: <4325FA5D.2060402@opencloud.com> (raw)
In-Reply-To: <43255EDB.6000306@jenomics.net>
References: <20050907165251.35F37F1098@svr2.postgresql.org>
	<43205847.8050405@archonet.com>
	<43255496.5020703@jenomics.net>
	<43255EDB.6000306@jenomics.net>

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



view thread (5+ messages)  latest in thread

Message-ID: <4325FA5D.2060402@opencloud.com>
Permalink:  ../4325FA5D.2060402@opencloud.com/
Also on:    postgresql.org/message-id/4325FA5D.2060402@opencloud.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: oliver@opencloud.com, an@jenomics.net
  Subject: Re: Strange behavoir of batches
  In-Reply-To: <4325FA5D.2060402@opencloud.com>
  References: <20050907165251.35F37F1098@svr2.postgresql.org> <43205847.8050405@archonet.com> <43255496.5020703@jenomics.net> <43255EDB.6000306@jenomics.net> <4325FA5D.2060402@opencloud.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox