/** * Send a function call to the PostgreSQL backend. * * @param fnId Function id * @param args FastpathArguments to pass to fastpath * @return null if no data, byte[] otherwise * @throws SQLException if a database-access error occurs. */ public byte[] fastpath(int fnId, FastpathArg[] args) throws SQLException { // Turn fastpath array into a parameter list. ParameterList params = executor.createFastpathParameters(args.length); for (int i = 0; i < args.length; ++i) { args[i].populateParameter(params, i + 1); } // Run it. return executor.fastpathCall(fnId, params, connection.getAutoCommit()); }
/** * Send a function call to the PostgreSQL backend * * @param fnId Function id * @param resultType True if the result is an integer, false for other results * @param args FastpathArguments to pass to fastpath * @return null if no data, Integer if an integer result, or byte[] otherwise * @exception SQLException if a database-access error occurs. */ public Object fastpath(int fnId, boolean resultType, FastpathArg[] args) throws SQLException { // Turn fastpath array into a parameter list. ParameterList params = executor.createFastpathParameters(args.length); for (int i = 0; i < args.length; ++i) { args[i].populateParameter(params, i + 1); } // Run it. byte[] returnValue = executor.fastpathCall(fnId, params, connection.getAutoCommit()); // Interpret results. if (!resultType || returnValue == null) return returnValue; if (returnValue.length != 4) throw new PSQLException(GT.tr("Fastpath call {0} - No result was returned and we expected an integer.", new Integer(fnId)), PSQLState.NO_DATA); return new Integer((returnValue[3] & 255) | ((returnValue[2] & 255) << 8) | ((returnValue[1] & 255) << 16) | ((returnValue[0] & 255) << 24)); }
/** * Send a function call to the PostgreSQL backend * * @param fnId Function id * @param resultType True if the result is an integer, false for other results * @param args FastpathArguments to pass to fastpath * @return null if no data, Integer if an integer result, or byte[] otherwise * @exception SQLException if a database-access error occurs. */ public Object fastpath(int fnId, boolean resultType, FastpathArg[] args) throws SQLException { // Turn fastpath array into a parameter list. ParameterList params = executor.createFastpathParameters(args.length); for (int i = 0; i < args.length; ++i) { args[i].populateParameter(params, i + 1); } // Run it. byte[] returnValue = executor.fastpathCall(fnId, params, connection.getAutoCommit()); // Interpret results. if (!resultType || returnValue == null) return returnValue; if (returnValue.length != 4) throw new PSQLException(GT.tr("Fastpath call {0} - No result was returned and we expected an integer.", new Integer(fnId)), PSQLState.NO_DATA); return new Integer((returnValue[3] & 255) | ((returnValue[2] & 255) << 8) | ((returnValue[1] & 255) << 16) | ((returnValue[0] & 255) << 24)); }
/** * Send a function call to the PostgreSQL backend * * @param fnId Function id * @param resultType True if the result is an integer, false for other results * @param args FastpathArguments to pass to fastpath * @return null if no data, Integer if an integer result, or byte[] otherwise * @exception SQLException if a database-access error occurs. */ public Object fastpath(int fnId, boolean resultType, FastpathArg[] args) throws SQLException { // Turn fastpath array into a parameter list. ParameterList params = executor.createFastpathParameters(args.length); for (int i = 0; i < args.length; ++i) { args[i].populateParameter(params, i + 1); } // Run it. byte[] returnValue = executor.fastpathCall(fnId, params, connection.getAutoCommit()); // Interpret results. if (!resultType || returnValue == null) return returnValue; if (returnValue.length != 4) throw new PSQLException(GT.tr("Fastpath call {0} - No result was returned and we expected an integer.", new Integer(fnId)), PSQLState.NO_DATA); return new Integer((returnValue[3] & 255) | ((returnValue[2] & 255) << 8) | ((returnValue[1] & 255) << 16) | ((returnValue[0] & 255) << 24)); }