org.tarantool.jdbc.SQLResultHolder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of connector Show documentation
Show all versions of connector Show documentation
Tarantool client for java
The newest version!
package org.tarantool.jdbc;
import org.tarantool.SqlProtoUtils;
import java.util.Collections;
import java.util.List;
/**
* Union wrapper for SQL query results as well as
* SQL update results.
*/
public class SQLResultHolder {
public static final int NO_UPDATE_COUNT = -1;
private final List sqlMetadata;
private final List> rows;
private final int updateCount;
private final List generatedIds;
public SQLResultHolder(List sqlMetadata,
List> rows,
int updateCount,
List generatedIds) {
this.sqlMetadata = sqlMetadata;
this.rows = rows;
this.updateCount = updateCount;
this.generatedIds = generatedIds;
}
public static SQLResultHolder ofQuery(final List sqlMetadata,
final List> rows) {
return new SQLResultHolder(sqlMetadata, rows, NO_UPDATE_COUNT, Collections.emptyList());
}
public static SQLResultHolder ofEmptyQuery() {
return ofQuery(Collections.emptyList(), Collections.emptyList());
}
public static SQLResultHolder ofUpdate(int updateCount, List generatedIds) {
return new SQLResultHolder(null, null, updateCount, generatedIds);
}
public List getSqlMetadata() {
return sqlMetadata;
}
public List> getRows() {
return rows;
}
public int getUpdateCount() {
return updateCount;
}
public List getGeneratedIds() {
return generatedIds;
}
public boolean isQueryResult() {
return sqlMetadata != null && rows != null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy