2323import java .sql .SQLType ;
2424import java .util .Arrays ;
2525
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 );
2828 public static final String [] TABLE_TYPES = new String [] { "DICTIONARY" , "LOG TABLE" , "MEMORY TABLE" ,
2929 "REMOTE TABLE" , "TABLE" , "VIEW" , "SYSTEM TABLE" , "TEMPORARY TABLE" };
3030
@@ -42,7 +42,7 @@ public class DatabaseMetaData implements java.sql.DatabaseMetaData, JdbcV2Wrappe
4242 * @param connection - connection for which metadata is created
4343 * @param useCatalogs - if true then getCatalogs() will return non-empty list (not implemented yet)
4444 */
45- public DatabaseMetaData (ConnectionImpl connection , boolean useCatalogs , String url ) throws SQLFeatureNotSupportedException {
45+ public DatabaseMetaDataImpl (ConnectionImpl connection , boolean useCatalogs , String url ) throws SQLFeatureNotSupportedException {
4646 if (useCatalogs ) {
4747 throw new SQLFeatureNotSupportedException ("Catalogs are not supported yet" , ExceptionUtils .SQL_STATE_FEATURE_NOT_SUPPORTED );
4848 }
@@ -864,7 +864,7 @@ public ResultSet getColumns(String catalog, String schemaPattern, String tableNa
864864 " ORDER BY TABLE_SCHEM, TABLE_NAME, ORDINAL_POSITION" ;
865865 try {
866866 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 );
868868 } catch (Exception e ) {
869869 throw ExceptionUtils .toSqlState (e );
870870 }
@@ -1002,8 +1002,8 @@ public ResultSet getCrossReference(String parentCatalog, String parentSchema, St
10021002 public ResultSet getTypeInfo () throws SQLException {
10031003 try {
10041004 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 );
10071007 } catch (Exception e ) {
10081008 throw ExceptionUtils .toSqlState (e );
10091009 }
@@ -1065,7 +1065,14 @@ private static String getDataTypeInfoSql() {
10651065
10661066 @ Override
10671067 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+ }
10691076 }
10701077
10711078 @ Override
0 commit comments