toxic – Embed PL/SQL in XIST XML

This module is an XIST namespace. It provides the processing instruction classes needed to create TOXIC functions and procedures via XIST. For more info about the TOXIC compiler see the module ll.toxicc.

class ll.xist.ns.toxic.args(*content)[source]

Bases: ll.xist.xsc.ProcInst

Specifies the arguments to be used by the generated function. For example:

<?args
        key in integer,
        lang in varchar2
?>

for Oracle, or:

<?args
        @key int,
        @lang varchar(10)
?>

for SQL Server. If args is used multiple times, the contents will be concatenated with a , inbetween.

class ll.xist.ns.toxic.vars(*content)[source]

Bases: ll.xist.xsc.ProcInst

Specifies the local variables to be used by the function. For example:

<?vars
        buffer varchar2(200) := 'foo';
        counter integer;
?>

for Oracle, or:

<?vars
        declare @buffer varchar(200) := 'foo';
        declare @counter int;
?>

If vars is used multiple times, the contents will simple be concatenated. (Note that for SQL Server this could be done via a normal code PI too.)

class ll.xist.ns.toxic.code(*content)[source]

Bases: ll.xist.xsc.ProcInst

A SQL code fragment that will be embedded literally in the generated function. For example:

<?code select user into v_user from dual;?>

for Oracle, or:

<?code set @user = user;?>

for SQL Server

class ll.xist.ns.toxic.expr(*content)[source]

Bases: ll.xist.xsc.ProcInst

The data of an expr processing instruction must contain a SQL expression whose value will be embedded in the string returned by the generated function. This value will not be escaped in any way, so you can generate XML tags with expr PIs but you must make sure to generate the value in the encoding that the caller of the generated function expects.

class ll.xist.ns.toxic.proc(*content)[source]

Bases: ll.xist.xsc.ProcInst

When this processing instruction is found in the source compile() will not generate a function as a result, but a procedure. This procedure must have c_out as an “out” variable (of the appropriate type (see type) where the output will be written to.

class ll.xist.ns.toxic.type(*content)[source]

Bases: ll.xist.xsc.ProcInst

Can be used to specify the return type of the generated function/procedure. The default is clob for Oracle and varchar(max) for SQL Server.