org.postgresql.pljava.internal
Class ExecutionPlan

java.lang.Object
  extended by org.postgresql.pljava.internal.NativeStruct
      extended by org.postgresql.pljava.internal.ExecutionPlan

public class ExecutionPlan
extends NativeStruct

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


Method Summary
 void close()
          Close the plan.
 Portal cursorOpen(java.lang.String cursorName, java.lang.Object[] parameters)
          Set up a cursor that will execute the plan using the internal SPI_cursor_open function
 int execute(java.lang.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(java.lang.String, java.lang.Object[]).
static ExecutionPlan prepare(java.lang.String statement, Oid[] argTypes)
          Create an execution plan for a statement to be executed later using the internal SPI_prepare function.
 
Methods inherited from class org.postgresql.pljava.internal.NativeStruct
getNative, invalidate, isValid, releasePointer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

close

public void close()
Close the plan.


cursorOpen

public Portal cursorOpen(java.lang.String cursorName,
                         java.lang.Object[] parameters)
                  throws java.sql.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.
Throws:
java.sql.SQLException - If the underlying native structure has gone stale.

isCursorPlan

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

Returns:
true if the plan can create a Portal
Throws:
java.sql.SQLException - If the underlying native structure has gone stale.

execute

public int execute(java.lang.Object[] parameters,
                   int rowCount)
            throws java.sql.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.
Returns:
One of the status codes declared in class SPI.
Throws:
java.sql.SQLException - If the underlying native structure has gone stale.

prepare

public static ExecutionPlan prepare(java.lang.String statement,
                                    Oid[] argTypes)
                             throws java.sql.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.
Throws:
java.sql.SQLException
See Also:
Types


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