<command>
on a connection.
The forImplementor
method returns an executor
according to the
<implementor name>
associated with the command. The two possibilities
that support standard behavior are a "plain" executor, which simply
executes the SQL text (with any SECURITY DEFINER
identity dropped),
and a "no-op" executor, which (you'll be shocked) does nothing.
Normally, a plain executor is returned if the implementor name is
null (command is for all implementations) or in the list recognized as being
for this implementation (normally just PostgreSQL, case-insensitively, but
adjustable as described below). A no-op executor is returned if there
is an implementor name and it is anything not on the recognized list.
Adjusting the recognized implementor names:
The recognized implementor names are taken from the (comma-separated) string
configuration option pljava.implementors
, which can be set from
ordinary SQL using
SET LOCAL pljava.implementors TO thing, thing, thing
.
It is re-parsed each time forImplementor
is called, which happens
for every <command>
in a deployment descriptor, so that SQL code
early in a deployment descriptor can influence which code blocks later
are executed.
The SET LOCAL
command shown above only accepts a literal list of
elements. It will ordinarily be better for SQL code to add another
element to whatever is currently in the list, which is fussier in SQL:
SELECT set_config('pljava.implementors', 'NewThing,' || current_setting('pljava.implementors'), true)where the final
true
gives the setting the same lifetime as
SET LOCAL
, that is, it reverts when the transaction is over.
The possibility that, for certain implementor names, forImplementor
could return other subclasses of DDRExecutor
with specialized
behavior, is definitely contemplated.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract void
execute
(String sql, Connection conn) Execute the commandsql
using the connectionconn
, according to whatever meaning of "execute" the targetDDRExecutor
subclass implements.static DDRExecutor
Return aDDRExecutor
instance chosen according to the supplied implementor name and currentpljava.implementors
value.
-
Constructor Details
-
DDRExecutor
protected DDRExecutor()
-
-
Method Details
-
execute
Execute the commandsql
using the connectionconn
, according to whatever meaning of "execute" the targetDDRExecutor
subclass implements.- Parameters:
sql
- The command to executeconn
- The connection to use- Throws:
SQLException
- Anything thrown in the course of executingsql
-
forImplementor
Return aDDRExecutor
instance chosen according to the supplied implementor name and currentpljava.implementors
value. See the class description for more.- Parameters:
name
- The<implementor name>
associated with the deployment descriptor<command>
, ornull
if the<command>
is an unadorned<SQL statement>
instead of an<implementor block>
.- Throws:
SQLException
-