23
23
import java .sql .SQLType ;
24
24
import java .util .Arrays ;
25
25
26
- public class DatabaseMetaData implements java .sql .DatabaseMetaData , JdbcV2Wrapper {
27
- private static final Logger log = LoggerFactory .getLogger (DatabaseMetaData .class );
26
+ public class DatabaseMetaDataImpl implements java .sql .DatabaseMetaData , JdbcV2Wrapper {
27
+ private static final Logger log = LoggerFactory .getLogger (DatabaseMetaDataImpl .class );
28
28
public static final String [] TABLE_TYPES = new String [] { "DICTIONARY" , "LOG TABLE" , "MEMORY TABLE" ,
29
29
"REMOTE TABLE" , "TABLE" , "VIEW" , "SYSTEM TABLE" , "TEMPORARY TABLE" };
30
30
@@ -42,7 +42,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData, JdbcV2Wrappe
42
42
* @param connection - connection for which metadata is created
43
43
* @param useCatalogs - if true then getCatalogs() will return non-empty list (not implemented yet)
44
44
*/
45
- public DatabaseMetaData (ConnectionImpl connection , boolean useCatalogs , String url ) throws SQLFeatureNotSupportedException {
45
+ public DatabaseMetaDataImpl (ConnectionImpl connection , boolean useCatalogs , String url ) throws SQLFeatureNotSupportedException {
46
46
if (useCatalogs ) {
47
47
throw new SQLFeatureNotSupportedException ("Catalogs are not supported yet" , ExceptionUtils .SQL_STATE_FEATURE_NOT_SUPPORTED );
48
48
}
@@ -864,7 +864,7 @@ public ResultSet getColumns(String catalog, String schemaPattern, String tableNa
864
864
" ORDER BY TABLE_SCHEM, TABLE_NAME, ORDINAL_POSITION" ;
865
865
try {
866
866
return new MetadataResultSet ((ResultSetImpl ) connection .createStatement ().executeQuery (sql ))
867
- .transform (DATA_TYPE_COL .getColumnName (), DATA_TYPE_COL , DatabaseMetaData ::columnDataTypeToSqlType );
867
+ .transform (DATA_TYPE_COL .getColumnName (), DATA_TYPE_COL , DatabaseMetaDataImpl ::columnDataTypeToSqlType );
868
868
} catch (Exception e ) {
869
869
throw ExceptionUtils .toSqlState (e );
870
870
}
@@ -1002,8 +1002,8 @@ public ResultSet getCrossReference(String parentCatalog, String parentSchema, St
1002
1002
public ResultSet getTypeInfo () throws SQLException {
1003
1003
try {
1004
1004
return new MetadataResultSet ((ResultSetImpl ) connection .createStatement ().executeQuery (DATA_TYPE_INFO_SQL ))
1005
- .transform (DATA_TYPE_COL .getColumnName (), DATA_TYPE_COL , DatabaseMetaData ::dataTypeToSqlTypeInt )
1006
- .transform (NULLABLE_COL .getColumnName (), NULLABLE_COL , DatabaseMetaData ::dataTypeNullability );
1005
+ .transform (DATA_TYPE_COL .getColumnName (), DATA_TYPE_COL , DatabaseMetaDataImpl ::dataTypeToSqlTypeInt )
1006
+ .transform (NULLABLE_COL .getColumnName (), NULLABLE_COL , DatabaseMetaDataImpl ::dataTypeNullability );
1007
1007
} catch (Exception e ) {
1008
1008
throw ExceptionUtils .toSqlState (e );
1009
1009
}
@@ -1065,7 +1065,14 @@ private static String getDataTypeInfoSql() {
1065
1065
1066
1066
@ Override
1067
1067
public ResultSet getIndexInfo (String catalog , String schema , String table , boolean unique , boolean approximate ) throws SQLException {
1068
- return null ;
1068
+ try {
1069
+ String sql = "SELECT null AS TABLE_CAT, null AS TABLE_SCHEM, null AS TABLE_NAME, null AS NON_UNIQUE," +
1070
+ " null AS INDEX_QUALIFIER, null AS INDEX_NAME, null AS TYPE, null AS ORDINAL_POSITION, null AS COLUMN_NAME, null AS ASC_OR_DESC," +
1071
+ " null AS CARDINALITY, null AS PAGES, null AS FILTER_CONDITION LIMIT 0" ;
1072
+ return connection .createStatement ().executeQuery (sql );
1073
+ } catch (Exception e ) {
1074
+ throw ExceptionUtils .toSqlState (e );
1075
+ }
1069
1076
}
1070
1077
1071
1078
@ Override
0 commit comments