1988649 with jdk 1.6 build fails
[csql.git] / src / jdbc / JdbcSqlResultSetMetaData.java
blob29a0413456226303ec99e125d53d3196778ea2bc
2 package csql.jdbc;
3 import java.sql.Connection;
4 import java.sql.Statement;
5 import java.sql.SQLException;
6 import java.sql.ResultSetMetaData;
7 import java.sql.SQLWarning;
9 public final class JdbcSqlResultSetMetaData
10 extends JSqlError implements ResultSetMetaData, JSqlErrorType
12 private boolean isClosed;
13 JdbcSqlStatement stmt; // This guy creates me
15 JdbcSqlResultSetMetaData()
17 isClosed = false;
19 void setStmt( JdbcSqlStatement s )
21 stmt = s;
22 isClosed = false;
25 public void close() throws SQLException
27 if( ! isClosed )
28 isClosed = true;
29 return;
32 public int getColumnCount () throws SQLException
34 if( isClosed ) throw getException( CSQL_INVALID_STATE );
35 return( stmt.jniStmt.getNoOfFields() );
37 public int getColumnIndex (String name) throws SQLException
39 if( isClosed ) throw getException( CSQL_INVALID_STATE );
40 throw getException( CSQL_NOT_SUPPORTED );
41 //return( stmt.jniStmt.findColumn( name ) );
44 public String getColumnName (int colNum) throws SQLException
46 if( isClosed ) throw getException( CSQL_INVALID_STATE );
48 String name= stmt.jniStmt.getFieldName( colNum-1 );
49 return( name );
51 public String getColumnLabel (int colNum) throws SQLException
53 return getColumnName( colNum );
56 public boolean isReadOnly (int colNum) throws SQLException
58 if( isClosed ) throw getException( CSQL_INVALID_STATE );
59 return( false );
61 public boolean isWritable (int colNum) throws SQLException
63 if( isClosed ) throw getException( CSQL_INVALID_STATE );
64 return( true );
66 public boolean isDefinitelyWritable (int colNum) throws SQLException
68 if( isClosed ) throw getException( CSQL_INVALID_STATE );
69 return( true );
72 // TODO
73 public String getColumnClassName(int colNum) throws SQLException
75 if( isClosed ) throw getException( CSQL_INVALID_STATE );
76 throw getException( CSQL_NOT_SUPPORTED );
78 public int getColumnType (int colNum) throws SQLException //TODO
80 if( isClosed ) throw getException( CSQL_INVALID_STATE );
81 throw getException( CSQL_NOT_SUPPORTED );
83 public String getColumnTypeName (int colNum) throws SQLException //TODO
85 if( isClosed ) throw getException( CSQL_INVALID_STATE );
86 throw getException( CSQL_NOT_SUPPORTED );
88 public boolean isCaseSensitive (int colNum) throws SQLException //TODO
90 if( isClosed ) throw getException( CSQL_INVALID_STATE );
91 return( false );
93 public boolean isSigned (int colNum) throws SQLException //TODO
95 if( isClosed ) throw getException( CSQL_INVALID_STATE );
96 throw getException( CSQL_NOT_SUPPORTED );
98 public int isNullable (int colNum) throws SQLException //TODO
100 if( isClosed ) throw getException( CSQL_INVALID_STATE );
101 throw getException( CSQL_NOT_SUPPORTED );
103 public int getPrecision (int colNum) throws SQLException //TODO
105 if( isClosed ) throw getException( CSQL_INVALID_STATE );
106 throw getException( CSQL_NOT_SUPPORTED );
108 public int getScale (int colNum) throws SQLException //TODO
110 if( isClosed ) throw getException( CSQL_INVALID_STATE );
111 throw getException( CSQL_NOT_SUPPORTED );
113 public String getSchemaName (int colNum) throws SQLException
115 return( null );
117 public String getTableName (int colNum) throws SQLException
119 return( null );
122 // UN-SUPPORTED API's
123 public int getColumnDisplaySize (int colNum) throws SQLException
125 return( 1 );
127 public boolean isAutoIncrement (int colNum) throws SQLException
129 return( false );
131 public boolean isCurrency (int colNum) throws SQLException
133 return( true );
135 public String getCatalogName (int colNum) throws SQLException
137 return( null );
139 public boolean isSearchable (int colNum) throws SQLException
141 return( true );
143 //java 1.6 methods
144 public boolean isWrapperFor(Class ifact) throws SQLException
146 throw getException(CSQL_NOT_SUPPORTED);
148 public Class unwrap(Class iface) throws SQLException
150 throw getException(CSQL_NOT_SUPPORTED);