org.postgresql.pljava.internal

Class ExecutionPlan


public class ExecutionPlan
extends java.lang.Object

The ExecutionPlan correspons to the execution plan obtained using an internal PostgreSQL SPI_prepare call.

Method Summary

void
close()
Close the plan.
Portal
cursorOpen(String cursorName, Object[] parameters)
Set up a cursor that will execute the plan using the internal SPI_cursor_open function
int
execute(Object[] parameters, int rowCount)
Execute the plan using the internal SPI_execp function.
boolean
isCursorPlan()
Checks if this ExecutionPlan can create a Portal using cursorOpen(String,Object[]).
static ExecutionPlan
prepare(String statement, Oid[] argTypes)
Create an execution plan for a statement to be executed later using the internal SPI_prepare function.

Method Details

close

public void close()
Close the plan.

cursorOpen

public Portal cursorOpen(String cursorName,
                         Object[] parameters)
            throws SQLException
Set up a cursor that will execute the plan using the internal SPI_cursor_open function
Parameters:
cursorName - Name of the cursor or null for a system generated name.
parameters - Values for the parameters.
Returns:
The Portal that represents the opened cursor.

execute

public int execute(Object[] parameters,
                   int rowCount)
            throws SQLException
Execute the plan using the internal SPI_execp function.
Parameters:
parameters - Values for the parameters.
rowCount - The maximum number of tuples to create. A value of rowCount of zero is interpreted as no limit, i.e., run to completion.

isCursorPlan

public boolean isCursorPlan()
            throws SQLException
Checks if this ExecutionPlan can create a Portal using cursorOpen(String,Object[]). This is true if the plan contains only one regular SELECT query.
Returns:
true if the plan can create a Portal

prepare

public static ExecutionPlan prepare(String statement,
                                    Oid[] argTypes)
            throws SQLException
Create an execution plan for a statement to be executed later using the internal SPI_prepare function.
Parameters:
statement - The command string.
argTypes - SQL types of argument types.
Returns:
An execution plan for the prepared statement.
See Also:
java.sql.Types

Copyright (c) 2003, 2004, 2005 TADA AB - Taby Sweden. \ Distributed under the terms shown in COPYRIGHT