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 */ 016 package org.opengion.hayabusa.db; 017 018 import org.opengion.fukurou.util.ErrMsg; 019 020 import java.sql.SQLData; 021 import java.sql.SQLInput; 022 import java.sql.SQLOutput; 023 import java.sql.SQLException; 024 025 /** 026 * SQLData インターフェースを継承した シス?変数の受け渡し用オブジェクトです? 027 * 行番号??と改?ード[A:追?C:変更/D:削除]を持って?す? 028 * 029 * @og.group エラー処? 030 * 031 * @version 4.0 032 * @author Kazuhiko Hasegawa 033 * @since JDK5.0, 034 */ 035 public class DBErrMsg implements SQLData { 036 private String sql_type ; 037 private ErrMsg errMsg ; 038 039 /** 040 * ?ォルトコンストラクター 041 */ 042 public DBErrMsg() { 043 sql_type = null; 044 errMsg = null; 045 } 046 047 /** 048 * すべての属???を指定して、新しい DBErrMsg オブジェクトを作?します? 049 * 050 * @param type ??タベ?スタイプ文字? 051 * @param no 行番号 052 * @param keka 結果 0:正常 1:警?2:異常 053 * @param errCD メ?ージID 054 * @param arg0 メ?ージの引数0 055 * @param arg1 メ?ージの引数1 056 * @param arg2 メ?ージの引数2 057 * @param arg3 メ?ージの引数3 058 * @param arg4 メ?ージの引数4 059 * @param pg PG? 060 * @param step ス?プ名 061 */ 062 // public DBErrMsg( final String type,final int no,final int keka,final String errCD, 063 // final String arg0,final String arg1,final String arg2, 064 // final String arg3,final String arg4 ) { 065 public DBErrMsg( final String type,final int no,final int keka,final String errCD, 066 final String arg0,final String arg1,final String arg2,final String arg3,final String arg4, 067 final String pg,final String step) { 068 sql_type = type; 069 // errMsg = new ErrMsg( no,keka,errCD,arg0,arg1,arg2,arg3,arg4 ); 070 errMsg = new ErrMsg( no,keka,pg,step,errCD,arg0,arg1,arg2,arg3,arg4 ); // 3.8.9.5 (2007/09/12) 071 } 072 073 /** 074 * ?のエラーメ?ージオブジェクトを返します? 075 * 076 * @return エラーメ?ージ 077 */ 078 public ErrMsg getErrMsg() { 079 return errMsg; 080 } 081 082 // ============================================================ 083 // implements SQLData 084 // ============================================================ 085 086 /** 087 * ???タイプ???を返します? 088 * 089 * @return ???タイプ??? 090 * @throws SQLException 091 */ 092 public String getSQLTypeName() throws SQLException { 093 return sql_type; 094 } 095 096 /** 097 * ??タベ?ス?より?属?を取得し、オブジェクトを構築します? 098 * 099 * @og.rev 2.0.0.4 (2002/09/27) エラーメ?ージ表示の、行番号がおかし?の修正? 100 * 101 * @param stream ストリー? 102 * @param typeName ???タイプ??? 103 * @throws SQLException 104 */ 105 public void readSQL( final SQLInput stream, final String typeName ) throws SQLException { 106 sql_type = typeName; 107 108 int no = stream.readInt()+1; // PLSQLでは、引数そ?ままの番号をセ?する? 109 int kekka = stream.readInt(); 110 String id = stream.readString(); 111 String arg0 = stream.readString(); 112 String arg1 = stream.readString(); 113 String arg2 = stream.readString(); 114 String arg3 = stream.readString(); 115 String arg4 = stream.readString(); 116 String pg = stream.readString(); // 3.8.9.5 (2007/09/12) 117 String step = stream.readString(); // 3.8.9.5 (2007/09/12) 118 119 // errMsg = new ErrMsg( no,kekka,id,arg0,arg1,arg2,arg3,arg4 ); 120 errMsg = new ErrMsg( no,kekka,pg,step,id,arg0,arg1,arg2,arg3,arg4 ); // 3.8.9.5 (2007/09/12) 121 } 122 123 /** 124 * ??タベ?ス?に?属?を設定します? 125 * 126 * @param stream ストリー? 127 * @throws SQLException 128 */ 129 public void writeSQL( final SQLOutput stream ) throws SQLException { 130 stream.writeInt( errMsg.getNo() ); 131 stream.writeInt( errMsg.getKekka() ); 132 stream.writeString( errMsg.getId() ); 133 stream.writeString( errMsg.getArg(0) ); 134 stream.writeString( errMsg.getArg(1) ); 135 stream.writeString( errMsg.getArg(2) ); 136 stream.writeString( errMsg.getArg(3) ); 137 stream.writeString( errMsg.getArg(4) ); 138 stream.writeString( errMsg.getPg() ); // 3.8.9.5 (2007/09/12) 139 stream.writeString( errMsg.getStep() ); // 3.8.9.5 (2007/09/12) 140 } 141 }