IRISLIB database
StatementMetadata Class Reference
Inheritance diagram for StatementMetadata:
Collaboration diagram for StatementMetadata:

Public Member Functions

_.Library.Status OnNew (_.Library.Integer pStatementType, _.Library.Binary pMetadata, _.Library.Binary pParameters, _.Library.Binary pObjects, _.Library.Binary pArguments, _.Library.List pActualBinding, _.Library.List pDynamic)
 This callback method is invoked by the <METHOD>New</METHOD> method to. More...
 
- Public Member Functions inherited from RegisteredObject
_.Library.Status OnAddToSaveSet (_.Library.Integer depth, _.Library.Integer insert, _.Library.Integer callcount)
 This callback method is invoked when the current object is added to the SaveSet,. More...
 
_.Library.Status OnClose ()
 This callback method is invoked by the <METHOD>Close</METHOD> method to. More...
 
_.Library.Status OnConstructClone (_.Library.RegisteredObject object, _.Library.Boolean deep, _.Library.String cloned)
 This callback method is invoked by the <METHOD>ConstructClone</METHOD> method to. More...
 
_.Library.Status OnNew ()
 This callback method is invoked by the <METHOD>New</METHOD> method to. More...
 
_.Library.Status OnValidateObject ()
 This callback method is invoked by the <METHOD>ValidateObject</METHOD> method to. More...
 

Public Attributes

 columnCount
 The number of columns defined as SQLRESULTCOL that are returned by executing this statement. More...
 
 columnIndex
 Index on column names and column number. More...
 
 columns
 columns is a collection of StatementColumn objects. More...
 
 formalParameters
 formalParameters is a collection of '?' parameters found in the prepared statement. More...
 
 interface
 interface is an integer value indicating the routine interface: More...
 
 objects
 A collection of StatementObject objects representing the columns that are object values. More...
 
 parameterCount
 The number of parameters defined in this statement. More...
 
 parameters
 The parameters collection contains the metadata for each actual parameter. More...
 
 statementType
 

Private Member Functions

_.Library.Status Display ()
 Display metadata on the current device.
 

Static Private Member Functions

_.Library.Status GenerateMetadata (_.Library.Binary pInfo, _.Library.Integer pStatementType, _.Library.Binary pMetadata, _.Library.Binary pParameters, _.Library.Binary pObjects, _.Library.List pActual, _.Library.List pDynamic)
 GenerateMetadata constructs the serialized metadata from the query processor's info array. More...
 

Additional Inherited Members

- Static Public Attributes inherited from RegisteredObject
 CAPTION = None
 Optional name used by the Form Wizard for a class when generating forms. More...
 
 JAVATYPE = None
 The Java type to be used when exported.
 
 PROPERTYVALIDATION = None
 This parameter controls the default validation behavior for the object. More...
 

Detailed Description

For details on using this class, see SQL Metadata.

Metadata describes the statement interface. The statement metadata contains the type of statement, the number of columns defined by the statement and the metadata for each column. Statement columns are of three primary types: result columns, parameters, and the return value. There is also a distinction between the metadata available for a prepared statement and for a statement that has been executed since not all statement results are known at prepare time. For all statement types except CALL, the statement metadata is all available at prepare time. CALL statement metadata that is available at prepare time includes the metadata from the statement itself and that metadata is not to be confused with the metadata defined by the SQL routine that is called. Each routine defines a formal interface that consists of an optional return value and option input, input-output and output parameters. An SQL routine might also return a single preplanned result set. That metadata is available at prepare time and it consists of some number of columns of type SQLRESULTCOL. An SQL routine might also declare that it returns some dynamic result sets, the metadata for which is not available until after the statement is executed and the result sets bound dynamic cursors.

Member Function Documentation

◆ GenerateMetadata()

_.Library.Status GenerateMetadata ( _.Library.Binary  pInfo,
_.Library.Integer  pStatementType,
_.Library.Binary  pMetadata,
_.Library.Binary  pParameters,
_.Library.Binary  pObjects,
_.Library.List  pActual,
_.Library.List  pDynamic 
)
staticprivate

GenerateMetadata constructs the serialized metadata from the query processor's info array.

IF %protocol 41 and higher:
 metadata = $lb()
        1 - # of SELECT columns
        2 - i:  <For each SELECT column>
            1) Name
            2) ODBC Type
            3) Precision
            4) Scale
            5) NULLABLE (integer)
            6) Column Label (same as Name)
            7) Column Table Name
            8) Column Schema Name
            9) Column Qualifier Name - NULL
            10) $Char(1)/$Char(0) string / $Extract position:
                1)  isAutoIncrement
                2)  isCaseSensitive
                3)  isCurrency
                4)  IsReadOnly
                5)  IsRowVersion
                6)  IsUnique
                7)  IsAliased
                8)  IsExpression
                9)  IsHidden
                10) IsIdentity
                11) IsKeyColumn
                12) IsRowid
                13) IsList
        j - # of Parameters
        j+1 - k:  <For each Parameter>
            1) ODBC Type
            2) Precision
            3) Scale
            4) NULLABLE
                5) colName
                6) colType
