@Override public String getSQL() { return StringUtils.quoteStringSQL(value); }
@Override public String getSQL() { return "CAST(" + StringUtils.quoteStringSQL(value) + " AS VARCHAR_IGNORECASE)"; }
@Override public String queryFromInclusiveModificationsForPipelineRange(String pipelineName, Integer fromCounter, Integer toCounter) { return "WITH LINK(id) AS ( " + " SELECT id " + " FROM pipelines " + " WHERE name = " + StringUtils.quoteStringSQL( pipelineName) // using string concatenation because Hibernate does not seem to be able to replace named or positional parameters here + " AND counter >= " + fromCounter + " AND counter <= " + toCounter + " UNION ALL " + " SELECT mod.pipelineId " + " FROM link " + " INNER JOIN pipelineMaterialRevisions pmr ON link.id = pmr.pipelineId " + " INNER JOIN modifications mod ON pmr.toRevisionId >= mod.id and pmr.actualFromRevisionId <= mod.id AND pmr.materialId = mod.materialId " + " WHERE mod.pipelineId IS NOT NULL" + ")" + "SELECT DISTINCT id FROM link WHERE id IS NOT NULL"; }
public static <T> String joinWithQuotesForSql(T[] array) { StringBuilder builder = new StringBuilder(); for (int i = 0; i < array.length; i++) { T t = array[i]; builder.append(quoteStringSQL(t.toString())); if (i < array.length - 1) { builder.append(','); } } return builder.toString(); } }
@Override public String getCreateSQL() { StringBuilder buff = new StringBuilder("COMMENT ON "); buff.append(getTypeName(objectType)).append(' '). append(objectName).append(" IS "); if (commentText == null) { buff.append("NULL"); } else { buff.append(StringUtils.quoteStringSQL(commentText)); } return buff.toString(); }
@Override public String getSQL() { return StringUtils.quoteStringSQL(getString()); }
@Override public String getCreateSQL() { StringBuilder buff = new StringBuilder("CREATE FORCE ALIAS "); buff.append(getSQL()); if (deterministic) { buff.append(" DETERMINISTIC"); } if (!bufferResultSetToLocalTemp) { buff.append(" NOBUFFER"); } if (source != null) { buff.append(" AS ").append(StringUtils.quoteStringSQL(source)); } else { buff.append(" FOR ").append(Parser.quoteIdentifier( className + "." + methodName)); } return buff.toString(); }
@Override public String getCreateSQLForCopy(Table forTable, String quotedName) { StringBuilder buff = new StringBuilder("ALTER TABLE "); buff.append(forTable.getSQL()).append(" ADD CONSTRAINT "); if (forTable.isHidden()) { buff.append("IF NOT EXISTS "); } buff.append(quotedName); if (comment != null) { buff.append(" COMMENT ").append(StringUtils.quoteStringSQL(comment)); } buff.append(" CHECK").append(StringUtils.enclose(expr.getSQL())) .append(" NOCHECK"); return buff.toString(); }
@Override public String getCreateSQLForCopy(Table targetTable, String quotedName) { StringBuilder buff = new StringBuilder("CREATE "); buff.append(indexType.getSQL()); buff.append(' '); if (table.isHidden()) { buff.append("IF NOT EXISTS "); } buff.append(quotedName); buff.append(" ON ").append(targetTable.getSQL()); if (comment != null) { buff.append(" COMMENT ").append(StringUtils.quoteStringSQL(comment)); } buff.append('(').append(getColumnListSQL()).append(')'); return buff.toString(); }
buff.append(" COMMENT ").append(StringUtils.quoteStringSQL(comment)); append(StringUtils.quoteStringSQL(driver)). append(", "). append(StringUtils.quoteStringSQL(url)). append(", "). append(StringUtils.quoteStringSQL(user)). append(", "). append(StringUtils.quoteStringSQL(password)). append(", "). append(StringUtils.quoteStringSQL(originalTable)).
/** * Convert a string to a SQL literal. Null is converted to NULL. The text is * enclosed in single quotes. If there are any special characters, the * method STRINGDECODE is used. * * @param s the text to convert. * @return the SQL literal */ public static String quoteStringSQL(String s) { if (s == null) { return "NULL"; } int length = s.length(); StringBuilder buff = new StringBuilder(length + 2); buff.append('\''); for (int i = 0; i < length; i++) { char c = s.charAt(i); if (c == '\'') { buff.append(c); } else if (c < ' ' || c > 127) { // need to start from the beginning because maybe there was a \ // that was not quoted return "STRINGDECODE(" + quoteStringSQL(javaEncode(s)) + ")"; } buff.append(c); } buff.append('\''); return buff.toString(); }
@Override public String getCreateSQLForCopy(Table targetTable, String quotedName) { StringBuilder buff = new StringBuilder("CREATE FORCE TRIGGER "); buff.append(quotedName); if (insteadOf) { buff.append(" INSTEAD OF "); } else if (before) { buff.append(" BEFORE "); } else { buff.append(" AFTER "); } buff.append(getTypeNameList()); buff.append(" ON ").append(targetTable.getSQL()); if (rowBased) { buff.append(" FOR EACH ROW"); } if (noWait) { buff.append(" NOWAIT"); } else { buff.append(" QUEUE ").append(queueSize); } if (triggerClassName != null) { buff.append(" CALL ").append(Parser.quoteIdentifier(triggerClassName)); } else { buff.append(" AS ").append(StringUtils.quoteStringSQL(triggerSource)); } return buff.toString(); }
/** * Get the CREATE SQL statement for this object. * * @param password true if the password (actually the salt and hash) should * be returned * @return the SQL statement */ public String getCreateSQL(boolean password) { StringBuilder buff = new StringBuilder("CREATE USER IF NOT EXISTS "); buff.append(getSQL()); if (comment != null) { buff.append(" COMMENT ").append(StringUtils.quoteStringSQL(comment)); } if (password) { buff.append(" SALT '"). append(StringUtils.convertBytesToHex(salt)). append("' HASH '"). append(StringUtils.convertBytesToHex(passwordHash)). append('\''); } else { buff.append(" PASSWORD ''"); } if (admin) { buff.append(" ADMIN"); } return buff.toString(); }
@Override public String getSQL() { String s; if (type == Value.CLOB) { s = getString(); return StringUtils.quoteStringSQL(s); } byte[] buff = getBytes(); s = StringUtils.convertBytesToHex(buff); return "X'" + s + "'"; }
@Override public String getSQL() { String s; if (type == Value.CLOB) { s = getString(); return StringUtils.quoteStringSQL(s); } byte[] buff = getBytes(); s = StringUtils.convertBytesToHex(buff); return "X'" + s + "'"; }
break; buff.append(StringUtils.quoteStringSQL(new String(chars, 0, len))). append(", NULL)"); String sql = buff.toString();
buff.append(" COMMENT ").append(StringUtils.quoteStringSQL(comment));
private String getCreateSQLForCopy(Table forTable, String quotedName, boolean internalIndex) { StatementBuilder buff = new StatementBuilder("ALTER TABLE "); buff.append(forTable.getSQL()).append(" ADD CONSTRAINT "); if (forTable.isHidden()) { buff.append("IF NOT EXISTS "); } buff.append(quotedName); if (comment != null) { buff.append(" COMMENT ").append(StringUtils.quoteStringSQL(comment)); } buff.append(' ').append(getConstraintType().getSqlName()).append('('); for (IndexColumn c : columns) { buff.appendExceptFirst(", "); buff.append(Parser.quoteIdentifier(c.column.getName())); } buff.append(')'); if (internalIndex && indexOwner && forTable == this.table) { buff.append(" INDEX ").append(index.getSQL()); } return buff.toString(); }
buff.append(" COMMENT ").append(StringUtils.quoteStringSQL(comment));
buff.append(" COMMENT ").append(StringUtils.quoteStringSQL(comment));