org.postgresql.pljava.internal
Class ExecutionPlan

java.lang.Object
  extended byorg.postgresql.pljava.internal.NativeStruct
      extended byorg.postgresql.pljava.internal.ExecutionPlan

public class ExecutionPlan
extends NativeStruct

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


Constructor Summary
ExecutionPlan()
           
 
Method Summary
 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 execp(java.lang.Object[] parameters, int rowCount)
          Execute the plan using the internal SPI_execp function.
 void finalize()
          Finalizers might run by a thread other then the main thread.
 void invalidate()
          Invalidates this structure and frees up memory using the internal function SPI_freeplan
 boolean isCursorPlan()
          Returns true if this ExecutionPlan can create a Portal using cursorOpen(java.lang.String, java.lang.Object[]).
 void makeDurable()
          Make this plan durable.
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, isValid, releasePointer
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExecutionPlan

public ExecutionPlan()
Method Detail

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
Returns true 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.

Throws:
java.sql.SQLException - If the underlying native structure has gone stale.

execp

public int execp(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

invalidate

public void invalidate()
Invalidates this structure and frees up memory using the internal function SPI_freeplan

Overrides:
invalidate in class NativeStruct

makeDurable

public void makeDurable()
                 throws java.sql.SQLException
Make this plan durable. This means that the plan will survive until it is explicitly invalidated.

Throws:
java.sql.SQLException - If the underlying native structure has gone stale.

finalize

public void finalize()
Finalizers might run by a thread other then the main thread. If that is the case, the pointer will be stored on a "death row" that will be investegated by the main thread later on.



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