org.verdictdb.connection.JdbcQueryResult Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of verdictdb-core Show documentation
Show all versions of verdictdb-core Show documentation
Platform-independent, interactive-speed data analytics system
The newest version!
/*
* Copyright 2018 University of Michigan
*
* Licensed 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.verdictdb.connection;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import org.verdictdb.commons.AttributeValueRetrievalHelper;
public class JdbcQueryResult extends AttributeValueRetrievalHelper implements DbmsQueryResult {
private static final long serialVersionUID = 2576550992419489091L;
List columnNames = new ArrayList<>();
List columnTypes = new ArrayList<>();
// ResultSet resultSet;
List> result = new ArrayList<>();
int cursor = -1;
DbmsQueryResultMetaData dbmsQueryResultMetaData = new DbmsQueryResultMetaData();
public JdbcQueryResult(ResultSet resultSet) throws SQLException {
List isCurrency = new ArrayList<>();
List isNullable = new ArrayList<>();
List precision = new ArrayList<>();
List scale = new ArrayList<>();
List columnDisplaySize = new ArrayList<>();
List isAutoIncrement = new ArrayList<>();
List columnClassName = new ArrayList<>();
ResultSetMetaData meta = resultSet.getMetaData();
int columnCount = meta.getColumnCount();
for (int i = 0; i < columnCount; i++) {
columnNames.add(meta.getColumnLabel(i + 1));
columnTypes.add(meta.getColumnType(i + 1));
precision.add(meta.getPrecision(i + 1));
scale.add(meta.getScale(i + 1));
columnDisplaySize.add(meta.getColumnDisplaySize(i + 1));
isNullable.add(meta.isNullable(i + 1));
isCurrency.add(meta.isCurrency(i + 1));
isAutoIncrement.add(meta.isAutoIncrement(i + 1));
columnClassName.add(meta.getColumnClassName(i + 1));
}
dbmsQueryResultMetaData.columnDisplaySize = columnDisplaySize;
dbmsQueryResultMetaData.isAutoIncrement = isAutoIncrement;
dbmsQueryResultMetaData.isCurrency = isCurrency;
dbmsQueryResultMetaData.isNullable = isNullable;
dbmsQueryResultMetaData.precision = precision;
dbmsQueryResultMetaData.scale = scale;
dbmsQueryResultMetaData.columnClassName = columnClassName;
while (resultSet.next()) {
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy