001/* 002 * Copyright (c) 2009 The openGion Project. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 013 * either express or implied. See the License for the specific language 014 * governing permissions and limitations under the License. 015 */ 016package org.opengion.hayabusa.db; 017 018import java.sql.Connection; 019import java.sql.ResultSet; 020import java.sql.SQLException; 021 022import org.opengion.fukurou.db.Transaction; 023import org.opengion.fukurou.db.ConnectionFactory; // 5.3.8.0 (2011/08/01) 024import org.opengion.fukurou.util.ErrorMessage; 025import org.opengion.hayabusa.common.HybsSystem; 026import org.opengion.hayabusa.common.HybsSystemException; 027import org.opengion.hayabusa.resource.ResourceManager; 028 029/** 030 * Query インターフェースを継承した Query の実装クラスです。 031 * クエリークラスにステートメントを与えて execute()することにより内部に DBTableModel を 032 * 作成します。 033 * このクラスは、Abstract クラスのため、実装は個々のサブクラスで行います。 034 * 唯一実装する必要があるのは, execute() メソッドだけです。 035 * 036 * @og.group DB検索 037 * @og.group DB登録 038 * 039 * @version 4.0 040 * @author Kazuhiko Hasegawa 041 * @since JDK5.0, 042 */ 043public class AbstractQuery implements Query { 044 private Connection connection = null ; 045 private Transaction transaction = null ; // 5.1.9.0 (2010/08/01) 046 private int rtnCode = ErrorMessage.OK; 047 private ErrorMessage errMessage = null; 048 private ResourceManager resource = null; 049 050 private DBTableModel table = null; 051 private String connID = null; 052 private String stmtString = null; 053 private int executeCount = -1 ; 054 private int skipRowCount = 0 ; 055 private int maxRowCount = HybsSystem.sysInt( "DB_MAX_ROW_COUNT" ) ; 056 private boolean updateFlag = true ; 057 private DBEditConfig config = null; // 5.3.6.0 (2011/06/01) 058 059 // 5.1.9.0 (2010/08/01) DB_RETRY_COUNT,DB_RETRY_TIME 廃止 060 protected static final int DB_MAX_QUERY_TIMEOUT = HybsSystem.sysInt( "DB_MAX_QUERY_TIMEOUT" ) ; 061 062 // 3.5.2.0 (2003/10/20) 内部オブジェクトタイプ名を システムパラメータ で定義します。 063 /** 内部オブジェクトタイプ名 {@value} */ 064 public static final String ARG_ARRAY = "ARG_ARRAY" ; 065 /** 内部オブジェクトタイプ名 {@value} */ 066 public static final String SYSARG_ARRAY = "SYSARG_ARRAY" ; 067 /** 内部オブジェクトタイプ名 {@value} */ 068 public static final String ERR_MSG = "ERR_MSG" ; 069 /** 内部オブジェクトタイプ名 {@value} */ 070 public static final String ERR_MSG_ARRAY = "ERR_MSG_ARRAY" ; 071 072 /** 073 * Queryオブジェクトを初期化します。 074 * これは、QueryFactory のプールから取り出すときに(または戻すとき)に 075 * 初期化するのに使用します。 076 * 077 * @og.rev 3.1.1.0 (2003/03/28) 同期メソッド(synchronized付き)を非同期に変更する。 078 * @og.rev 3.8.7.0 (2006/12/15) アクセスログ取得の為,ApplicationInfoオブジェクトを設定 079 * @og.rev 5.1.9.0 (2010/08/01) transaction 属性(外部Transactionの使用)追加 080 * @og.rev 5.3.6.0 (2011/06/01) DBEditConfig 追加 081 * 082 */ 083 public void init() { 084 close(); // 先にクローズ処理を行います。(transaction = null がセット) 085 rtnCode = ErrorMessage.OK; 086 errMessage = null; 087 resource = null; 088 table = null; 089 connID = null; 090 stmtString = null; 091 executeCount = -1 ; 092 skipRowCount = 0 ; 093 maxRowCount = HybsSystem.sysInt( "DB_MAX_ROW_COUNT" ) ; 094 updateFlag = true ; 095 connection = null; // 5.1.9.0 (2010/08/01) キャッシュの初期化 096 config = null; // 5.3.6.0 (2011/06/01) DBEditConfig追加 097 } 098 099 /** 100 * ステートメント文字列をセットします。 101 * 102 * @og.rev 3.1.1.0 (2003/03/28) 同期メソッド(synchronized付き)を非同期に変更する。 103 * 104 * @param stmt ステートメント文字列 105 * 106 */ 107 public void setStatement( final String stmt ) { 108 this.stmtString = stmt.trim(); 109 } 110 111 /** 112 * ステートメント文字列を取り出します。 113 * 114 * @return ステートメント文字列 115 * 116 */ 117 public String getStatement() { 118 return stmtString; 119 } 120 121 /** 122 * クエリーを実行します。 123 * 実行方法等は各サブクラスの実装に依存します。 124 * セットされているステートメント文字列とそのタイプが合っていない場合は, 125 * エラーになります。 126 * 実行結果は、DBTableModel にセットされます。 127 * 実行結果の件数は #getExecuteCount() で取得できます。 128 * ※ このクラスでは実装されていません。 129 * 130 * @og.rev 3.1.1.0 (2003/03/28) 同期メソッド(synchronized付き)を非同期に変更する。 131 * 132 */ 133 public void execute() { 134 String errMsg = "このクラスでは実装されていません。execute()"; 135 throw new UnsupportedOperationException( errMsg ); 136 } 137 138 /** 139 * 引数配列付のクエリーを実行します。 140 * 処理自体は, #execute() と同様に、各サブクラスの実装に依存します。 141 * これは、PreparedQuery で使用する引数を配列でセットするものです。 142 * select * from emp where deptno = ? and job = ? などの PreparedQuery や 143 * { call xxxx( ?,?,? ) } などの CallableStatement の ? 部分の引数を 144 * 順番にセットしていきます。 145 * ※ このクラスでは実装されていません。 146 * 147 * @param args オブジェクトの引数配列 148 */ 149 public void execute( final String[] args ) { 150 String errMsg = "このクラスでは実装されていません。execute( String[] )"; 151 throw new UnsupportedOperationException( errMsg ); 152 } 153 154 /** 155 * 引数配列付のクエリーを実行します。 156 * 処理自体は, #execute() と同様に、各サブクラスの実装に依存します。 157 * これは、PreparedQuery で使用する引数を配列でセットするものです。 158 * select * from emp where deptno = ? and job = ? などの PreparedQuery の 159 * ? 部分の引数を 160 * 順番にセットしていきます。 161 * ※ このクラスでは実装されていません。 162 * 163 * @og.rev 4.0.0.0 (2005/01/31) 新規追加 164 * 165 * @param keys オブジェクトのキー配列 166 * @param args オブジェクトの引数配列 167 */ 168 public void execute( final String[] keys, final String[] args ) { 169 String errMsg = "このクラスでは実装されていません。execute( String[],String[] )"; 170 throw new UnsupportedOperationException( errMsg ); 171 } 172 173 /** 174 * 引数配列付のクエリーを実行します。 175 * 処理自体は, #execute() と同様に、各サブクラスの実装に依存します。 176 * これは、PreparedQuery で使用する引数を配列でセットするものです。 177 * select * from emp where deptno = ? and job = ? などの PreparedQuery の 178 * ? 部分の引数を 179 * 順番にセットしていきます。 180 * ※ このクラスでは実装されていません。 181 * 182 * @og.rev 4.0.0.0 (2005/01/31) 引数をすべて受け取って実行するメソッドを標準メソッドとして追加 183 * 184 * @param names カラム名(CSV形式) 185 * @param dbArrayType アレイタイプ名称 186 * @param sysArg DBSysArg配列 187 * @param userArg DBUserArg配列 188 */ 189 public void execute( final String names,final String dbArrayType, 190 final DBSysArg[] sysArg,final DBUserArg[] userArg ) { 191 String errMsg = "このクラスでは実装されていません。execute( String,String,DBSysArg[],DBUserArg[] )"; 192 throw new UnsupportedOperationException( errMsg ); 193 } 194 195 /** 196 * 引数配列付のクエリーを実行します。 197 * 処理自体は, #execute() と同様に、各サブクラスの実装に依存します。 198 * これは、PreparedQuery で使用する引数を配列でセットするものです。 199 * select * from emp where deptno = ? and job = ? などの PreparedQuery の 200 * [カラム名] 部分の引数を、DBTableModelから順番にセットしていきます。 201 * ※ このクラスでは実装されていません。 202 * 203 * @param rowNo 選択された行番号配列(登録する対象行) 204 * @param table DBTableModelオブジェクト(登録する元データ) 205 */ 206 public void execute( final int[] rowNo, final DBTableModel table ) { 207 String errMsg = "このクラスでは実装されていません。execute( final int[] rowNo, final DBTableModel table )"; 208 throw new UnsupportedOperationException( errMsg ); 209 } 210 211 /** 212 * コミットを行います。 213 * 214 * 外部からコネクションが与えられた場合は、何も行いません。 215 * 216 * @og.rev 3.1.1.0 (2003/03/28) 同期メソッド(synchronized付き)を非同期に変更する。 217 * @og.rev 3.8.0.8 (2005/10/03) エラーメッセージの出力順をメッセージ+Queryに変更します。 218 * @og.rev 5.1.9.0 (2010/08/01) transaction 属性追加。 219 * 220 */ 221 public void commit() { 222 if( transaction == null ) { return; } 223 224 if( !transaction.commit() ) { 225 transaction.rollback(); 226 realClose(); 227 String errMsg = "コミットすることが出来ませんでした。" + HybsSystem.CR 228 + getStatement() + HybsSystem.CR ; 229 throw new HybsSystemException( errMsg ); 230 } 231 } 232 233 /** 234 * ロールバックを行います。 235 * 236 * 外部からコネクションが与えられた場合は、何も行いません。 237 * 238 * @og.rev 3.1.1.0 (2003/03/28) 同期メソッド(synchronized付き)を非同期に変更する。 239 * @og.rev 3.8.0.8 (2005/10/03) エラーメッセージの出力順をメッセージ+Queryに変更します。 240 * @og.rev 5.1.9.0 (2010/08/01) transaction 属性追加。 241 * 242 */ 243 public void rollback() { 244 if( transaction == null ) { return; } 245 246 if( !transaction.rollback() ) { 247 realClose(); 248 String errMsg = "ロールバックすることが出来ません。" + HybsSystem.CR 249 + getStatement() + HybsSystem.CR ; 250 throw new HybsSystemException( errMsg ); 251 } 252 } 253 254 /** 255 * 使用した Statementオブジェクトをクロースし、Connection オブジェクトを 256 * プールに返します。 257 * 主に、正常終了した場合のクローズ処理になります。 258 * 259 * 外部からコネクションが与えられた場合は、何も行いません。 260 * 261 * @og.rev 3.1.1.0 (2003/03/28) 同期メソッド(synchronized付き)を非同期に変更する。 262 * @og.rev 3.6.0.4 (2004/10/14) SQLWarning の取得(getWarning)をコメントアウトします。 263 * @og.rev 5.1.9.0 (2010/08/01) transaction 属性追加。 264 * @og.rev 5.3.8.0 (2011/08/01) Transaction発生箇所でclose()するため、ここではclose() しない。 265 * 266 */ 267 public void close() {} 268 269 /** 270 * Connection オブジェクトを実際にクローズ(破棄)します。 271 * プールからも削除します。 272 * 実行時エラー等が発生したときに、このメソッドを呼び出します。 273 * 274 * 外部からコネクションが与えられた場合は、何も行いません。 275 * 276 * @og.rev 3.1.1.0 (2003/03/28) 同期メソッド(synchronized付き)を非同期に変更する。 277 * @og.rev 5.1.9.0 (2010/08/01) transaction 属性追加。 278 * @og.rev 5.3.8.0 (2011/08/01) Transaction発生箇所でclose()するため、ここではclose() しない。 279 * 280 */ 281 public void realClose() {} 282 283 /** 284 * クエリーの実行結果件数をセットします。 285 * 初期値は -1 です。(クエリーが失敗した場合や,CallableStatement の呼び出し等で 286 * 実行件数が明確でない場合の戻り値)。 287 * 288 * @og.rev 3.1.1.0 (2003/03/28) 同期メソッド(synchronized付き)を非同期に変更する。 289 * 290 * @param executeCount 実行結果件数 291 */ 292 protected void setExecuteCount( final int executeCount ) { 293 this.executeCount = executeCount; 294 } 295 296 /** 297 * クエリーの実行結果を返します。 298 * クエリーが失敗した場合や,CallableStatement の呼び出し等で実行件数が明確でない 299 * 場合は, -1 が返されます。 300 * 301 * @return 実行結果件数 302 */ 303 public int getExecuteCount() { 304 return executeCount; 305 } 306 307 /** 308 * DBTableModel をセットします。 309 * なお、検索系実行前に setDBTableModel() でテーブルをセットしていたとしても 310 * そのオブジェクトは破棄されて、新しい DBTableModel が生成されます。 311 * 312 * @og.rev 3.1.1.0 (2003/03/28) 同期メソッド(synchronized付き)を非同期に変更する。 313 * 314 * @param table DBTableModelオブジェクト 315 */ 316 protected void setDBTableModel( final DBTableModel table ) { 317 this.table = table; 318 } 319 320 /** 321 * 実行結果の DBTableModel を返します。 322 * 323 * @return DBTableModelオブジェクト 324 */ 325 public DBTableModel getDBTableModel() { 326 return table; 327 } 328 329 /** 330 * データベースの最大検索件数を返します。 331 * (初期値:DB_MAX_ROW_COUNT[={@og.value org.opengion.hayabusa.common.SystemData#DB_MAX_ROW_COUNT}])。 332 * データベース自体の検索は,指定されたSQLの全件を検索しますが, 333 * DBTableModelのデータとして登録する最大件数をこの値に設定します。0は無制限です。 334 * サーバーのメモリ資源と応答時間の確保の為です。 335 * 336 * @return 最大検索件数 337 */ 338 public int getMaxRowCount() { 339 return maxRowCount; 340 } 341 342 /** 343 * データベースの最大検索件数をセットします。 344 * データベース自体の検索は,指定されたSQLの全件を検索しますが, 345 * DBTableModelのデータとして登録する最大件数をこの値に設定します。 346 * サーバーのメモリ資源と応答時間の確保の為です。 347 * ゼロ、または、負の値を設定すると、無制限(Integer.MAX_VALUE)になります。 348 * 349 * @og.rev 3.1.1.0 (2003/03/28) 同期メソッド(synchronized付き)を非同期に変更する。 350 * @og.rev 4.0.0.0 (2005/08/31) ゼロ、または、負の値は、無制限(Integer.MAX_VALUE)にする。 351 * 352 * @param maxRowCount 最大検索件数 353 */ 354 public void setMaxRowCount( final int maxRowCount ) { 355 this.maxRowCount = ( maxRowCount > 0 ) ? maxRowCount : Integer.MAX_VALUE ; 356 } 357 358 /** 359 * データベースの検索スキップ件数を返します。 360 * データベース自体の検索は,指定されたSQLの全件を検索しますが, 361 * DBTableModelのデータとしては、スキップ件数分は登録されません。 362 * サーバーのメモリ資源と応答時間の確保の為です。 363 * 364 * @return 最大検索件数 365 */ 366 public int getSkipRowCount() { 367 return skipRowCount; 368 } 369 370 /** 371 * データベースの検索スキップ件数をセットします。 372 * データベース自体の検索は,指定されたSQLの全件を検索しますが, 373 * DBTableModelのデータとしては、スキップ件数分は登録されません。 374 * サーバーのメモリ資源と応答時間の確保の為です。 375 * 376 * @og.rev 3.1.1.0 (2003/03/28) 同期メソッド(synchronized付き)を非同期に変更する。 377 * 378 * @param skipRowCount スキップ件数 379 */ 380 public void setSkipRowCount( final int skipRowCount ) { 381 this.skipRowCount = skipRowCount; 382 } 383 384 /** 385 * アップデートフラグをセットします。 386 * これは、Query で更新処理の SQL 文を実行したときにセットされます。 387 * 更新処理が実行:true / 検索処理のみ:false をセットします。 388 * このメソッドを呼び出さない場合は、デフォルト:true です。 389 * 390 * @og.rev 2.1.2.3 (2002/12/02) データベース更新時に、更新フラグをセットするように変更 391 * @og.rev 3.1.1.0 (2003/03/28) 同期メソッド(synchronized付き)を非同期に変更する。 392 * 393 * @param up アップデートされたかどうか[true:更新処理/false:検索処理] 394 */ 395 protected void setUpdateFlag( final boolean up ) { 396 updateFlag = up; 397 } 398 399 /** 400 * アップデートフラグを取得します。 401 * これは、Query で更新処理の SQL 文を実行したときに true にセットされます。 402 * 更新処理が実行:true / 検索処理のみ:false を取得できます。 403 * 404 * @og.rev 2.1.2.3 (2002/12/02) データベース更新時に、更新フラグをセットするように変更 405 * @og.rev 4.0.0.0 (2007/07/20) メソッド名変更( getUpdateFlag() ⇒ isUpdate() ) 406 * 407 * @return アップデートされたかどうか[true:更新処理/false:検索処理] 408 */ 409 public boolean isUpdate() { 410 return updateFlag ; 411 } 412 413 /** 414 * リソースマネージャーをセットします。 415 * これは、言語(ロケール)に応じた DBColumn をあらかじめ設定しておく為に 416 * 必要です。 417 * リソースマネージャーが設定されていない、または、所定のキーの DBColumn が 418 * リソースに存在しない場合は、内部で DBColumn オブジェクトを作成します。 419 * 420 * @og.rev 4.0.0.0 (2005/01/31) lang ⇒ ResourceManager へ変更 421 * 422 * @param resource リソースマネージャー 423 */ 424 public void setResourceManager( final ResourceManager resource ) { 425 this.resource = resource; 426 } 427 428 /** 429 * エラーコード を取得します。 430 * エラーコード は、ErrorMessage クラスで規定されているコードです。 431 * 432 * @return エラーコード 433 */ 434 public int getErrorCode() { return rtnCode; } 435 436 /** 437 * エラーコード をセットします。 438 * エラーコード は、ErrorMessage クラスで規定されているコードです。 439 * 440 * @param cd エラーコード 441 */ 442 protected void setErrorCode( final int cd ) { rtnCode = cd; } 443 444 /** 445 * エラーメッセージオブジェクト を取得します。 446 * 447 * @return エラーメッセージオブジェクト 448 */ 449 public ErrorMessage getErrorMessage() { return errMessage; } 450 451 /** 452 * エラーメッセージオブジェクト をセットします。 453 * 454 * @param em エラーメッセージオブジェクト 455 */ 456 protected void setErrorMessage( final ErrorMessage em ) { errMessage = em; } 457 458 /** 459 * エディット設定オブジェクトをセットします。 460 * 461 * @og.rev 5.3.6.0 (2011/06/01) 新規追加 462 * 463 * @param config エディット設定オブジェクト 464 */ 465 public void setEditConfig( final DBEditConfig config ) { 466 this.config = config; 467 } 468 469 /** 470 * エディット設定オブジェクトを取得します。 471 * 472 * @og.rev 5.3.6.0 (2011/06/01) 新規追加 473 * 474 * @return エディット設定オブジェクト 475 */ 476 protected DBEditConfig getEditConfig() { 477 return config; 478 } 479 480 ////////////////////////////////////////////////////////////////////////// 481 // 482 // 継承時にサブクラスから使用するメソッド類( protected ) 483 // 484 ////////////////////////////////////////////////////////////////////////// 485 486 /** 487 * ResultSet を DBTableModelに割り当てます。 488 * 489 * 毎回,検索毎に,DBTableModel にコピーするイメージです。 490 * ResulSet 以外のオブジェクトから,DBTableModelを作成する場合は, 491 * このメソッドをオーバーライドします。 492 * 493 * このメソッドは, execute からのみ,呼び出されます。 494 * それ以外からは呼出し出来ません。 495 * 496 * @og.rev 3.1.1.0 (2003/03/28) 同期メソッド(synchronized付き)を非同期に変更する。 497 * @og.rev 3.3.3.3 (2003/08/06) カラムのラベル名を、大文字に変換する。 498 * @og.rev 3.8.5.0 (2006/03/02) CLOB カラムかどうかを判定しCLOBの場合は、Clob オブジェクトから文字列を取り出します。 499 * @og.rev 3.8.8.8 (2007/05/11) ROWID対応(小数点対応 "0.3" が ".3" と表示される対策) 500 * @og.rev 4.0.0.0 (2006/01/31) CLOB カラムかどうかを判定しCLOBの場合は、ストリームから値を取り出します。 501 * @og.rev 5.3.6.0 (2011/06/01) DBTableModel作成処理をDBTableModelUtilに移動&集計機能対応 502 * 503 * @param resultSet ResultSetオブジェクト 504 */ 505 protected void createTableModel( final ResultSet resultSet ) { 506 try { 507 if( config == null ) { 508 table = DBTableModelUtil.makeDBTable( resultSet, getSkipRowCount(), maxRowCount, resource ); 509 } 510 else { 511 table = DBTableModelUtil.makeEditDBTable( resultSet, getSkipRowCount(), maxRowCount, resource, config ); 512 } 513 514 setExecuteCount( table.getRowCount() ); 515 } 516 catch( SQLException ex ) { 517 realClose(); 518 String errMsg = "テーブルモデルを作成できませんでした。"; 519 throw new HybsSystemException( errMsg,ex ); // 3.5.5.4 (2004/04/15) 引数の並び順変更 520 } 521 } 522 523 /** 524 * ConnectionFactory.connection( String ); を利用して,Connection 525 * オブジェクトを取り出します。 526 * 527 * コネクションプールが一杯の場合は、即エラーになります。 528 * 529 * @og.rev 3.1.1.0 (2003/03/28) 同期メソッド(synchronized付き)を非同期に変更する。 530 * @og.rev 3.8.7.0 (2006/12/15) アクセスログ取得の為,ApplicationInfoオブジェクトを設定 531 * @og.rev 5.1.9.0 (2010/08/01) transaction 属性追加。 532 * 533 * @return コネクション 534 */ 535 protected Connection getConnection() { 536 if( connection == null ) { 537 // 5.1.9.0 (2010/08/01) transaction 属性追加。 538 if( transaction == null ) { 539 String errMsg = "Transaction をセットする前に、コネクションを取り出す要求がなされました。" 540 + HybsSystem.CR 541 + "connID = [" + connID + "]" ; 542 throw new HybsSystemException( errMsg ); 543 } 544 else { 545 connection = transaction.getConnection( connID ); 546 } 547 } 548 549 return connection; 550 } 551 552 /** 553 * Transactionオブジェクトを外部から設定します。 554 * 555 * 通常は、ConnectionFactory を使用して、内部で Connection を作成しますが、 556 * 一連のトランザクション処理を実施するには、外部から Transactionオブジェクトを 557 * を与えて、そこから、Connection を取り出す必要があります。 558 * 559 * ここでは、内部の connection が存在しない場合に限り、セットを許可します。 560 * 561 * @og.rev 5.1.9.0 (2010/08/01) 新規追加 562 * 563 * @param connID 接続先ID 564 * @param tran Transactionオブジェクト 565 */ 566 public void setTransaction( final String connID , final Transaction tran ) { 567 if( transaction == null ) { 568 transaction = tran; 569 this.connID = connID; 570 } 571 else { 572 String errMsg = "トランザクションは、すでに設定済みです。" 573 + HybsSystem.CR 574 + "connID = [" + connID + "]" ; 575 throw new HybsSystemException( errMsg ); 576 } 577 } 578 579 /** 580 * connection オブジェクトから,ワーニングデータを取り出します。 581 * 582 * ワーニングデータは,SQLWarning クラスのオブジェクトに複数件貯えられます。 583 * query 実行後に,確認しておく必要があります。 584 * 585 * このメソッドは, execute からのみ,呼び出されます。 586 * それ以外からは呼出し出来ません。 587 * 588 * @param connection Connection 589 * 590 * @return ワーニング ErrorMessage 591 */ 592 // protected ErrorMessage getWarning( final Connection connection ) { 593 // if( connection == null ) { return null; } 594 // 595 // try { 596 // ErrorMessage em = new ErrorMessage(); 597 // for( SQLWarning warning = connection.getWarnings(); 598 // warning != null ; 599 // warning = warning.getNextWarning() ) { 600 // em.addMessage( 0,ErrorMessage.WARNING,warning.getMessage(),warning.getSQLState() ); 601 // } 602 // return em; 603 // } 604 // catch (SQLException ex) { 605 // realClose(); 606 // String errMsg = "ワーニングを取り出すことが出来ませんでした。"; 607 // errMsg += System.getProperty( "line.separator" ); 608 // errMsg += ex.getMessage() + ":" + ex.getSQLState(); 609 // throw new HybsSystemException( errMsg,ex ); // 3.5.5.4 (2004/04/15) 引数の並び順変更 610 // } 611 // } 612 613 /** 614 * この接続が、PreparedStatement#getParameterMetaData() を使用するかどうかを判定します。 615 * 616 * ConnectionFactory#useParameterMetaData(String) の結果を返します。(postgreSQL対応) 617 * 618 * @og.rev 5.3.8.0 (2011/08/01) 新規追加 619 * 620 * @return 使用する場合:true / その他:false 621 * @see org.opengion.fukurou.db.ConnectionFactory#useParameterMetaData(String) 622 */ 623 protected boolean useParameterMetaData() { 624 return ConnectionFactory.useParameterMetaData( connID ); 625 } 626 627 ////////////////////////////////////////////////////////////////////////// 628 // 629 // Object クラスのオーバーライド部分 630 // 631 ////////////////////////////////////////////////////////////////////////// 632 633 /** 634 * オブジェクトの識別子として,最後のクエリーを返します。 635 * 636 * @return 最後のクエリー 637 */ 638 @Override 639 public String toString() { 640 return "LastQuery :[" + getStatement() + "] "; 641 } 642}