public void setStringParameter(int index, String value, int oid) throws SQLException { StringBuffer sbuf = new StringBuffer(2 + value.length() * 11 / 10); // Add 10% for escaping. if (useEStringSyntax) sbuf.append(' ').append('E'); sbuf.append('\''); Utils.appendEscapedLiteral(sbuf, value, false); sbuf.append('\''); setLiteralParameter(index, sbuf.toString(), oid); }
public String escapeString(String str) throws SQLException { return Utils.appendEscapedLiteral(null, str, protoConnection.getStandardConformingStrings()).toString(); }
private void runInitialQueries(ProtocolConnection protoConnection, Properties info, Logger logger) throws SQLException { String dbVersion = protoConnection.getServerVersion(); if (dbVersion.compareTo("9.0") >= 0) { SetupQueryRunner.run(protoConnection, "SET extra_float_digits = 3", false); } String appName = info.getProperty("ApplicationName"); if (appName != null && dbVersion.compareTo("9.0") >= 0) { StringBuffer sql = new StringBuffer(); sql.append("SET application_name = '"); Utils.appendEscapedLiteral(sql, appName, protoConnection.getStandardConformingStrings()); sql.append("'"); SetupQueryRunner.run(protoConnection, sql.toString(), false); } }
p = Utils.appendEscapedLiteral(p, param, standardConformingStrings); } catch (SQLException sqle) {
public void setClientInfo(String name, String value) throws SQLClientInfoException { if (haveMinimumServerVersion("9.0") && "ApplicationName".equals(name)) { if (value == null) value = ""; try { StringBuffer sql = new StringBuffer("SET application_name = '"); Utils.appendEscapedLiteral(sql, value, getStandardConformingStrings()); sql.append("'"); execSQLUpdate(sql.toString()); } catch (SQLException sqle) { Map<String, ClientInfoStatus> failures = new HashMap<String, ClientInfoStatus>(); failures.put(name, ClientInfoStatus.REASON_UNKNOWN); throw new SQLClientInfoException(GT.tr("Failed to set ClientInfo property: {0}", "ApplicationName"), sqle.getSQLState(), failures, sqle); } _clientInfo.put(name, value); return; } Map<String, ClientInfoStatus> failures = new HashMap<String, ClientInfoStatus>(); failures.put(name, ClientInfoStatus.REASON_UNKNOWN_PROPERTY); throw new SQLClientInfoException(GT.tr("ClientInfo property not supported."), PSQLState.NOT_IMPLEMENTED.getState(), failures); }
Utils.appendEscapedLiteral(sb, appName, protoConnection.getStandardConformingStrings()); sb.append("'"); SetupQueryRunner.run(protoConnection, sb.toString(), false);
public void setStringParameter(int index, String value, int oid) throws SQLException { StringBuffer sbuf = new StringBuffer(2 + value.length() * 11 / 10); // Add 10% for escaping. if (useEStringSyntax) sbuf.append(' ').append('E'); sbuf.append('\''); Utils.appendEscapedLiteral(sbuf, value, false); sbuf.append('\''); setLiteralParameter(index, sbuf.toString(), oid); }
public void setStringParameter(int index, String value, int oid) throws SQLException { StringBuffer sbuf = new StringBuffer(2 + value.length() * 11 / 10); // Add 10% for escaping. if (useEStringSyntax) sbuf.append(' ').append('E'); sbuf.append('\''); Utils.appendEscapedLiteral(sbuf, value, false); sbuf.append('\''); setLiteralParameter(index, sbuf.toString(), oid); }
public String escapeString(String str) throws SQLException { return Utils.appendEscapedLiteral(null, str, protoConnection.getStandardConformingStrings()).toString(); }
public String escapeString(String str) throws SQLException { return Utils.appendEscapedLiteral(null, str, protoConnection.getStandardConformingStrings()).toString(); }
private void runInitialQueries(ProtocolConnection protoConnection, Properties info, Logger logger) throws SQLException { String dbVersion = protoConnection.getServerVersion(); if (dbVersion.compareTo("9.0") >= 0) { SetupQueryRunner.run(protoConnection, "SET extra_float_digits = 3", false); } String appName = info.getProperty("ApplicationName"); if (appName != null && dbVersion.compareTo("9.0") >= 0) { StringBuffer sql = new StringBuffer(); sql.append("SET application_name = '"); Utils.appendEscapedLiteral(sql, appName, protoConnection.getStandardConformingStrings()); sql.append("'"); SetupQueryRunner.run(protoConnection, sql.toString(), false); } }
p = Utils.appendEscapedLiteral(p, param, standardConformingStrings); } catch (SQLException sqle) {
p = Utils.appendEscapedLiteral(p, param, standardConformingStrings); } catch (SQLException sqle) {
public void setClientInfo(String name, String value) throws SQLClientInfoException { if (haveMinimumServerVersion("9.0") && "ApplicationName".equals(name)) { if (value == null) value = ""; try { StringBuffer sql = new StringBuffer("SET application_name = '"); Utils.appendEscapedLiteral(sql, value, getStandardConformingStrings()); sql.append("'"); execSQLUpdate(sql.toString()); } catch (SQLException sqle) { Map<String, ClientInfoStatus> failures = new HashMap<String, ClientInfoStatus>(); failures.put(name, ClientInfoStatus.REASON_UNKNOWN); throw new SQLClientInfoException(GT.tr("Failed to set ClientInfo property: {0}", "ApplicationName"), sqle.getSQLState(), failures, sqle); } _clientInfo.put(name, value); return; } Map<String, ClientInfoStatus> failures = new HashMap<String, ClientInfoStatus>(); failures.put(name, ClientInfoStatus.REASON_UNKNOWN_PROPERTY); throw new SQLClientInfoException(GT.tr("ClientInfo property not supported."), PSQLState.NOT_IMPLEMENTED.getState(), failures); }
Utils.appendEscapedLiteral(sb, appName, protoConnection.getStandardConformingStrings()); sb.append("'"); SetupQueryRunner.run(protoConnection, sb.toString(), false);