use of com.torodb.backend.converters.sql.SqlBinding in project torodb by torodb.
the class SqlHelper method setPreparedStatementValue.
@SuppressWarnings({ "rawtypes", "unchecked" })
public void setPreparedStatementValue(PreparedStatement preparedStatement, int parameterIndex, FieldType fieldType, KvValue<?> value) throws SQLException {
DataTypeForKv dataType = dataTypeProvider.getDataType(fieldType);
KvValueConverter valueConverter = dataType.getKvValueConverter();
Converter converter = dataType.getConverter();
SqlBinding sqlBinding = valueConverter.getSqlBinding();
sqlBinding.set(preparedStatement, parameterIndex, converter.to(value));
}
use of com.torodb.backend.converters.sql.SqlBinding in project torodb by torodb.
the class SqlHelper method setPreparedStatementNullableValue.
@SuppressWarnings({ "rawtypes", "unchecked" })
public void setPreparedStatementNullableValue(PreparedStatement preparedStatement, int parameterIndex, FieldType fieldType, KvValue<?> value) throws SQLException {
DataTypeForKv dataType = dataTypeProvider.getDataType(fieldType);
if (value != null) {
KvValueConverter valueConverter = dataType.getKvValueConverter();
SqlBinding sqlBinding = valueConverter.getSqlBinding();
Converter converter = dataType.getConverter();
sqlBinding.set(preparedStatement, parameterIndex, converter.to(value));
} else {
preparedStatement.setNull(parameterIndex, dataType.getSQLType());
}
}
use of com.torodb.backend.converters.sql.SqlBinding in project torodb by torodb.
the class SqlHelper method getPlaceholder.
@SuppressWarnings({ "rawtypes" })
public String getPlaceholder(FieldType fieldType) {
DataTypeForKv dataType = dataTypeProvider.getDataType(fieldType);
KvValueConverter valueConverter = dataType.getKvValueConverter();
SqlBinding sqlBinding = valueConverter.getSqlBinding();
return sqlBinding.getPlaceholder();
}
use of com.torodb.backend.converters.sql.SqlBinding in project torodb by torodb.
the class SqlHelper method getResultSetValue.
@SuppressWarnings({ "rawtypes" })
public Object getResultSetValue(FieldType fieldType, ResultSet resultSet, int index) throws SQLException {
DataTypeForKv dataType = dataTypeProvider.getDataType(fieldType);
KvValueConverter valueConverter = dataType.getKvValueConverter();
SqlBinding sqlBinding = valueConverter.getSqlBinding();
return sqlBinding.get(resultSet, index);
}
Aggregations