IF %protocol less than 41:
 metadata = $lb()
        1 - # of SELECT columns
        2 - i:  <For each SELECT column>
            1) Name
            2) ODBC Type
            3) Precision
            4) Scale
            5) NULLABLE
            6) Column Label (same as Name)
            7) Column Table Name
            8) Column Schema Name
            9) Column Qualifier Name - NULL
        j - # of Parameters
        j+1 - k:  <For each Parameter>
            1) ODBC Type
            2) Precision
            3) Scale
            4) NULLABLE

◆ OnNew()

_.Library.Status OnNew ( _.Library.Integer  pStatementType,
_.Library.Binary  pMetadata,
_.Library.Binary  pParameters,
_.Library.Binary  pObjects,
_.Library.Binary  pArguments,
_.Library.List  pActualBinding,
_.Library.List  pDynamic 
)

This callback method is invoked by the <METHOD>New</METHOD> method to.

provide notification that a new instance of an object is being created.

If this method returns an error then the object will not be created.

It is passed the arguments provided in the New call. When customizing this method, override the arguments with whatever variables and types you expect to receive from New(). For example, if you're going to call New, passing 2 arguments, OnNew's signature could be:

Method OnNew(dob as Date = "", name as Name = "") as Status

SQL.StatementMetadata is a metadata class for dynamic statement metadata. The initial value is the metadata from a StatementCache object. or it is the result set object itself.

pMetadata describes only the ROWTYPE metadata for a result set. Additional metadata is contained in pParameters and pObjects. The non-ROWTYPE metadata is a single node for non-result columns (in pParameters) and a single node for object metadata (in pObjects).

Member Data Documentation

◆ columnCount

columnCount

The number of columns defined as SQLRESULTCOL that are returned by executing this statement.

This is the same as columns.Count().  

◆ columnIndex

columnIndex

Index on column names and column number.

 

◆ columns

columns

columns is a collection of StatementColumn objects.

Each StatementColumn object

contains the metadata a column defined by the statement as an SQLRESULTCOL column type.  

◆ formalParameters

formalParameters

formalParameters is a collection of '?' parameters found in the prepared statement.

It may differ from the parameters collection if literal replacement occurred. This property is mainly for internal use and metadata reporting. It is not meant to be used for the statement descriptor.  

◆ interface

interface

interface is an integer value indicating the routine interface:

-2 - Return value, dynamic cursors returned (zero, one or more) -1 - No return value, dynamic cursors returned (RETURNRESULTSETS, zero one or more) 0 - No return value, no dynamic cursors (NOT RETURNRESULTSETS, aka "function" procedure although a function should return a value (interface = 2)) 1 - No return value, one pre-planned result set (AKA "query" procedure) 2 - Return value, no dynamic cursors (NOT RETURNRESULTSETS)  

◆ objects

objects

A collection of StatementObject objects representing the columns that are object values.

 

◆ parameterCount

parameterCount

The number of parameters defined in this statement.

This is the same as

parameters.Count().  

◆ parameters

parameters

The parameters collection contains the metadata for each actual parameter.

contained in the source statement. ..parameters.Count() is equivalent to the number of '?' parameters found in the source statement and the list position corresponds to the ordinal position of the '?' in the source statement.  

◆ statementType

statementType

Integer value indicating the type of statement.

1SELECT
2INSERT (also 'INSERT OR UPDATE')
3UPDATE
4DELETE
5COMMIT
6ROLLBACK
7GRANT
8REVOKE
9CREATE TABLE
10ALTER TABLE
11DROP TABLE
12CREATE VIEW
13ALTER VIEW
14DROP VIEW
15CREATE INDEX
16ALTER INDEX (Not supported)
17DROP INDEX
18CREATE ROLE
19DROP ROLE
20SET TRANSACTION
21START TRANSACTION
22INTRANSACTION
23BEGTRANS (Alias for START TRANSACTION)
24INTRANS (Alias for INTRANSACTION)
25GET (Not supported)
26SET OPTION
27STATISTICS (UPDATE STATISTICS, not supported))
28CHECKPRIV
29CREATE USER
30ALTER USER
31DROP USER
32CHECKPRIV (SQL Admin Privilege)
33GRANT (SQL Admin Privilege)
34REVOKE (SQL Admin Privilege)
35CREATE FUNCTION
36CREATE METHOD
37CREATE PROCEDURE
38CREATE QUERY
39DROP FUNCTION
40DROP METHOD
41DROP PROCEDURE
42DROP QUERY
43CREATE TRIGGER
44DROP TRIGGER
45CALL
46SAVEPOINT
47LOCK TABLE
48UNLOCK TABLE
49CREATE DATABASE
50DROP DATABASE
51USE DATABASE
52TUNE TABLE
53DECLARE
54CREATE MODEL
55DROP MODEL
56TRAIN MODEL
57ALTER MODEL
58VALIDATE MODEL
59SET ML CONFIGURATION
60CREATE ML CONFIGURATION
61ALTER ML CONFIGURATION
62DROP ML CONFIGURATION
63FREEZE PLANS
64UNFREEZE PLANS
65PURGE
66BUILD INDEX
67CREATE AGGREGATE
68DROP AGGREGATE
69LOAD
70CREATE SCHEMA
71DROP SCHEMA
72CREATE SERVER
73ALTER SERVER
74DROP SERVER
75CREATE FOREIGN TABLE
76ALTER FOREIGN TABLE
77DROP FOREIGN TABLE
78CANCEL QUERY
79EXPLAIN
99Anything not list above