public String getPGName() throws SQLException { if (!_isValid) throw new PSQLException(GT.tr("Cannot reference a savepoint after it has been released."), PSQLState.INVALID_SAVEPOINT_SPECIFICATION); if (_isNamed) { // We need to quote and escape the name in case it // contains spaces/quotes/etc. // return Utils.appendEscapedIdentifier(null, _name).toString(); } return "JDBC_SAVEPOINT_" + _id; }
static String addReturning(BaseConnection connection, String sql, String columns[], boolean escape) throws SQLException { if (!connection.haveMinimumServerVersion("8.2")) throw new PSQLException(GT.tr("Returning autogenerated keys is only supported for 8.2 and later servers."), PSQLState.NOT_IMPLEMENTED); sql = sql.trim(); if (sql.endsWith(";")) sql = sql.substring(0, sql.length()-1); StringBuffer sb = new StringBuffer(sql); sb.append(" RETURNING "); for (int i=0; i<columns.length; i++) { if (i != 0) sb.append(", "); // If given user provided column names, quote and escape them. // This isn't likely to be popular as it enforces case sensitivity, // but it does match up with our handling of things like // DatabaseMetaData.getColumns and is necessary for the same // reasons. if (escape) Utils.appendEscapedIdentifier(sb, columns[i]); else sb.append(columns[i]); } return sb.toString(); }
Utils.appendEscapedIdentifier(insertSQL, columnName); if ( i < numColumns - 1 )
Utils.appendEscapedIdentifier(updateSQL, column); updateSQL.append(" = ?"); Utils.appendEscapedIdentifier(updateSQL, primaryKey.name); updateSQL.append(" = ?");
Utils.appendEscapedIdentifier(deleteSQL, ((PrimaryKey)primaryKeys.get(i)).name); deleteSQL.append(" = ?"); if ( i < numKeys - 1 )
Utils.appendEscapedIdentifier(sb, cursorName); Utils.appendEscapedIdentifier(sb, cursorName); connection.execSQLUpdate(sb.toString()); ((AbstractJdbc2ResultSet)rs).setRefCursor(cursorName);
public String getPGName() throws SQLException { if (!_isValid) throw new PSQLException(GT.tr("Cannot reference a savepoint after it has been released."), PSQLState.INVALID_SAVEPOINT_SPECIFICATION); if (_isNamed) { // We need to quote and escape the name in case it // contains spaces/quotes/etc. // return Utils.appendEscapedIdentifier(null, _name).toString(); } return "JDBC_SAVEPOINT_" + _id; }
public String getPGName() throws SQLException { if (!_isValid) throw new PSQLException(GT.tr("Cannot reference a savepoint after it has been released."), PSQLState.INVALID_SAVEPOINT_SPECIFICATION); if (_isNamed) { // We need to quote and escape the name in case it // contains spaces/quotes/etc. // return Utils.appendEscapedIdentifier(null, _name).toString(); } return "JDBC_SAVEPOINT_" + _id; }
static String addReturning(BaseConnection connection, String sql, String columns[], boolean escape) throws SQLException { if (!connection.haveMinimumServerVersion("8.2")) throw new PSQLException(GT.tr("Returning autogenerated keys is only supported for 8.2 and later servers."), PSQLState.NOT_IMPLEMENTED); sql = sql.trim(); if (sql.endsWith(";")) sql = sql.substring(0, sql.length()-1); StringBuffer sb = new StringBuffer(sql); sb.append(" RETURNING "); for (int i=0; i<columns.length; i++) { if (i != 0) sb.append(", "); // If given user provided column names, quote and escape them. // This isn't likely to be popular as it enforces case sensitivity, // but it does match up with our handling of things like // DatabaseMetaData.getColumns and is necessary for the same // reasons. if (escape) Utils.appendEscapedIdentifier(sb, columns[i]); else sb.append(columns[i]); } return sb.toString(); }
static String addReturning(BaseConnection connection, String sql, String columns[], boolean escape) throws SQLException { if (!connection.haveMinimumServerVersion("8.2")) throw new PSQLException(GT.tr("Returning autogenerated keys is only supported for 8.2 and later servers."), PSQLState.NOT_IMPLEMENTED); sql = sql.trim(); if (sql.endsWith(";")) sql = sql.substring(0, sql.length()-1); StringBuffer sb = new StringBuffer(sql); sb.append(" RETURNING "); for (int i=0; i<columns.length; i++) { if (i != 0) sb.append(", "); // If given user provided column names, quote and escape them. // This isn't likely to be popular as it enforces case sensitivity, // but it does match up with our handling of things like // DatabaseMetaData.getColumns and is necessary for the same // reasons. if (escape) Utils.appendEscapedIdentifier(sb, columns[i]); else sb.append(columns[i]); } return sb.toString(); }
Utils.appendEscapedIdentifier(insertSQL, columnName); if ( i < numColumns - 1 )
Utils.appendEscapedIdentifier(insertSQL, columnName); if ( i < numColumns - 1 )
Utils.appendEscapedIdentifier(updateSQL, column); updateSQL.append(" = ?"); Utils.appendEscapedIdentifier(updateSQL, primaryKey.name); updateSQL.append(" = ?");
Utils.appendEscapedIdentifier(updateSQL, column); updateSQL.append(" = ?"); Utils.appendEscapedIdentifier(updateSQL, primaryKey.name); updateSQL.append(" = ?");
Utils.appendEscapedIdentifier(deleteSQL, ((PrimaryKey)primaryKeys.get(i)).name); deleteSQL.append(" = ?"); if ( i < numKeys - 1 )
Utils.appendEscapedIdentifier(deleteSQL, ((PrimaryKey)primaryKeys.get(i)).name); deleteSQL.append(" = ?"); if ( i < numKeys - 1 )
Utils.appendEscapedIdentifier(sb, cursorName); Utils.appendEscapedIdentifier(sb, cursorName); connection.execSQLUpdate(sb.toString()); ((AbstractJdbc2ResultSet)rs).setRefCursor(cursorName);
Utils.appendEscapedIdentifier(sb, cursorName); Utils.appendEscapedIdentifier(sb, cursorName); connection.execSQLUpdate(sb.toString()); ((AbstractJdbc2ResultSet)rs).setRefCursor(cursorName);