/** * @deprecated TODO Usage of this method should be removed or revised as current use of default * encoding is not correct. */ @Deprecated public DatabaseParameterBuffer getDatabaseParameterBuffer() throws SQLException { // TODO Instance creation should be done through FbDatabase or database factory? DatabaseParameterBuffer dpb = new DatabaseParameterBufferImp( DatabaseParameterBufferImp.DpbMetaData.DPB_VERSION_1, EncodingFactory.getPlatformEncoding()); for (Map.Entry<String, Object> entry : properties.entrySet()) { String propertyName = entry.getKey(); Object value = entry.getValue(); Integer dpbType = ParameterBufferHelper.getDpbKey(propertyName); if (dpbType == null) continue; if (value instanceof Boolean) { if ((Boolean) value) dpb.addArgument(dpbType); } else if (value instanceof Byte) { dpb.addArgument(dpbType, new byte[] {(Byte) value}); } else if (value instanceof Integer) { dpb.addArgument(dpbType, (Integer) value); } else if (value instanceof String) { dpb.addArgument(dpbType, (String) value); } else if (value == null) dpb.addArgument(dpbType); } return dpb; }
public void setEncoding(String encoding) { if (encoding == null) { return; } setStringProperty(ENCODING_PROPERTY, encoding); if (getStringProperty(LOCAL_ENCODING_PROPERTY) != null) { return; } final EncodingDefinition encodingDefinition = EncodingFactory.getPlatformDefault().getEncodingDefinitionByFirebirdName(encoding); if (encodingDefinition != null && !encodingDefinition.isInformationOnly()) { setStringProperty(LOCAL_ENCODING_PROPERTY, encodingDefinition.getJavaEncodingName()); } }
public void setCharSet(String charSet) { if (charSet == null) { return; } // Normalize the name of the encoding final EncodingDefinition encodingDefinition = EncodingFactory.getPlatformDefault().getEncodingDefinitionByCharsetAlias(charSet); if (encodingDefinition == null) { return; } setStringProperty(LOCAL_ENCODING_PROPERTY, encodingDefinition.getJavaEncodingName()); if (getStringProperty(ENCODING_PROPERTY) != null) { return; } String encoding = encodingDefinition.getFirebirdEncodingName(); if (encoding != null) { setStringProperty(ENCODING_PROPERTY, encoding); } }
/** * Creates a WireConnection (without establishing a connection to the server) with the default * protocol collection. * * @param attachProperties Attach properties */ protected WireConnection(T attachProperties) throws SQLException { this( attachProperties, EncodingFactory.getDefaultInstance(), ProtocolCollection.getDefaultCollection()); }