org.postgresql.pljava
Interface Session
- Session
A Session maintains transaction coordinated in-memory data. The data
added since the last commit will be lost on a transaction rollback, i.e.
the Session state is synchronized with the transaction.
Please note that if nested objects (such as lists and maps) are stored
in the session, changes internal to those objects are not subject to
the session semantics since the session is unaware of them.
addSavepointListener
public void addSavepointListener(SavepointListener listener)
Adds the specified listener
to the list of listeners that will
receive savepoint events. This method does nothing if the listener
was already added.
listener
- The listener to be added.
addTransactionListener
public void addTransactionListener(TransactionListener listener)
Adds the specified listener
to the list of listeners that will
receive transactional events. This method does nothing if the listener
was already added.
listener
- The listener to be added.
executeAsSessionUser
public void executeAsSessionUser(Connection conn,
String statement)
throws SQLException
Execute a statement as a session user rather then the effective
user. This is useful when functions declared using
SECURITY DEFINER
wants to give up the definer
rights.
conn
- The connection used for the executionstatement
- The statement to execute
java.sql.Statement.execute(java.lang.String)
getAttribute
public Object getAttribute(String attributeName)
Obtain an attribute from the current session.
attributeName
- The name of the attribute
- The value of the attribute
getObjectPool
public ObjectPool getObjectPool(Class cls)
Return an object pool for the given class. The class must implement
the interface
PooledObject
.
- An object pool that pools object of the given class.
getSessionUserName
public String getSessionUserName()
Return the name of the user that owns the current session.
getUserName
public String getUserName()
Return the name of the effective user. If the currently
executing funciton is declared with
SECURITY DEFINER
,
then this method returns the name of the user that defined
the function, otherwise, this method will return the same
as
getSessionUserName()
.
removeAttribute
public void removeAttribute(String attributeName)
Remove an attribute previously stored in the session. If
no attribute is found, nothing happens.
attributeName
- The name of the attribute.
removeSavepointListener
public void removeSavepointListener(SavepointListener listener)
Removes the specified listener
from the list of listeners that will
receive savepoint events. This method does nothing unless the listener is
found.
listener
- The listener to be removed.
removeTransactionListener
public void removeTransactionListener(TransactionListener listener)
Removes the specified listener
from the list of listeners that will
receive transactional events. This method does nothing unless the listener is
found.
listener
- The listener to be removed.
setAttribute
public void setAttribute(String attributeName,
Object value)
Set an attribute to a value in the current session.
Copyright (c) 2003, 2004, 2005 TADA AB - Taby Sweden. \
Distributed under the terms shown in COPYRIGHT