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.SQLData; 019import java.sql.SQLInput; 020import java.sql.SQLOutput; 021import java.sql.SQLException; 022 023/** 024 * SQLData インターフェースを継承した システム変数の受け渡し用オブジェクトです。 025 * 行番号情報と改廃コード[A:追加/C:変更/D:削除]を持っています。 026 * 027 * @og.group DB/Shell制御 028 * 029 * @version 4.0 030 * @author Kazuhiko Hasegawa 031 * @since JDK5.0, 032 */ 033public class DBSysArg implements SQLData { 034 private String sql_type ; 035 036 private int lineNo; 037 private String codeKaihai; 038 private String curdate; // 4.3.0.0 (2008/07/22) 039 private String pgid; // 4.3.0.0 (2008/07/22) 040 private String userid; // 4.3.0.0 (2008/07/22) 041 042 /** 043 * デフォルトコンストラクター 044 */ 045 public DBSysArg() { 046 sql_type = null; 047 lineNo = -1; 048 codeKaihai = null; 049 curdate = null; 050 pgid = null; 051 userid = null; 052 } 053 054 /** 055 * すべての属性情報を指定して、新しい DBSysArg オブジェクトを作成します。 056 * 057 * @og.rev 4.3.0.0 (2008/07/22) 引数に日付、PG、ユーザーIDを追加 058 * 059 * @param type データベースタイプ文字列 060 * @param no 行番号 061 * @param cdkh 改廃コード A:追加 C:変更 D:削除 062 * @param time 現在時間の文字列 063 * @param pg プログラム名称 064 * @param user ユーザーID 065 */ 066// public DBSysArg( final String type,final int no,final String cdkh ) { 067 public DBSysArg( final String type,final int no,final String cdkh, final String time, final String pg, final String user ) { 068 sql_type = type; 069 lineNo = no; 070 codeKaihai = cdkh; 071 curdate = time; 072 pgid = pg; 073 userid = user; 074 } 075 076 // ============================================================ 077 // implements SQLData 078 // ============================================================ 079 080 /** 081 * SQLタイプの文字列を返します。 082 * 083 * @return SQLタイプの文字列 084 * @throws SQLException ※ この実装からは SQLException は、throw されません。 085 */ 086 public String getSQLTypeName() throws SQLException { 087 return sql_type; 088 } 089 090 /** 091 * データベース内部より内部属性を取得し、オブジェクトを構築します。 092 * 093 * @og.rev 4.3.0.0 (2008/07/22) 日付、PG、ユーザーIDを追加 094 * 095 * @param stream ストリーム 096 * @param typeName SQLタイプの文字列 097 * @throws SQLException データベースアクセスエラー 098 */ 099 public void readSQL( final SQLInput stream, final String typeName ) throws SQLException { 100 sql_type = typeName; 101 102 lineNo = stream.readInt(); 103 codeKaihai = stream.readString(); 104 curdate = stream.readString(); 105 pgid = stream.readString(); 106 userid = stream.readString(); 107 } 108 109 /** 110 * データベース内部に内部属性を設定します。 111 * 112 * @og.rev 4.3.0.0 (2008/07/22) 日付、PG、ユーザーIDを追加 113 * 114 * @param stream ストリーム 115 * @throws SQLException データベースアクセスエラー 116 */ 117 public void writeSQL( final SQLOutput stream ) throws SQLException { 118 stream.writeInt( lineNo ); 119 stream.writeString( codeKaihai ); 120 stream.writeString( curdate ); 121 stream.writeString( pgid ); 122 stream.writeString( userid ); 123 } 124}