public boolean execute(String p_sql) throws SQLException { return executeWithFlags(p_sql, 0); }
public int executeUpdate(String p_sql) throws SQLException { executeWithFlags(p_sql, QueryExecutor.QUERY_NO_RESULTS); return getNoResultUpdateCount(); }
public java.sql.ResultSet executeQuery(String p_sql) throws SQLException { if (!executeWithFlags(p_sql, 0)) { throw new PSQLException(GT.tr("No results were returned by the query."), PSQLState.NO_DATA); } return getSingleResultSet(); }
private boolean executeCachedSql(String sql, int flags, String[] columnNames) throws SQLException { PreferQueryMode preferQueryMode = connection.getPreferQueryMode(); // Simple statements should not replace ?, ? with $1, $2 boolean shouldUseParameterized = false; QueryExecutor queryExecutor = connection.getQueryExecutor(); Object key = queryExecutor .createQueryKey(sql, replaceProcessingEnabled, shouldUseParameterized, columnNames); CachedQuery cachedQuery; boolean shouldCache = preferQueryMode == PreferQueryMode.EXTENDED_CACHE_EVERYTHING; if (shouldCache) { cachedQuery = queryExecutor.borrowQueryByKey(key); } else { cachedQuery = queryExecutor.createQueryByKey(key); } if (wantsGeneratedKeysOnce) { SqlCommand sqlCommand = cachedQuery.query.getSqlCommand(); wantsGeneratedKeysOnce = sqlCommand != null && sqlCommand.isReturningKeywordPresent(); } boolean res; try { res = executeWithFlags(cachedQuery, flags); } finally { if (shouldCache) { queryExecutor.releaseQuery(cachedQuery); } } return res; }