TIB_Statement Object
Properties Methods Events

Unit
IB_Components

Declaration
TIB_Statement = class(TIB_Component)

Description
This class serves as a foundational base class for the TIB_DSQL, TIB_Cursor and TIB_Query components.

It handles all of the necessary API calls to allocate, prepare and execute an InterBase DSQL statement. It also interprets and defines memory buffers that are bound to column objects for both input and output handling.

An important thing to know about this component and its descendants is that all output is accessed in the Fields[] array and not the Params[] array. The BDE returns stored procedure results in the Params[] array and this is not how it works in InterBase. I may emulate how the BDE does it at a future time but for now when executing stored procedures get the results from the Fields[] array.

Before Params[] can be accessed the statement or dataset must be Prepared. This is the step that creates objects for all of the input and output columns.

Introduced Public Properties
Active  When output is being requested Active will be true if a preapred statement was successfully executed and output exists.
AssigningSQL  Flag which returns if the statement is in the process of being assigned.
CalculatedFields  This property is used to describe the number of and format of the calculated fields to be used with the statement or dataset.
CalculatingFields  Property which tells if the values of CalculatedFields are being set.
ClientSQL  Property which returns the client provided SQL statement without any alterations for sending to the server.
ColAttributeParams  User defined column properties can be stored via this property.
ColumnAttributes  This is a special property that allows custom attributes for the columns of this statement to be stored.
DatabaseName  Property to connect to a connection component by providing a global string instead of a direct component reference.
FieldCount  Number of output columns.
Fields  Reference to the output columns of the statement or dataset.
FieldsAlignment  Gives contol over how the data should be aligned if something other than the default is desired.
FieldsCharCase  Gives contol over how string data should be handled by data aware controls.
FieldsDisplayFormat  Allows a display string to be provided for a column's DisplayText property.
FieldsDisplayLabel  Allows the DisplayLabel to contain a more user friendly column heading.
FieldsDisplayWidth  Allows the width in pixels of a IB_Grid column to be adjusted.
FieldsEditMask  Allows an EditMask string to be provided for a column's data aware control to use when editing the contents of the column..
FieldsGridLabel  Allows you to override DisplayLabels for a column with a label specifically for display on a grid column title.
FieldsIndex  Allows the order of the IB_Column objects to be altered.
FieldsReadOnly  Allows controls associated to fields to be locked as a readonly field.
FieldsTrimming  Set the trimming of fields according to the valid entries below:

Make column entries using the standard format as:

[< tablename >.]< columnname >=N[one]
[< tablename >.]< columnname >=A[ll]
[< tablename >.]< columnname >=B[oth]
[< tablename >.]< columnname >=L[eft]
[< tablename >.]< columnname >=R[ight]
[< tablename >.]< columnname >=S[entence]
FieldsVisible  Allows fields to be set to Visible as false.
FieldValues  This property gives a variant result of the given output column passed in.
Hints  The various bar controls will look here for generic hint definitions.
IB_Connection  Connection to be used for this statement.
IB_Transaction  Transaction to be used for this statement.
IsColAttributeSet  User defined column properties' existance can be accessed via this property.
IsSelectSQL  Tell if the statement is a SELECT SQL statement.
KeepSQLHistory  This property determins whether a SQL history is preserved for the compoenent or not.
KeyRelation  This property can make a dataset that invloves a multi-table join be insert or delete capable.
OldParamValueLinks  Parameter values are stored aside so that between transactions their values can be preserved.
OnBlobCallback  This event allows specific hooks into the process that gets and puts BLOB segments to and from the server.
ParamChar  Character to be used as an alternate charater to denote an input parameter in the SQL property.
ParamCheck  This property makes the parser check for input parameters or not.
ParamCount  Number of input columns.
Params  This is a reference to the input parameters for the statement.
ParamValueLinks  If parameters are used in the SQL statement then the string values that need to be assigned to these input parameters can be added into this string list as entries.
ParamValues  This property gives a variant result of the given input column passed in.
PdbHandle  Pointer to the InterBase connection handle referenced by this statement.
Prepared  The prepared status of the statement or dataset can be determined with this property.
PreparingSQL  Flag which returns if the statement is in the process of being prepared.
PstHandle  Pointer to the InterBase statement handle.
PtrHandle  Pointer to the InterBase transaction handle referenced by this statement.
RefinedSQL  Property which returns the refined SQL that was sent to the server.
RefiningSQL  Flag to indicate that the PrepareSQL phase is in refinement.
RepreparingSQL  Flag which returns whether or not the statement is going through a re-prepare cycle.
RetrieveDomainNames  Setting this to false will cause IBO to ignore all requests to retrieve the name of the Domain for its columns.
RowsAffected  If a DML is executed then this property will return the number of rows that were affected by it.
RowsSelected  This result accompanies RowsAffected and tells how many rows were selected on the server in order to complete the operation performed.
SelectParamsCount  This gives a count of the number of input parameters which were included in the select portion of a SELECT statement.
ServerSQL  Property which returns the SQL that was sent to the server.
SQL  This is the property which contains the SQL statement to be prepared and executed.
SQLDialect  Tells the SQLDialect of the connection.
SQLHistory  Makes the contents of the SQL history list available.
SQLHistoryRef  Positions the reference into the history list.
SQLIsAggregate  Property which tells if the SQL statement is an aggregate style SELECT statement.
SQLIsRefined  Returns a flag that tells if the dataset is a result of a refined SQL statement.
SQLIsSelectProc  This property tells if the SELECT statement is actually using a stored procedure to select data from.
SQLIsValid  Tells whether the statement has a need to reprepare itself.
StatementLinkCount  Number of statement link objects referencing this statement.
StatementPlan  If a SELECT or query based DML is performed then there will be an optimization PLAN resolved for it.
StatementType  Once prepared this property returns which statement type has been prepared.
stHandle  This is the InterBase statement handle obtained by allocating it.
StoredProcHasDML  If a stored procedure does not perform any DML operations then it is posssible to make it so that executing it will not activate the transaction.
SysBindingCursor  System use property.
SysFieldNames  System use property.
SysParamNames  System use property.
SysTableNames  System use property.

