/** * Get {@link SnappyType} for given JDBC {@link Types}. */ public static SnappyType getThriftSQLType(int jdbcType) { return getThriftSQLType(jdbcType, false); }
private ColumnValueConverter getConverterForSet(int snappyTypeValue, String targetType, int columnPosition) throws SQLException { ColumnValueConverter conv = getConverter(snappyTypeValue, targetType, true, columnPosition); // for the rare case when underlying type itself is a NULLTYPE don't fall // into infinite recursion but use NULL_ONLY_TYPE to fail for set* calls return (conv != NULL_TYPE) ? conv : NULL_ONLY_TYPE; }
public final void setDateTime(int index, java.util.Date date) { setPrimLong(headerSize + index, Converters.getDateTime(date)); }
cv.setString_val(bd.toPlainString()); } else { cv.setDecimal_val(Converters.getDecimal(bd)); Date dtVal = cstmt.getDate(paramPosition); if (dtVal != null) { cv.setDate_val(Converters.getDateTime(dtVal)); break; } else { Time timeVal = cstmt.getTime(paramPosition); if (timeVal != null) { cv.setTime_val(Converters.getDateTime(timeVal)); break; } else { java.sql.Timestamp tsVal = cstmt.getTimestamp(paramPosition); if (tsVal != null) { cv.setTimestamp_val(Converters.getTimestampNanos(tsVal)); break; } else { cv.setNull_val(true); } else { cv.setJava_val(Converters.getJavaObjectAsBytes(o, paramPosition));
for (int toType : allTypes) { if (dmd.supportsConvert(fromType, toType)) { supportedConverts.add(Converters.getThriftSQLType(toType)); convertMap.put(Converters.getThriftSQLType(fromType), supportedConverts); if (dmd.supportsTransactionIsolationLevel(isolationLevel)) { supportedValues.add((int)Converters .getThriftTransactionIsolation(isolationLevel)); for (int rsType : rsTypes) { if (dmd.supportsResultSetType(rsType)) { supportedValues.add(Converters.getThriftResultSetType(rsType)); for (int rsType : rsTypes) { if (dmd.supportsResultSetConcurrency(rsType, concurType)) { supportedValues.add(Converters.getThriftResultSetType(rsType)); supportedValues.add(Converters.getThriftResultSetType(rsType)); supportedValues.add(Converters.getThriftResultSetType(rsType)); supportedValues.add(Converters.getThriftResultSetType(rsType)); supportedValues.add(Converters.getThriftResultSetType(rsType)); supportedValues.add(Converters.getThriftResultSetType(rsType));
/** * {@inheritDoc} */ @Override public boolean ownDeletesAreVisible(int type) throws SQLException { this.conn.lock(); try { initServiceMetaData(); List<Integer> supportedRSTypes = this.serviceMetaData .getFeaturesWithParams().get( ServiceFeatureParameterized.RESULTSET_OWN_DELETES_VISIBLE); return supportedRSTypes != null && supportedRSTypes.contains(Converters.getThriftResultSetType(type)); } finally { this.conn.unlock(); } }
try { source = this.currentHostConnection; this.isolationLevel = Converters.getJdbcIsolation(this.clientService .beginTransaction(source.connId, Converters.getThriftTransactionIsolation(jdbcIsolationLevel), flags, source.token)); if (SanityManager.TraceClientStatement) {
/** * {@inheritDoc} */ @Override public int getColumnType(int column) throws SQLException { return Converters.getJdbcType(getDescriptor(column).type); }
/** * {@inheritDoc} */ @Override public int getDefaultTransactionIsolation() throws SQLException { this.conn.lock(); try { initServiceMetaData(); return Converters.getJdbcIsolation(this.serviceMetaData .getDefaultTransactionIsolation()); } finally { this.conn.unlock(); } }
public final void setTimestamp(int index, Timestamp ts) { setPrimLong(headerSize + index, Converters.getTimestampNanos(ts)); }
public JavaObjectWrapper(Object deserialized, int columnPosition) throws SQLException { this.deserialized = deserialized; this.serialized = Converters.getJavaObjectAsBytes( this.deserialized, columnPosition); }
/** * {@inheritDoc} */ @Override public boolean supportsTransactionIsolationLevel(int level) throws SQLException { this.conn.lock(); try { initServiceMetaData(); List<Integer> supportedIsolationLevels = this.serviceMetaData .getFeaturesWithParams().get( ServiceFeatureParameterized.TRANSACTIONS_SUPPORT_ISOLATION); return (supportedIsolationLevels != null && supportedIsolationLevels .contains((int)Converters.getThriftTransactionIsolation(level))); } finally { this.conn.unlock(); } }
oprot.writeFieldBegin(ColumnValue.DECIMAL_VAL_FIELD_DESC); BigDecimal decimal = (BigDecimal)nonPrimitives[(int)primitives[offset]]; Converters.getDecimal(decimal).write(oprot); break; case 6: // FLOAT
/** * {@inheritDoc} */ @Override public boolean othersInsertsAreVisible(int type) throws SQLException { this.conn.lock(); try { initServiceMetaData(); List<Integer> supportedRSTypes = this.serviceMetaData .getFeaturesWithParams().get( ServiceFeatureParameterized.RESULTSET_OTHERS_INSERTS_VISIBLE); return supportedRSTypes != null && supportedRSTypes.contains(Converters.getThriftResultSetType(type)); } finally { this.conn.unlock(); } }
conn.setTransactionIsolation(Converters.getJdbcIsolation( isolationLevel), txFlags); isolationLevel = Converters.getThriftTransactionIsolation( conn.getTransactionIsolation()); } else {
private void registerOutputParameters(CallableStatement cstmt, Map<Integer, OutputParameter> outputParams) throws SQLException { if (outputParams != null && !outputParams.isEmpty()) { OutputParameter outParam; int jdbcType; for (Map.Entry<Integer, OutputParameter> param : outputParams .entrySet()) { outParam = param.getValue(); jdbcType = Converters.getJdbcType(outParam.type); int paramPosition = param.getKey(); if (outParam.isSetScale()) { cstmt.registerOutParameter(paramPosition, jdbcType, outParam.scale); } else if (outParam.isSetTypeName()) { cstmt.registerOutParameter(paramPosition, jdbcType, outParam.typeName); } else { cstmt.registerOutParameter(paramPosition, jdbcType); } } } }
} else { conn = (EngineConnection)InternalDriver.activeDriver() .connect(protocol, props, Converters.getJdbcIsolation( snappydataConstants.DEFAULT_TRANSACTION_ISOLATION)); conn.setAutoCommit(snappydataConstants.DEFAULT_AUTOCOMMIT);
public final void setTimestamp(int index, java.util.Date ts) { setPrimLong(headerSize + index, Converters.getTimestampNanos(ts)); }
protected final String getString(final int columnIndex, final int snappyTypeValue, final Row row) throws SQLException { ColumnValueConverter cvc = Converters.getConverter( snappyTypeValue, "String", false, columnIndex); String str = cvc.toString(row, columnIndex, this.service); this.wasNull = (str == null); return str; }
/** * {@inheritDoc} */ @Override public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException { OutputParameter outParam = new OutputParameter( Converters.getThriftSQLType(sqlType)); getOutputParamsSet().put(parameterIndex, outParam); }