type was not being initialized since the else part was also commented
[csql/przemoc.git] / src / jdbc / JdbcSqlResultSetMetaData.java
blob9978779c5e8cccfd02ae80c29a52ddb93f65059f
2 package csql.jdbc;
4 import java.sql.SQLException;
5 import java.sql.ResultSetMetaData;
8 public final class JdbcSqlResultSetMetaData
9 extends JSqlError implements ResultSetMetaData, JSqlErrorType
11 private boolean isClosed;
12 JdbcSqlStatement stmt; // This guy creates me
14 JdbcSqlResultSetMetaData()
16 isClosed = false;
18 void setStmt( JdbcSqlStatement s )
20 stmt = s;
21 isClosed = false;
24 public void close() throws SQLException
26 if( ! isClosed )
27 isClosed = true;
28 return;
31 public int getColumnCount () throws SQLException
33 if( isClosed ) throw getException( CSQL_INVALID_STATE );
34 return( stmt.jniStmt.getTotalProjFld() );
36 public int getColumnIndex (String name) throws SQLException
38 if( isClosed ) throw getException( CSQL_INVALID_STATE );
39 return( stmt.jniStmt.findColumn( name ) );//TO DO
42 public String getColumnName (int colNum) throws SQLException
44 if( isClosed ) throw getException( CSQL_INVALID_STATE );
46 String name= stmt.jniStmt.getProjFldName(colNum);
47 return( name );
49 public String getColumnLabel (int colNum) throws SQLException
51 return getColumnName( colNum );
54 public boolean isReadOnly (int colNum) throws SQLException
56 if( isClosed ) throw getException( CSQL_INVALID_STATE );
57 return( false );
59 public boolean isWritable (int colNum) throws SQLException
61 if( isClosed ) throw getException( CSQL_INVALID_STATE );
62 return( true );
64 public boolean isDefinitelyWritable (int colNum) throws SQLException
66 if( isClosed ) throw getException( CSQL_INVALID_STATE );
67 return( true );
71 public String getColumnClassName(int colNum) throws SQLException
73 if( isClosed ) throw getException( CSQL_INVALID_STATE );
74 return Util.getClassName(this.stmt.jniStmt.getProjFldType(colNum));
77 public int getColumnType (int colNum) throws SQLException
79 if( isClosed ) throw getException( CSQL_INVALID_STATE );
80 return Util.getType(this.stmt.jniStmt.getProjFldType(colNum));
82 public String getColumnTypeName (int colNum) throws SQLException
84 if( isClosed ) throw getException( CSQL_INVALID_STATE );
85 return Util.getTypeName(this.stmt.jniStmt.getProjFldType(colNum));
87 public boolean isCaseSensitive (int colNum) throws SQLException
89 if( isClosed ) throw getException( CSQL_INVALID_STATE );
90 return( false );
93 public int isNullable (int colNum) throws SQLException
95 if( isClosed ) throw getException( CSQL_INVALID_STATE );
96 if (this.stmt.jniStmt.isFldNullable(colNum))
97 return JdbcSqlResultSetMetaData.columnNoNulls ;
98 else
99 return JdbcSqlResultSetMetaData.columnNullable ;
102 public String getTableName (int colNum) throws SQLException
104 if( isClosed ) throw getException( CSQL_INVALID_STATE );
105 return( null );
107 public boolean isSigned (int colNum) throws SQLException
109 if( isClosed ) throw getException( CSQL_INVALID_STATE );
110 throw getException( CSQL_NOT_SUPPORTED );
112 public int getPrecision (int colNum) throws SQLException //TODO
114 if( isClosed ) throw getException( CSQL_INVALID_STATE );
115 throw getException( CSQL_NOT_SUPPORTED );
117 public int getScale (int colNum) throws SQLException //TODO
119 if( isClosed ) throw getException( CSQL_INVALID_STATE );
120 throw getException( CSQL_NOT_SUPPORTED );
122 public String getSchemaName (int colNum) throws SQLException
124 return( null );
128 // UN-SUPPORTED API's
129 public int getColumnDisplaySize (int colNum) throws SQLException
131 return( 1 );
133 public boolean isAutoIncrement (int colNum) throws SQLException
135 return( false );
137 public boolean isCurrency (int colNum) throws SQLException
139 return( true );
141 public String getCatalogName (int colNum) throws SQLException
143 return( null );
145 public boolean isSearchable (int colNum) throws SQLException
147 return( true );
149 //java 1.6 methods
150 public boolean isWrapperFor(Class ifact) throws SQLException
152 throw getException(CSQL_NOT_SUPPORTED);
154 public Class unwrap(Class iface) throws SQLException
156 throw getException(CSQL_NOT_SUPPORTED);