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 java.sql.ResultSet;
019 import java.sql.ResultSetMetaData;
020 import java.sql.SQLException;
021 import java.sql.Types;
022 import java.util.Locale;
023
024 import org.opengion.fukurou.db.DBUtil;
025 import org.opengion.fukurou.db.Transaction;
026 import org.opengion.fukurou.db.TransactionReal;
027 import org.opengion.fukurou.util.ApplicationInfo;
028 import org.opengion.fukurou.util.ErrorMessage;
029 import org.opengion.fukurou.util.StringUtil;
030 import org.opengion.hayabusa.common.HybsSystem;
031 import org.opengion.hayabusa.common.HybsSystemException;
032 import org.opengion.hayabusa.resource.LabelData;
033 import org.opengion.hayabusa.resource.ResourceManager;
034
035 /**
036 * ãƒ??タベã?ス関連ã®ä¾¿åˆ©ãªãƒ¡ã‚½ãƒ?ƒ‰ã‚’集ã‚ãŸç°¡æ˜“ユーãƒ?‚£ãƒªãƒ?‚£ãƒ¼ã‚¯ãƒ©ã‚¹ã§ã™ã?
037 * å…¨ã¦ã®ãƒ¡ã‚½ãƒ?ƒ‰ã¯ã€static メソãƒ?ƒ‰ã«ãªã£ã¦ã?¾ã™ã?
038 *
039 * @og.rev 2.1.1.1 (2002/11/15) Serializable インターフェースを削除ã™ã‚‹ã€?
040 * @og.rev 4.0.0.0 (2007/10/16) å称変更(DBUtil â‡?DBTableModelUtil) DBアクセス関係ã?メソãƒ?ƒ‰ã¯fukurou/db/DBUtilã«ç§»å‹?
041 * @og.group ?¤?¢/Shell制御
042 *
043 * @version 4.0
044 * @author Kazuhiko Hasegawa
045 * @since JDK5.0,
046 */
047 public final class DBTableModelUtil {
048 /**
049 * インスタンスを作らãªã??ã§ã€ã‚³ãƒ³ã‚¹ãƒˆãƒ©ã‚¯ã‚¿ã¯ã€private ã«è¨å®šã—ã¾ã™ã?
050 */
051 private DBTableModelUtil() {}
052
053 /**
054 * åˆæœŸãƒ??タベã?ã‚¹ã«æŽ¥ç¶šã—ã¦ã€Queryを実行ã—ã¾ã™ã?
055 * スãƒ??トメントã¨å¼•æ•°ã«ã‚ˆã‚Šã€Prepared ã‚¯ã‚¨ãƒªãƒ¼ã®æ¤œç´¢ã®ã¿å®Ÿè¡Œã—ã¾ã™ã?
056 * çµæžœã¯,DBTableModel ã¨ã—ã¦è¿”ã•れã¾ã™ã?
057 *
058 * @og.rev 3.0.0.0 (2002/12/25) æ–°è¦è¿½åŠ?
059 * @og.rev 3.8.7.0 (2006/12/15) アクセスãƒã‚°å–å¾—ã?為,ApplicationInfoオブジェクトをè¨å®?
060 * @og.rev 4.0.0.0 (2005/01/31) lang â‡?ResourceManager ã¸å¤‰æ›´
061 * @og.rev 4.0.0.0 (2007/10/10) dbid ã®åˆæœŸå€¤ã‚’ã?"DEFAULT" ã‹ã‚‰ null ã«å¤‰æ›´
062 *
063 * @param stmt スãƒ??トメント文å—å?
064 * @param args オブジェクトã?引数é…å?
065 * @param resource リソースマãƒãƒ¼ã‚¸ãƒ£ãƒ¼
066 * @param appInfo アプリ�?オブジェク�
067 *
068 * @return æ¤œç´¢çµæžœã®é…å?
069 */
070 public static DBTableModel makeDBTable( final String stmt ,final String[] args, final ResourceManager resource, final ApplicationInfo appInfo ) {
071 // return makeDBTable( stmt ,args,resource,appInfo,"DEFAULT" ); // 4.0.0 (2005/01/31)
072 return makeDBTable( stmt ,args,resource,appInfo,null );
073 }
074
075 /**
076 * 検索ã™ã‚‹ãƒ??タベã?スを指定ã—ã¦ã€Queryを実行ã—ã¾ã™ã?
077 * スãƒ??トメントã¨å¼•æ•°ã«ã‚ˆã‚Šã€Prepared ã‚¯ã‚¨ãƒªãƒ¼ã®æ¤œç´¢ã®ã¿å®Ÿè¡Œã—ã¾ã™ã?
078 * çµæžœã¯,DBTableModel ã¨ã—ã¦è¿”ã•れã¾ã™ã?
079 * 検索以外ã?SQLも実行ã§ãã¾ã™ã?çµæžœã¯ã€null ã‚’è¿”ã—ã¾ã™ã?
080 *
081 * @og.rev 3.0.0.0 (2002/12/25) æ–°è¦è¿½åŠ?
082 * @og.rev 3.0.0.1 (2003/02/14) ヘッãƒ??ã€ãƒ•ãƒ?‚¿ãƒ¼æƒ??ã?null ã®ã¨ãã?処ç?¿½åŠ??
083 * @og.rev 3.5.6.0 (2004/06/18) nullã«å¯¾ã™ã‚‹ç„¡é§?ªæ¯”è¼?‚’削除ã—ã¾ã™ã?
084 * @og.rev 3.8.7.0 (2006/12/15) アクセスãƒã‚°å–å¾—ã?為,ApplicationInfoオブジェクトをè¨å®?
085 * @og.rev 4.0.0.0 (2005/01/31) lang â‡?ResourceManager ã¸å¤‰æ›´
086 * @og.rev 5.1.9.0 (2010/08/01) Transaction 対�
087 * @og.rev 5.3.7.0 (2011/07/01) TransactionReal ã®å¼•数変更
088 * @og.rev 5.3.8.0 (2011/08/01) Transaction発生ç®?‰€ã§close()
089 *
090 * @param stmt スãƒ??トメント文å—å?
091 * @param args オブジェクトã?引数é…å?
092 * @param resource リソースマãƒãƒ¼ã‚¸ãƒ£ãƒ¼
093 * @param appInfo アプリ�?オブジェク�
094 * @param dbid 接続å?ID
095 *
096 * @return æ¤œç´¢çµæžœã®é…å?
097 */
098 public static DBTableModel makeDBTable( final String stmt ,final String[] args ,
099 final ResourceManager resource, final ApplicationInfo appInfo, final String dbid ) {
100 if( stmt == null || stmt.length() == 0 ) { return null; }
101
102 DBTableModel table = null;
103
104 Query query = QueryFactory.newInstance( "JDBCPrepared" );
105
106 ErrorMessage errMessage = null;
107 Transaction tran = null;
108 try {
109 // Transaction tran = new TransactionReal( dbid,appInfo ); // 5.1.9.0 (2010/08/01) Transaction 対�
110 // Transaction tran = new TransactionReal( appInfo ); // 5.3.7.0 (2011/07/01) 引数変更
111 tran = new TransactionReal( appInfo ); // 5.3.8.0 (2011/08/01) Transaction発生ç®?‰€ã§close()
112 query.setTransaction( dbid,tran ); // 5.1.9.0 (2010/08/01) Transaction 対�
113 // query.setConnectionID( dbid );
114 query.setResourceManager( resource ); // 4.0.0 (2005/01/31)
115 query.setStatement( stmt );
116 query.execute( args );
117 int errCode = query.getErrorCode();
118 int executeCount = query.getExecuteCount();
119 if( errCode < ErrorMessage.NG && executeCount >= 0 ) { // 異常以外ã?å ´å?
120 table = query.getDBTableModel();
121 // if( query.getUpdateFlag() ) { query.commit(); }
122 if( query.isUpdate() ) { query.commit(); }
123 }
124 else {
125 errMessage = query.getErrorMessage();
126 }
127 }
128 catch( HybsSystemException ex ) {
129 if( query != null ) { query.rollback(); }
130 throw ex;
131 }
132 finally {
133 // if( query != null ) { query.close(); }
134 QueryFactory.close( query );
135 if( tran != null ) { tran.close(); } // 5.3.8.0 (2011/08/01) Transaction発生ç®?‰€ã§close()
136 }
137
138 if( errMessage != null ) {
139 throw new HybsSystemException( errMessage.toString() );
140 }
141
142 return table;
143 }
144
145 /**
146 * 空㮠DBTableModelオブジェクトを作æ?ã—ã¾ã™ã?
147 * ã“れã¯ã€æœ¬æ¥ã€ãƒ•ァクトリクラスã§ä½œæ?ã™ã¹ãã§ã™ãŒã€ç°¡æ˜“作æ?メソãƒ?ƒ‰ã¨ã—ã¦
148 * DBUtil ã® static メソãƒ?ƒ‰ã¨ã—ã¦å®Ÿè£?—ã¾ã™ã?
149 *
150 * @og.rev 4.0.0.0 (2005/01/31) æ–°è¦è¿½åŠ?
151 *
152 * @return DBTableModelオブジェク�
153 */
154 public static DBTableModel newDBTable() {
155 return new DBTableModelImpl();
156 }
157
158 /**
159 * カラãƒ?ã®é…å?åŠã?ãƒ??ã‚¿ã®2次å…??列ã‹ã‚‰DBãƒ??ブルモãƒ?ƒ«ã‚’作æ?ã—ã¾ã™ã?
160 * カラãƒ?ãŒã‚»ãƒ?ƒˆã•れã¦ã?ªã?‹¥ã—ãã¯ãƒ??ã‚¿ãŒã‚»ãƒ?ƒˆã•れã¦ã?ªã??åˆã?ã€nullã‚’è¿”ã—ã¾ã™ã?
161 *
162 * @og.rev 4.2.1.0 (2008/04/26) æ–°è¦è¿½åŠ?
163 *
164 * @param clms カラãƒ?ã®é…å?
165 * @param vals 値ã®é…å?
166 * @param resource リソースマãƒãƒ¼ã‚¸ãƒ£ãƒ¼
167 *
168 * @return DBãƒ??ブルモãƒ?ƒ«
169 */
170 public static DBTableModel makeDBTable( final String[] clms, final String[][] vals, final ResourceManager resource ) {
171 if( clms == null || clms.length == 0
172 || vals == null || vals.length == 0 || vals[0] == null || vals[0].length == 0 ) {
173 return null;
174 }
175
176 if( clms.length != vals[0].length ) {
177 // throw new HybsSystemException( "ã‚ーã®ã‚«ãƒ©ãƒ?•°ã¨ãƒ??ã‚¿ã®ã‚«ãƒ©ãƒ?•°ãŒä¸??ã—ã¦ã?¾ã›ã‚“" );
178 String errMsg = "ã‚ーã®ã‚«ãƒ©ãƒ?•°ã¨ãƒ??ã‚¿ã®ã‚«ãƒ©ãƒ?•°ãŒä¸??ã—ã¦ã?¾ã›ã‚“ã€?
179 + HybsSystem.CR
180 + " clms.length=[" + clms.length + "] vals.length=[" + vals[0].length + "]"
181 + " clms=" + StringUtil.array2csv( clms ) + HybsSystem.CR
182 + " vals=" + StringUtil.array2csv( vals[0] ) ; // 5.1.8.0 (2010/07/01) errMsg ä¿®æ£
183 throw new HybsSystemException( errMsg );
184 }
185
186 int numberOfColumns = clms.length;
187 DBTableModel table = newDBTable() ;
188 table.init( numberOfColumns );
189
190 DBColumn[] dbColumn = new DBColumn[numberOfColumns];
191 for( int column=0; column<numberOfColumns; column++ ) {
192 dbColumn[column] = resource.makeDBColumn( clms[column] );
193 table.setDBColumn( column,dbColumn[column] );
194 }
195
196 int numberOfRows = vals.length;
197 for( int row=0; row<numberOfRows; row++ ) {
198 table.addColumnValues( vals[row] );
199 }
200
201 return table;
202 }
203
204 /**
205 * æ¤œç´¢çµæžœã‚ªãƒ–ジェクトã‹ã‚‰DBãƒ??ブルモãƒ?ƒ«ã‚’作æ?ã—ã¾ã™ã?
206 * æ¤œç´¢çµæžœã‚ªãƒ–ジェクトã¾ãŸã?リソースオブジェクトãŒã‚»ãƒ?ƒˆã•れã¦ã?ªã??åˆã?ã€nullã‚’è¿”ã—ã¾ã™ã?
207 *
208 * @og.rev 5.3.6.0 (2011/06/01) æ–°è¦è¿½åŠ?
209 * @og.rev 5.5.5.4 (2012/08/18) TIMESTAMP 型もCLOBã¨åŒæ§˜ã«å‡¦ç?‚’åˆ?‘ã‚‹ã?
210 *
211 * @param result æ¤œç´¢çµæžœã‚ªãƒ–ジェクãƒ?
212 * @param skipRowCount èªã¿é£›ã?ã—ä»¶æ•°
213 * @param maxRowCount æœ?¤§æ¤œç´¢ä»¶æ•°
214 * @param resource リソースマãƒãƒ¼ã‚¸ãƒ£ãƒ¼
215 *
216 * @return DBãƒ??ブルモãƒ?ƒ«
217 * @throws SQLException ãƒ??タベã?スアクセスエラー
218 */
219 public static DBTableModel makeDBTable( final ResultSet result, final int skipRowCount, final int maxRowCount, final ResourceManager resource ) throws SQLException {
220 if( result == null || resource == null ) { return null; }
221
222 ResultSetMetaData metaData = result.getMetaData();
223
224 int numberOfColumns = metaData.getColumnCount();
225
226 DBTableModel table = DBTableModelUtil.newDBTable() ;
227 table.init( numberOfColumns );
228
229 // é ?›®å,é?目タイプ,é?目サイズ?Œæ›¸è¾¼ã¿ãƒ•ラグをè¨å®šã™ã‚‹ã?
230 DBColumn[] dbColumn = new DBColumn[numberOfColumns];
231
232 // 3.8.5.0 (2006/03/02) CLOB/ROWID ãªã©ã®ã‚«ãƒ©ãƒ?‹ã©ã?‹ã‚’判定ã—ã¾ã™ã?
233 boolean isOther = false;
234 int[] types = new int[numberOfColumns];
235
236 for( int column=0; column<numberOfColumns; column++ ) {
237 String name = (metaData.getColumnLabel(column+1)).toUpperCase(Locale.JAPAN) ;
238 dbColumn[column] = resource.getDBColumn( name );
239 if( dbColumn[column] == null ) {
240 LabelData labelData = resource.getLabelData( name );
241 dbColumn[column] = makeDBColumn( name,labelData,metaData,column,resource.getLang() );
242 }
243 table.setDBColumn( column,dbColumn[column] );
244
245 // 3.8.5.0 (2006/03/02) CLOB カラãƒ?‹ã©ã?‹ã‚’判定ã—ã¾ã™ã?
246 // 5.5.5.4 (2012/08/18) TIMESTAMP 型もCLOBã¨åŒæ§˜ã«å‡¦ç?‚’åˆ?‘ã‚‹ã?
247 // types[column] = metaData.getColumnType(column+1);
248 int clmType = metaData.getColumnType(column+1);
249 types[column] = clmType;
250 // if( types[column] == Types.CLOB || types[column] == Types.ROWID ) { // JDK 6.0以�ROWID
251 if( clmType == Types.CLOB || clmType == Types.ROWID || clmType == Types.TIMESTAMP ) { // JDK 6.0以�ROWID
252 isOther = true;
253 }
254 }
255
256 // ãƒ??タ部ã®è¨å®?
257 int numberOfRows = 0;
258 while( numberOfRows < skipRowCount && result.next() ) {
259 // 注æ„?resultSet.next() ã‚’å?ã«åˆ¤å®šã™ã‚‹ã¨å¿?š?‘ä»¶èªã¿é£›ã?ã—ã¦ã—ã¾ã??
260 numberOfRows ++ ;
261 }
262 // resultSet.absolute( getSkipRowCount() );
263 numberOfRows = 0;
264
265 // 3.8.5.1 (2006/05/08) 行å?ã®ãƒ«ãƒ¼ãƒ—ãªã®ã§ã€?CLOB 使用å¯å¦ã§ãƒ«ãƒ¼ãƒ—ã‚’åˆ?‘ã‚‹ã?
266 if( isOther ) {
267 while( numberOfRows < maxRowCount && result.next() ) {
268 numberOfRows ++ ;
269 String[] columnValues = new String[numberOfColumns];
270 for( int column=0; column<numberOfColumns; column++ ) {
271 // 5.3.6.0 (2011/06/01) メソãƒ?ƒ‰åŒ?
272 columnValues[column] = DBUtil.getValue( result, column, types[column] );
273 }
274 table.addColumnValues( columnValues );
275 }
276 }
277 else {
278 while( numberOfRows < maxRowCount && result.next() ) {
279 numberOfRows ++ ;
280 String[] columnValues = new String[numberOfColumns];
281 for( int column=0; column<numberOfColumns; column++ ) {
282 Object obj = result.getObject(column+1);
283 columnValues[column] = ( obj == null ? "" : String.valueOf( obj ) );
284 }
285 table.addColumnValues( columnValues );
286 }
287 }
288
289 // æœ?¤§ä»¶æ•°ãŒã?è¶?ˆãŸå?åˆã§ã‹ã¤æ¬¡ã®ãƒ??ã‚¿ãŒã‚ã‚‹å?åˆã?ã€ã‚ªãƒ¼ãƒã?フãƒãƒ¼
290 if( numberOfRows >= maxRowCount && result.next() ) {
291 table.setOverflow( true );
292 }
293
294 return table;
295 }
296
297 /**
298 * æ¤œç´¢çµæžœã‚ªãƒ–ジェクトã‹ã‚‰ã‚¨ãƒ?‚£ãƒ?ƒˆè¨å®šã«åŸºã¥ã?¦å¤‰æ›ã•れãŸDBãƒ??ブルモãƒ?ƒ«ã‚’作æ?ã—ã¾ã™ã?
299 * æ¤œç´¢çµæžœã‚ªãƒ–ジェクトã¾ãŸã?リソースオブジェクトã¾ãŸã?エãƒ?‚£ãƒ?ƒˆè¨å®šã‚ªãƒ–ジェクトãŒã‚»ãƒ?ƒˆã•れã¦ã?ªã??åˆã?ã€nullã‚’è¿”ã—ã¾ã™ã?
300 *
301 * @og.rev 5.3.6.0 (2011/06/01) æ–°è¦è¿½åŠ?
302 *
303 * @param result æ¤œç´¢çµæžœã‚ªãƒ–ジェクãƒ?
304 * @param skipRowCount èªã¿é£›ã?ã—ä»¶æ•°
305 * @param maxRowCount æœ?¤§æ¤œç´¢ä»¶æ•°
306 * @param resource リソースマãƒãƒ¼ã‚¸ãƒ£ãƒ¼
307 * @param config エãƒ?‚£ãƒ?ƒˆè¨å®šã‚ªãƒ–ジェクãƒ?
308 *
309 * @return DBãƒ??ブルモãƒ?ƒ«
310 * @throws SQLException ãƒ??タベã?スアクセスエラー
311 */
312 public static DBTableModel makeEditDBTable( final ResultSet result, final int skipRowCount, final int maxRowCount, final ResourceManager resource, final DBEditConfig config ) throws SQLException {
313 if( result == null || resource == null ) { return null; }
314 DBTableModel table = new DBTableModelEditor();
315 ((DBTableModelEditor)table).create( result, skipRowCount, maxRowCount, resource, config );
316 return table;
317 }
318
319 /**
320 * ResultSetMetaData ã‹ã‚‰ã€DBColumn オブジェクトを作æ?ã—ã¾ã™ã?
321 *
322 * DBColumn オブジェクãƒ?ãŒãƒªã‚½ãƒ¼ã‚¹ãƒ•ァイルã«å®šç¾©ã•れã¦ã?ªã??åˆã«ã€?
323 * ãƒ??タベã?ã‚¹ã®æ¤œç´¢çµæžœã®ãƒ¡ã‚¿ãƒ??タを利用ã—ã¦ã€DBColumn オブジェクトを
324 * 作æ?ã—ã¾ã™ã?
325 *
326 * @og.rev 3.4.0.0 (2003/09/01) 表示パラメータã€ç·¨é›?ƒ‘ãƒ©ãƒ¡ãƒ¼ã‚¿ã€æ–‡å—パラメータã®è¿½åŠ??
327 * @og.rev 3.4.0.2 (2003/09/05) DBType ã®ãƒ?ƒ•ォルトå?ã‚’ã?'X' ã‹ã‚‰ 'XK' ã«å¤‰æ›´ã—ã¾ã™ã?
328 * @og.rev 3.6.0.7 (2004/11/06) DBColumn ã® official属æ?追åŠ?
329 * @og.rev 4.0.0.0 (2005/01/31) lang 変数をå–å¾?
330 * @og.rev 5.3.6.0 (2011/06/01) AbstractQueryã‹ã‚‰ç§»å‹?
331 *
332 * @param name カラ�
333 * @param labelData LabelDataオブジェク�
334 * @param metaData ResultSetMetaDataオブジェク�
335 * @param column カラãƒ?•ªå·
336 * @param lang è¨?ª?
337 *
338 * @return DBColumnオブジェク�
339 */
340 public static DBColumn makeDBColumn( final String name,final LabelData labelData,
341 final ResultSetMetaData metaData,final int column,final String lang ) {
342 final DBColumn dbColumn ;
343
344 try {
345 String clsName = type2ClassName( metaData.getColumnType(column+1) );
346 int size = metaData.getColumnDisplaySize(column+1);
347 if( size == 0 ) { size = 60; }
348 boolean writable = metaData.isWritable(column+1);
349 String dbType = ( "NUMBER".equals( clsName )) ? "S9" : "XK" ;
350 String defValue = ( "NUMBER".equals( clsName )) ? "0" : "" ;
351 DBColumnConfig config = new DBColumnConfig(
352 lang, // è¨?ª?
353 name, // カラ�
354 labelData, // カラ�?ラベル�?タオブジェク�
355 clsName , // カラãƒ??クラスを文å—å?ã«ã—ãŸåç§°
356 String.valueOf( size ) , // カラãƒ??æ–?—æ¡æ•°
357 String.valueOf( writable ) , // カラãƒ?Œæ›¸ãè¾¼ã¿å¯èƒ½ã‹ã©ã?‹
358 null , // ãƒ??ã‚¿ã®è¡¨ç¤ºç”¨ãƒ¬ãƒ³ãƒ?ƒ©ãƒ¼
359 null , // ãƒ??ã‚¿ã®ç·¨é›?”¨ã‚¨ãƒ?‚£ã‚¿ãƒ¼
360 null , // メニューã®é ?›®ã‚³ãƒ¼ãƒ‰ãƒ‡ãƒ¼ã‚¿ã‚ªãƒ–ジェクãƒ?
361 dbType , // ãƒ??ã‚¿ã®ã‚¿ã‚¤ãƒ?
362 defValue, // ãƒ??ã‚¿ã®ãƒ?ƒ•ォルトå?
363 null , // 表示用レンãƒ?ƒ©ãƒ¼ã®ãƒ‘ラメータ
364 null , // ç·¨é›?”¨ã‚¨ãƒ?‚£ã‚¿ãƒ¼ã®ãƒ‘ラメータ
365 null , // ãƒ??ã‚¿ã®ã‚¿ã‚¤ãƒ—ã?パラメータ
366 null , // カラãƒ?ƒãƒ¼ãƒ«
367 false, // æ£å¼ãªã‚«ãƒ©ãƒ?‚ªãƒ–ジェクトã‹ã©ã?‹
368 null // ãƒ??タベã?ス接続å?ID
369 );
370
371 dbColumn = new DBColumn( config ); // 4.0.0 (2005/01/31)
372
373 }
374 catch( SQLException ex ) {
375 String errMsg = "DBColumn を作æ?ã§ãã¾ã›ã‚“ã§ã—ãŸã€‚name=[" + name + " , label=[" + labelData + "]";
376 throw new HybsSystemException( errMsg,ex ); // 3.5.5.4 (2004/04/15) 引数ã®ä¸¦ã³é ?¤‰æ›´
377 }
378 catch( RuntimeException ex2 ) {
379 String errMsg = "予期ã›ã¬ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—ãŸã€‚name=[" + name + " , label=[" + labelData + "]";
380 throw new HybsSystemException( errMsg,ex2 ); // 3.6.0.0 (2004/09/17)
381 }
382
383 return dbColumn;
384 }
385
386 /**
387 * カラãƒ??タイプを表ç¾ã™ã‚‹æ–?—å?値を返ã—ã¾ã™ã?
388 *
389 * ã“ã?æ–?—å?を用ã?¦ã€CCSファイルã§ã‚¿ã‚¤ãƒ—ã”ã¨ã®è¡¨ç¤ºæ–¹æ³•ã‚’
390 * æŒ?®šã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã?
391 *
392 * @og.rev 2.1.1.1 (2002/11/15) ãã?ä»–ã?ケースをã?VARCHAR2 ã‚’è¿”ã™ã‚ˆã†ã«ä¿®æ£ã€?
393 * @og.rev 4.0.0.0 (2006/01/31) CLOB を追�
394 * @og.rev 5.3.6.0 (2011/06/01) AbstractQueryã‹ã‚‰ç§»å‹?
395 * @og.rev 5.5.5.4 (2012/08/18) DECIMAL,TIMESTAMP を追�
396 *
397 * @param type タイプ番å·
398 *
399 * @return カラãƒ??タイプを表ç¾ã™ã‚‹æ–?—å?値
400 * @see java.sql.Types
401 */
402 private static String type2ClassName( final int type ) {
403 final String rtn ;
404
405 switch( type ) {
406 case Types.CHAR:
407 case Types.VARCHAR:
408 case Types.BIT:
409 rtn = "VARCHAR2"; break;
410 case Types.LONGVARCHAR: // 4.0.0 (2006/01/31)
411 rtn = "LONG"; break;
412 case Types.TINYINT:
413 case Types.SMALLINT:
414 case Types.INTEGER:
415 case Types.NUMERIC:
416 case Types.BIGINT:
417 case Types.FLOAT:
418 case Types.DOUBLE:
419 case Types.REAL:
420 case Types.DECIMAL: // 5.5.5.4 (2012/08/18)
421 rtn = "NUMBER"; break;
422 case Types.DATE:
423 case Types.TIMESTAMP: // 5.5.5.4 (2012/08/18)
424 rtn = "DATE"; break;
425 case Types.CLOB: // 4.0.0 (2006/01/31)
426 rtn = "CLOB"; break;
427 default:
428 rtn = "NONE"; break;
429 }
430
431 return rtn;
432 }
433 }