[postgresforest-users 29] Re: バッチ更新のサポートについて

Back to archive index

Satoshi.Nagatsuma nagat****@nttda*****
2007年 4月 3日 (火) 19:28:43 JST


長妻と申します。

executeBatchの件ですが、Forest4.0.1にて実際に確認してみたところ
確かにおっしゃるとおりの結果となりました。
ご報告ありがとうございます。

コードを確認してみたところ、暫定的な対処であれば
それほど大きな変更無く実現可能なようですので、
次回のマイナーバージョンアップの段階で含める予定です。


以上、よろしくお願いいたします。


Akio KUDOH wrote:
> 度々すみません。工藤と申します。
> 
> DatabaseMetadata#supportsBatchUpdates()の結果はtrueとなりますが、
> バッチ更新はサポートされていませんでしょうか。
> 
> JavaプログラムからPostgresForestへバッチ更新を行うと、
> INSERT/UPDATE/DELETEが完了しないようです。
> Statement#executeBatch()の返却結果である更新件数が、全てゼロと
> なり、DBにも更新結果が反映されません。
> 
> 以下、再現ソースとなります。
> import java.sql.*;
> public class BatchSql {
>   public static void main(String[] args) throws Exception {
>     Class.forName("org.postgresforest.Driver");
>     Connection conn = DriverManager.getConnection(
>     "jdbc:postgresforest:GSC=//sv1:5432/gsc @ sample","user","pass");
>     conn.setAutoCommit(false);
>     Statement stmt = conn.createStatement();
>     // テーブル仕様: create table a(b varchar);
>     stmt.addBatch("INSERT INTO a (b) VALUES ('foo')");
>     stmt.addBatch("INSERT INTO a (b) VALUES ('bar')");
>     int[] cnt = stmt.executeBatch();
>     for (int i = 0; i < cnt.length; i++) {
>       // Postgres直接接続だと1が、PostgresForestだと0が返る
>       System.out.println(cnt[i]);
>     }
>     conn.commit();
>     stmt.close();
>     conn.close();
>   }
> }
> 
> PostgresForestはバージョン4.0.1を使用しております。
> よろしくお願いいたします。
> 
> _______________________________________________
> postgresforest-users mailing list
> postg****@lists*****
> http://lists.sourceforge.jp/mailman/listinfo/postgresforest-users
> 




postgresforest-users メーリングリストの案内
Back to archive index