Introduced Public Methods
AddSQLHistory   Adds the current statement to the statement history depending on where the SQLHistoryRef property is set.
BeginLayout   Begin a bracketed operation on the FieldsXXXX properties for efficiency.
CalculateFields   Method to cause the current fields to be recalculated.
CheckConnection   Method to check the status of the IB_Connection reference and optionally request that a connection be attempted.
CheckTransaction   Method to check the status of the IB_Transaction reference and optionally request that a transaction be started.
ClearSQLHistory   Clears out the history of statements added to the statement history.
Create
CreateBlobStream   Method which allows direct access to the contents of a BLOB parameter or field.
Destroy
EndLayout   End a bracketed operation on the FieldsXXXX properties for efficiency.
ExecImmed2   This method will allow immediate execution of a statement that has both input and output parameters.
ExecSQL   BDE/VCL compatibility method.
Execute   This method will execute the SQL statement.
ExecuteDDL   This method is used in order to execute DDL statements without having to go through all the steps to prepare, describe, etc.
ExecuteImmediate   This method will allow immediate execution of a statement and input parameters.
FieldByName   This method will attempt to return a TIB_Column reference for the field name passed in.
FindField   This method will attempt to return a TIB_Column reference for the field name passed in.
FindKeyField   This method will attempt to return a TIB_Column reference for the field name passed in in the KeyFields array.
FindParam   This method will attempt to return a TIB_Column reference for the parameter name passed in.
FreeServerResources   This method will cause the server resources involved with the statement to be freed up so that the client will not unnecessarily hold resources on the server open.
Gen_ID   This method will return a Generator value with a specified increment.
GeneratorValue   This method will return a Generator value with a specified increment.
GetBlobNodeData   This procedure will take a BlobNode and get the data for its BLOBID and store it into the buffer with the size indicated.
GetFieldList   This method populates a TList with the TIB_Column references for the fields.
GetFieldNamesList   This method populates a string list with the names of the fields.
GetParamList   This method populates a TList with the TIB_Column references for the parameters.
GetParamNamesList   This method populates a string list with the names of the parameters.
InvalidateSQL   This method flags the statement or dataset as needing to be reprepared before it is executed again.
ParamByName   This method will attempt to return a TIB_Column reference for the parameter name passed in.
Prepare   Prepare or reprepare an invalidated statement or dataset.
PutBlobNodeData   This procedure will take a BlobNode and "put" the data for it in a new temporary BLOBID and store it in the BlobNode.BLOBID.
RemoveSQLHistory   Drops a string from out of the SQL History.
Unprepare   This method will close, unprepare and free up the InterBase statement handle obtained upon allocation.
UpdateLayout   Force the IB_Column objects in the Fields and Params properties to take on the settings in the FieldsXXXX property settings.
UpdateRecord   Cause any controls holding changes to data to save them to the row buffer.
UsingDefaultTransaction   This function tells whether or not this statement or dataset is using the default transaction of the connection.

Introduced Public Events
AfterExecDDL  General statement notification event.
AfterExecDML  General statement notification event.
AfterExecute  General statement notification event.
AfterPrepare  General statement notification event.
AfterUnprepare  General statement notification event.
BeforeExecDDL  General statement notification event.
BeforeExecDML  General statement notification event.
BeforeExecute  General statement notification event.
BeforePrepare  General statement notification event.
BeforeUnprepare  General statement notification event.
OnActiveChange  General statement notification event.
OnCalculateField  Event where code can be placed to provide values for the fields created as a result of entering specifications in the CalculatedFields property.
OnCreateColumn  Method to allow customized TIB_Column classes to be used.
OnFieldsStateChanged  General statement notification event.
OnInvalidateSQL  General statement notification event.
OnLayoutChanged  General statement notification event.
OnParamsStateChanged  General statement notification event.
OnPreparedChanged  General statement notification event.
OnPrepareSQL  General statement notification event.
OnValidateField  Event to validate the field's value.