AMashenkov commented on code in PR #6474: URL: https://github.com/apache/ignite-3/pull/6474#discussion_r2297837097
########## modules/jdbc/src/main/java/org/apache/ignite/internal/jdbc2/JdbcResultSetMetadata.java: ########## @@ -0,0 +1,223 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.jdbc2; + +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.util.List; +import org.apache.ignite.internal.jdbc.JdbcConverterUtils; +import org.apache.ignite.internal.jdbc.proto.event.JdbcColumnMeta; +import org.apache.ignite.sql.ColumnMetadata; +import org.apache.ignite.sql.ColumnMetadata.ColumnOrigin; +import org.apache.ignite.sql.ColumnType; +import org.apache.ignite.sql.ResultSetMetadata; + +/** + * JDBC result set metadata implementation. + */ +public class JdbcResultSetMetadata implements ResultSetMetaData { + private static final int COLUMN_DISPLAY_SIZE = 30; + + private final List<ColumnMetadata> cols; + + /** + * Constructor. + * + * @param metadata Metadata. + */ + public JdbcResultSetMetadata(ResultSetMetadata metadata) { + if (metadata == null) { + throw new IllegalArgumentException("metadata"); + } + this.cols = metadata.columns(); + } + + /** {@inheritDoc} */ + @Override + public int getColumnCount() throws SQLException { + return cols.size(); + } + + /** {@inheritDoc} */ + @Override + public boolean isAutoIncrement(int column) throws SQLException { + column(column); + return false; + } + + /** {@inheritDoc} */ + @Override + public boolean isCaseSensitive(int column) throws SQLException { + column(column); + return false; + } + + /** {@inheritDoc} */ + @Override + public boolean isSearchable(int column) throws SQLException { + column(column); + return false; + } + + /** {@inheritDoc} */ + @Override + public boolean isCurrency(int column) throws SQLException { + column(column); + return false; + } + + /** {@inheritDoc} */ + @Override + public int isNullable(int column) throws SQLException { + return column(column).nullable() ? columnNullable : columnNoNulls; + } + + /** {@inheritDoc} */ + @Override + public boolean isSigned(int column) throws SQLException { + column(column); + return true; + } + + /** {@inheritDoc} */ + @Override + public int getColumnDisplaySize(int column) throws SQLException { + column(column); + return COLUMN_DISPLAY_SIZE; + } + + /** {@inheritDoc} */ + @Override + public String getColumnLabel(int column) throws SQLException { + ColumnMetadata metadata = column(column); + return metadata.name(); + } + + /** {@inheritDoc} */ + @Override + public String getColumnName(int column) throws SQLException { + ColumnMetadata metadata = column(column); + ColumnOrigin origin = metadata.origin(); + // Compatibility with the existing driver + if (origin != null && origin.columnName() != null) { Review Comment: When the migration to Client API will be done, This comment will make no sense and seems should be removed or behavior should be changed. Let's add a TODO in all such places referring to IGNITE-26145 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org