public synchronized int getPGType(String pgTypeName) throws SQLException { Integer oid = _pgNameToOid.get(pgTypeName); if (oid != null) { return oid; } PreparedStatement oidStatement = getOidStatement(pgTypeName); // Go through BaseStatement to avoid transaction start. if (!((BaseStatement) oidStatement).executeWithFlags(QueryExecutor.QUERY_SUPPRESS_BEGIN)) { throw new PSQLException(GT.tr("No results were returned by the query."), PSQLState.NO_DATA); } oid = Oid.UNSPECIFIED; ResultSet rs = oidStatement.getResultSet(); if (rs.next()) { oid = (int) rs.getLong(1); String internalName = rs.getString(2); _oidToPgName.put(oid, internalName); _pgNameToOid.put(internalName, oid); } _pgNameToOid.put(pgTypeName, oid); rs.close(); return oid; }
if (!((BaseStatement) _getNameStatement).executeWithFlags(QueryExecutor.QUERY_SUPPRESS_BEGIN)) { throw new PSQLException(GT.tr("No results were returned by the query."), PSQLState.NO_DATA);
public synchronized int getPGType(String pgTypeName) throws SQLException { Integer oid = (Integer)_pgNameToOid.get(pgTypeName); if (oid != null) return oid.intValue(); if (_getOidStatement == null) { String sql; if (_conn.haveMinimumServerVersion("7.3")) { sql = "SELECT oid FROM pg_catalog.pg_type WHERE typname = ?"; } else { sql = "SELECT oid FROM pg_type WHERE typname = ?"; } _getOidStatement = _conn.prepareStatement(sql); } _getOidStatement.setString(1, pgTypeName); // Go through BaseStatement to avoid transaction start. if (!((BaseStatement)_getOidStatement).executeWithFlags(QueryExecutor.QUERY_SUPPRESS_BEGIN)) throw new PSQLException(GT.tr("No results were returned by the query."), PSQLState.NO_DATA); oid = new Integer(Oid.UNSPECIFIED); ResultSet rs = _getOidStatement.getResultSet(); if (rs.next()) { oid = new Integer((int)rs.getLong(1)); _oidToPgName.put(oid, pgTypeName); } _pgNameToOid.put(pgTypeName, oid); rs.close(); return oid.intValue(); }
public synchronized String getPGType(int oid) throws SQLException { if (oid == Oid.UNSPECIFIED) return null; String pgTypeName = (String)_oidToPgName.get(new Integer(oid)); if (pgTypeName != null) return pgTypeName; if (_getNameStatement == null) { String sql; if (_conn.haveMinimumServerVersion("7.3")) { sql = "SELECT typname FROM pg_catalog.pg_type WHERE oid = ?"; } else { sql = "SELECT typname FROM pg_type WHERE oid = ?"; } _getNameStatement = _conn.prepareStatement(sql); } _getNameStatement.setInt(1, oid); // Go through BaseStatement to avoid transaction start. if (!((BaseStatement)_getNameStatement).executeWithFlags(QueryExecutor.QUERY_SUPPRESS_BEGIN)) throw new PSQLException(GT.tr("No results were returned by the query."), PSQLState.NO_DATA); ResultSet rs = _getNameStatement.getResultSet(); if (rs.next()) { pgTypeName = rs.getString(1); _pgNameToOid.put(pgTypeName, new Integer(oid)); _oidToPgName.put(new Integer(oid), pgTypeName); } rs.close(); return pgTypeName; }
public synchronized int getPGArrayElement (int oid) throws SQLException { if (oid == Oid.UNSPECIFIED) return Oid.UNSPECIFIED; Integer pgType = (Integer) _pgArrayToPgType.get(new Integer(oid)); if (pgType != null) return pgType.intValue(); if (_getArrayElementOidStatement == null) { String sql; if (_conn.haveMinimumServerVersion("7.3")) { sql = "SELECT e.oid, e.typname FROM pg_catalog.pg_type t, pg_catalog.pg_type e WHERE t.oid = ? and t.typelem = e.oid"; } else { sql = "SELECT e.oid, e.typname FROM pg_type t, pg_type e WHERE t.oid = ? and t.typelem = e.oid"; } _getArrayElementOidStatement = _conn.prepareStatement(sql); } _getArrayElementOidStatement.setInt(1, oid); // Go through BaseStatement to avoid transaction start. if (!((BaseStatement) _getArrayElementOidStatement).executeWithFlags(QueryExecutor.QUERY_SUPPRESS_BEGIN)) throw new PSQLException(GT.tr("No results were returned by the query."), PSQLState.NO_DATA); ResultSet rs = _getArrayElementOidStatement.getResultSet(); if (!rs.next()) throw new PSQLException(GT.tr("No results were returned by the query."), PSQLState.NO_DATA); pgType = new Integer((int)rs.getLong(1)); _pgArrayToPgType.put(new Integer(oid), pgType); _pgNameToOid.put(rs.getString(2), pgType); _oidToPgName.put(pgType, rs.getString(2)); rs.close(); return pgType.intValue(); }
if (!((BaseStatement)_getTypeInfoStatement).executeWithFlags(QueryExecutor.QUERY_SUPPRESS_BEGIN)) throw new PSQLException(GT.tr("No results were returned by the query."), PSQLState.NO_DATA);
.executeWithFlags(QueryExecutor.QUERY_SUPPRESS_BEGIN)) { throw new PSQLException(GT.tr("No results were returned by the query."), PSQLState.NO_DATA);
.executeWithFlags(QueryExecutor.QUERY_SUPPRESS_BEGIN)) { throw new PSQLException(GT.tr("No results were returned by the query."), PSQLState.NO_DATA);
public synchronized char getArrayDelimiter(int oid) throws SQLException { if (oid == Oid.UNSPECIFIED) return ','; Character delim = (Character) _arrayOidToDelimiter.get(new Integer(oid)); if (delim != null) return delim.charValue(); if (_getArrayDelimiterStatement == null) { String sql; if (_conn.haveMinimumServerVersion("7.3")) { sql = "SELECT e.typdelim FROM pg_catalog.pg_type t, pg_catalog.pg_type e WHERE t.oid = ? and t.typelem = e.oid"; } else { sql = "SELECT e.typdelim FROM pg_type t, pg_type e WHERE t.oid = ? and t.typelem = e.oid"; } _getArrayDelimiterStatement = _conn.prepareStatement(sql); } _getArrayDelimiterStatement.setInt(1, oid); // Go through BaseStatement to avoid transaction start. if (!((BaseStatement) _getArrayDelimiterStatement).executeWithFlags(QueryExecutor.QUERY_SUPPRESS_BEGIN)) throw new PSQLException(GT.tr("No results were returned by the query."), PSQLState.NO_DATA); ResultSet rs = _getArrayDelimiterStatement.getResultSet(); if (!rs.next()) throw new PSQLException(GT.tr("No results were returned by the query."), PSQLState.NO_DATA); String s = rs.getString(1); delim = new Character(s.charAt(0)); _arrayOidToDelimiter.put(new Integer(oid), delim); rs.close(); return delim.charValue(); }
public synchronized char getArrayDelimiter(int oid) throws SQLException { if (oid == Oid.UNSPECIFIED) { return ','; } Character delim = _arrayOidToDelimiter.get(oid); if (delim != null) { return delim; } if (_getArrayDelimiterStatement == null) { String sql; sql = "SELECT e.typdelim FROM pg_catalog.pg_type t, pg_catalog.pg_type e " + "WHERE t.oid = ? and t.typelem = e.oid"; _getArrayDelimiterStatement = _conn.prepareStatement(sql); } _getArrayDelimiterStatement.setInt(1, oid); // Go through BaseStatement to avoid transaction start. if (!((BaseStatement) _getArrayDelimiterStatement) .executeWithFlags(QueryExecutor.QUERY_SUPPRESS_BEGIN)) { throw new PSQLException(GT.tr("No results were returned by the query."), PSQLState.NO_DATA); } ResultSet rs = _getArrayDelimiterStatement.getResultSet(); if (!rs.next()) { throw new PSQLException(GT.tr("No results were returned by the query."), PSQLState.NO_DATA); } String s = rs.getString(1); delim = s.charAt(0); _arrayOidToDelimiter.put(oid, delim); rs.close(); return delim; }
public void execSQLUpdate(String s) throws SQLException { BaseStatement stmt = (BaseStatement) createStatement(); if (stmt.executeWithFlags(s, QueryExecutor.QUERY_NO_METADATA | QueryExecutor.QUERY_NO_RESULTS | QueryExecutor.QUERY_SUPPRESS_BEGIN)) throw new PSQLException(GT.tr("A result was returned when none was expected."), PSQLState.TOO_MANY_RESULTS); // Transfer warnings to the connection, since the user never // has a chance to see the statement itself. SQLWarning warnings = stmt.getWarnings(); if (warnings != null) addWarning(warnings); stmt.close(); }
@Override public void execSQLUpdate(String s) throws SQLException { BaseStatement stmt = (BaseStatement) createStatement(); if (stmt.executeWithFlags(s, QueryExecutor.QUERY_NO_METADATA | QueryExecutor.QUERY_NO_RESULTS | QueryExecutor.QUERY_SUPPRESS_BEGIN)) { throw new PSQLException(GT.tr("A result was returned when none was expected."), PSQLState.TOO_MANY_RESULTS); } // Transfer warnings to the connection, since the user never // has a chance to see the statement itself. SQLWarning warnings = stmt.getWarnings(); if (warnings != null) { addWarning(warnings); } stmt.close(); }
/** * Simple query execution. */ public ResultSet execSQLQuery(String s, int resultSetType, int resultSetConcurrency) throws SQLException { BaseStatement stat = (BaseStatement) createStatement(resultSetType, resultSetConcurrency); boolean hasResultSet = stat.executeWithFlags(s, QueryExecutor.QUERY_SUPPRESS_BEGIN); while (!hasResultSet && stat.getUpdateCount() != -1) hasResultSet = stat.getMoreResults(); if (!hasResultSet) throw new PSQLException(GT.tr("No results were returned by the query."), PSQLState.NO_DATA); // Transfer warnings to the connection, since the user never // has a chance to see the statement itself. SQLWarning warnings = stat.getWarnings(); if (warnings != null) addWarning(warnings); return stat.getResultSet(); }
@Override public ResultSet execSQLQuery(String s, int resultSetType, int resultSetConcurrency) throws SQLException { BaseStatement stat = (BaseStatement) createStatement(resultSetType, resultSetConcurrency); boolean hasResultSet = stat.executeWithFlags(s, QueryExecutor.QUERY_SUPPRESS_BEGIN); while (!hasResultSet && stat.getUpdateCount() != -1) { hasResultSet = stat.getMoreResults(); } if (!hasResultSet) { throw new PSQLException(GT.tr("No results were returned by the query."), PSQLState.NO_DATA); } // Transfer warnings to the connection, since the user never // has a chance to see the statement itself. SQLWarning warnings = stat.getWarnings(); if (warnings != null) { addWarning(warnings); } return stat.getResultSet(); }
public synchronized String getPGType(int oid) throws SQLException { if (oid == Oid.UNSPECIFIED) return null; String pgTypeName = (String)_oidToPgName.get(new Integer(oid)); if (pgTypeName != null) return pgTypeName; if (_getNameStatement == null) { String sql; if (_conn.haveMinimumServerVersion("7.3")) { sql = "SELECT typname FROM pg_catalog.pg_type WHERE oid = ?"; } else { sql = "SELECT typname FROM pg_type WHERE oid = ?"; } _getNameStatement = _conn.prepareStatement(sql); } _getNameStatement.setInt(1, oid); // Go through BaseStatement to avoid transaction start. if (!((BaseStatement)_getNameStatement).executeWithFlags(QueryExecutor.QUERY_SUPPRESS_BEGIN)) throw new PSQLException(GT.tr("No results were returned by the query."), PSQLState.NO_DATA); ResultSet rs = _getNameStatement.getResultSet(); if (rs.next()) { pgTypeName = rs.getString(1); _pgNameToOid.put(pgTypeName, new Integer(oid)); _oidToPgName.put(new Integer(oid), pgTypeName); } rs.close(); return pgTypeName; }
public synchronized char getArrayDelimiter(int oid) throws SQLException { if (oid == Oid.UNSPECIFIED) return ','; Character delim = (Character) _arrayOidToDelimiter.get(new Integer(oid)); if (delim != null) return delim.charValue(); if (_getArrayDelimiterStatement == null) { String sql; if (_conn.haveMinimumServerVersion("7.3")) { sql = "SELECT e.typdelim FROM pg_catalog.pg_type t, pg_catalog.pg_type e WHERE t.oid = ? and t.typelem = e.oid"; } else { sql = "SELECT e.typdelim FROM pg_type t, pg_type e WHERE t.oid = ? and t.typelem = e.oid"; } _getArrayDelimiterStatement = _conn.prepareStatement(sql); } _getArrayDelimiterStatement.setInt(1, oid); // Go through BaseStatement to avoid transaction start. if (!((BaseStatement) _getArrayDelimiterStatement).executeWithFlags(QueryExecutor.QUERY_SUPPRESS_BEGIN)) throw new PSQLException(GT.tr("No results were returned by the query."), PSQLState.NO_DATA); ResultSet rs = _getArrayDelimiterStatement.getResultSet(); if (!rs.next()) throw new PSQLException(GT.tr("No results were returned by the query."), PSQLState.NO_DATA); String s = rs.getString(1); delim = new Character(s.charAt(0)); _arrayOidToDelimiter.put(new Integer(oid), delim); rs.close(); return delim.charValue(); }
public void execSQLUpdate(String s) throws SQLException { BaseStatement stmt = (BaseStatement) createStatement(); if (stmt.executeWithFlags(s, QueryExecutor.QUERY_NO_METADATA | QueryExecutor.QUERY_NO_RESULTS | QueryExecutor.QUERY_SUPPRESS_BEGIN)) throw new PSQLException(GT.tr("A result was returned when none was expected."), PSQLState.TOO_MANY_RESULTS); // Transfer warnings to the connection, since the user never // has a chance to see the statement itself. SQLWarning warnings = stmt.getWarnings(); if (warnings != null) addWarning(warnings); stmt.close(); }
public void execSQLUpdate(String s) throws SQLException { BaseStatement stmt = (BaseStatement) createStatement(); if (stmt.executeWithFlags(s, QueryExecutor.QUERY_NO_METADATA | QueryExecutor.QUERY_NO_RESULTS | QueryExecutor.QUERY_SUPPRESS_BEGIN)) throw new PSQLException(GT.tr("A result was returned when none was expected."), PSQLState.TOO_MANY_RESULTS); // Transfer warnings to the connection, since the user never // has a chance to see the statement itself. SQLWarning warnings = stmt.getWarnings(); if (warnings != null) addWarning(warnings); stmt.close(); }
/** * Simple query execution. */ public ResultSet execSQLQuery(String s, int resultSetType, int resultSetConcurrency) throws SQLException { BaseStatement stat = (BaseStatement) createStatement(resultSetType, resultSetConcurrency); boolean hasResultSet = stat.executeWithFlags(s, QueryExecutor.QUERY_SUPPRESS_BEGIN); while (!hasResultSet && stat.getUpdateCount() != -1) hasResultSet = stat.getMoreResults(); if (!hasResultSet) throw new PSQLException(GT.tr("No results were returned by the query."), PSQLState.NO_DATA); // Transfer warnings to the connection, since the user never // has a chance to see the statement itself. SQLWarning warnings = stat.getWarnings(); if (warnings != null) addWarning(warnings); return stat.getResultSet(); }
/** * Simple query execution. */ public ResultSet execSQLQuery(String s, int resultSetType, int resultSetConcurrency) throws SQLException { BaseStatement stat = (BaseStatement) createStatement(resultSetType, resultSetConcurrency); boolean hasResultSet = stat.executeWithFlags(s, QueryExecutor.QUERY_SUPPRESS_BEGIN); while (!hasResultSet && stat.getUpdateCount() != -1) hasResultSet = stat.getMoreResults(); if (!hasResultSet) throw new PSQLException(GT.tr("No results were returned by the query."), PSQLState.NO_DATA); // Transfer warnings to the connection, since the user never // has a chance to see the statement itself. SQLWarning warnings = stat.getWarnings(); if (warnings != null) addWarning(warnings); return stat.getResultSet(); }