home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright (c) 1996 Sun Microsystems, Inc. All Rights Reserved.
- *
- * Permission to use, copy, modify, and distribute this software
- * and its documentation for NON-COMMERCIAL purposes and without
- * fee is hereby granted provided that this copyright notice
- * appears in all copies. Please refer to the file "LICENSE"
- * for further important copyright and licensing information.
- *
- * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
- * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
- * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
- *
- * THIS SOFTWARE IS NOT DESIGNED OR INTENDED FOR USE OR RESALE AS ON-LINE
- * CONTROL EQUIPMENT IN HAZARDOUS ENVIRONMENTS REQUIRING FAIL-SAFE
- * PERFORMANCE, SUCH AS IN THE OPERATION OF NUCLEAR FACILITIES, AIRCRAFT
- * NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL, DIRECT LIFE
- * SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH THE FAILURE OF THE
- * SOFTWARE COULD LEAD DIRECTLY TO DEATH, PERSONAL INJURY, OR SEVERE
- * PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH RISK ACTIVITIES"). SUN
- * SPECIFICALLY DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR
- * HIGH RISK ACTIVITIES.
- */
- package jdbcTest.harness;
- import java.sql.*;
- import java.util.*;
- /**
- * SupportedSQLType is an object that represents a SQL type that is supported by
- * an executing JDBC driver. It is constructed from an instance of a row in the result set
- * returned by the getTypeInfo method of the DatabaseMetaData class.
- * Accessor methods are provided for each data element. The names of these access methods
- * correspond to the column names defines for the result set returned by getTypeInfo. The TYPE_NAME column,
- * for example, is returned by invoking the getTypeName() method.*/
- public class SupportedSQLType{
- String name;
- short javaType;
- int precision;
- String prefix;
- String suffix;
- String parms;
- short nullable;
- boolean casesensitive;
- short searchable;
- boolean signed;
- boolean currency;
- boolean autoincrement;
- String typeName;
- short minScale;
- short maxScale;
- int radix;
- public SupportedSQLType( String iname,
- short ijavaType,
- int iprecision,
- String iprefix,
- String isuffix,
- String iparms,
- short inullable,
- boolean icasesensitive,
- short isearchable,
- boolean isigned,
- boolean icurrency,
- boolean iautoincrement,
- String itypeName,
- short iminScale,
- short imaxScale, int iradix ){
-
- name = iname==null?"unknown":iname;
- javaType = ijavaType;
- precision = iprecision;
- prefix = iprefix==null?"":iprefix;
- suffix = isuffix==null?"":isuffix;
- parms = iparms==null?"":iparms;
- nullable = inullable;
- casesensitive = icasesensitive;
- searchable = isearchable;
- signed = isigned;
- currency = icurrency;
- autoincrement = iautoincrement;
- typeName = itypeName==null?"":itypeName;
- minScale = iminScale;
- maxScale = imaxScale;
- radix = iradix;
- }
- public Object clone() {
- return new SupportedSQLType(
- new String(name),
- javaType,
- precision,
- new String(prefix),
- new String(suffix),
- new String(parms),
- nullable,
- casesensitive,
- searchable,
- signed,
- currency,
- autoincrement,
- typeName,
- minScale,
- maxScale,
- radix );
- }
- /**
- * returns the TYPE_NAME column of an instance of the result set
- * created by DatabaseMetaData.getTypeInfo() */
- public String getTypeName() {
- return(name);
- }
- /**
- * returns the DATA_TYPE column of an instance of the result set
- * created by DatabaseMetaData.getTypeInfo() */
- public int getDataType() {
- return(javaType);
- }
- /**
- * returns the PRECISION column of an instance of the result set
- * created by DatabaseMetaData.getTypeInfo() */
- public int getPrecision() {
- return(precision);
- }
- /**
- * returns the LITERAL_PREFIX column of an instance of the result set
- * created by DatabaseMetaData.getTypeInfo() */
- public String getLiteralPrefix() {
- if(prefix == null)
- return("");
- else
- return(prefix);
- }
- /**
- * returns the LITERAL_SUFFIX column of an instance of the result set
- * created by DatabaseMetaData.getTypeInfo() */
- public String getLiteralSuffix() {
- if(suffix == null)
- return("");
- else
- return(suffix);
- }
- /**
- * returns the CREATE_PARAMS column of an instance of the result set
- * created by DatabaseMetaData.getTypeInfo() */
- public String getCreateParams() {
- return(parms);
- }
- /**
- * returns the TYPE_NAME column of an instance of the result set
- * created by DatabaseMetaData.getTypeInfo() */
- public short NULLABLE() {
- return(nullable);
- }
- /**
- * returns the CASE_SENSITIVE column of an instance of the result set
- * created by DatabaseMetaData.getTypeInfo() */
- public boolean getCaseSensitive(){
- return(casesensitive);
- }
- /**
- * returns the SEARCHABLE column of an instance of the result set
- * created by DatabaseMetaData.getTypeInfo() */
- public short getSearchable() {
- return(searchable);
- }
- /**
- * returns the UNSIGNED_ATTRIBUTE column of an instance of the result set
- * created by DatabaseMetaData.getTypeInfo() */
- public boolean getUnsignedAttribute() {
- return(signed);
- }
- /**
- * returns the FIXED_PREC_SCALE column of an instance of the result set
- * created by DatabaseMetaData.getTypeInfo() */
- public boolean getFixedPrecScale() {
- return(currency);
- }
- /**
- * returns the AUTO_INCREMENT column of an instance of the result set
- * created by DatabaseMetaData.getTypeInfo() */
- public boolean getAutoIncrement() {
- return(autoincrement);
- }
- /**
- * returns the LOCAL_TYPE_NAME column of an instance of the result set
- * created by DatabaseMetaData.getTypeInfo() */
- public String getLocalTypeName() {
- return(typeName);
- }
- /**
- * returns the MINIMUM_SCALE column of an instance of the result set
- * created by DatabaseMetaData.getTypeInfo() */
- public short getMinimumScale() {
- return(minScale);
- }
- /**
- * returns the MAXIMUM_SCALE column of an instance of the result set
- * created by DatabaseMetaData.getTypeInfo() */
- public short getMaximumScale() {
- return(maxScale);
- }
- /**
- * returns the NUM_PREC_RADIX column of an instance of the result set
- * created by DatabaseMetaData.getTypeInfo() */
- public int getNumPrecRadix(){
- return(radix);
- }
-
- }
-