TZSQLProcessor Class Reference

Implements a unidatabase component which parses and executes SQL Scripts. More...

Inheritance diagram for TZSQLProcessor:

TComponent

List of all members.

Public Member Functions

 Clear ()
 Clears Processor contents and all parsed statements.
 Execute ()
 Executes a parsed SQL Processor.
 LoadFromFile (const string FileName)
 Loads a SQL Processor from the local file.
 LoadFromStream (TStream Stream)
 Loads a SQL Processor from the stream.
TParam ParamByName (const string Value)
 Gets a SQL parameter by its name.
 Parse ()
 Parses the loaded SQL Processor.
 TZSQLProcessor (TComponent AOwner)
 Creates this Processor component and assignes the main properties.
 ~TZSQLProcessor ()
 Destroys this component and cleanups the memory.

Public Attributes

TZProcessorNotifyEvent AfterExecute
TZProcessorNotifyEvent BeforeExecute
Boolean CleanupStatements
TZConnection Connection
string Delimiter
TZDelimiterType DelimiterType
TZProcessorErrorEvent OnError
Boolean ParamCheck
TParams Params
TStrings Script
Integer StatementCount
string Statements

Protected Member Functions

 CheckConnected ()
 Checks is the database connection assignes and tries to connect.
IZPreparedStatement CreateStatement (const string SQL, TStrings Properties)
 Creates a DBC statement for the query.
 DoAfterExecute (Integer StatementIndex)
 Performs an action action execute a statement.
 DoBeforeExecute (Integer StatementIndex)
 Performs an action before execute a statement.
TZErrorHandleAction DoOnError (Integer StatementIndex, Exception E)
 Performs OnError Event and returns an error handle action.
 SetStatementParams (IZPreparedStatement Statement, const TStringDynArray ParamNames, TParams Params)
 Fill prepared statement with parameters.

Private Member Functions

Boolean GetCleanupStatements ()
string GetDelimiter ()
 Gets a script delimiter;.
TZDelimiterType GetDelimiterType ()
 Gets a script delimiter type;.
Boolean GetParamCheck ()
 Gets a parameters check value.
TStrings GetScript ()
 Gets the SQL script.
string GetStatement (Integer Index)
 Gets a parsed statement by it's index.
Integer GetStatementCount ()
 Gets a statements count.
 SetCleanupStatements (const Boolean Value)
 SetConnection (TZConnection Value)
 Sets a new SQL connection component.
 SetDelimiter (const string Value)
 Sets a new Processor delimiter.
 SetDelimiterType (TZDelimiterType Value)
 Sets a new Processor delimiter type.
 SetParamCheck (Boolean Value)
 Sets a new parameters check value.
 SetParams (TParams Value)
 Sets a new set of parameters.
 SetScript (TStrings Value)
 Sets a new SQL script.
 UpdateSQLStrings (TObject Sender)
 Updates parameters from SQL statement.

Private Attributes

TZProcessorNotifyEvent FAfterExecute
TZProcessorNotifyEvent FBeforeExecute
TZConnection FConnection
TZProcessorErrorEvent FOnError
TParams FParams
TZSQLStrings FScript
TZSQLScriptParser FScriptParser


Detailed Description

Implements a unidatabase component which parses and executes SQL Scripts.

Definition at line 97 of file ZSqlProcessor.pas.


Constructor & Destructor Documentation

TZSQLProcessor::TZSQLProcessor ( TComponent  AOwner  ) 

Creates this Processor component and assignes the main properties.

Parameters:
AOwner an owner component.

Definition at line 290 of file ZSqlProcessor.pas.

TZSQLProcessor::~TZSQLProcessor (  ) 

Destroys this component and cleanups the memory.

Definition at line 311 of file ZSqlProcessor.pas.


Member Function Documentation

TZSQLProcessor::CheckConnected (  )  [protected]

Checks is the database connection assignes and tries to connect.

Definition at line 449 of file ZSqlProcessor.pas.

TZSQLProcessor::Clear (  ) 

Clears Processor contents and all parsed statements.

Definition at line 462 of file ZSqlProcessor.pas.

IZPreparedStatement TZSQLProcessor::CreateStatement ( const string  SQL,
TStrings  Properties 
) [protected]

Creates a DBC statement for the query.

Parameters:
SQL an SQL query.
Properties a statement specific properties.
Returns:
a created DBC statement.

Definition at line 638 of file ZSqlProcessor.pas.

TZSQLProcessor::DoAfterExecute ( Integer  StatementIndex  )  [protected]

Performs an action action execute a statement.

Parameters:
StatementIndex an index of the executing statement.

Definition at line 507 of file ZSqlProcessor.pas.

TZSQLProcessor::DoBeforeExecute ( Integer  StatementIndex  )  [protected]

Performs an action before execute a statement.

Parameters:
StatementIndex an index of the executing statement.

Definition at line 493 of file ZSqlProcessor.pas.

TZErrorHandleAction TZSQLProcessor::DoOnError ( Integer  StatementIndex,
Exception  E 
) [protected]

Performs OnError Event and returns an error handle action.

Parameters:
StatementIndex an index of the statement which failt.
E an exception object.
Returns:
an error handle action.

Definition at line 477 of file ZSqlProcessor.pas.

TZSQLProcessor::Execute (  ) 

Executes a parsed SQL Processor.

Definition at line 546 of file ZSqlProcessor.pas.

Boolean TZSQLProcessor::GetCleanupStatements (  )  [private]

Definition at line 814 of file ZSqlProcessor.pas.

string TZSQLProcessor::GetDelimiter (  )  [private]

Gets a script delimiter;.

Definition at line 396 of file ZSqlProcessor.pas.

TZDelimiterType TZSQLProcessor::GetDelimiterType (  )  [private]

Gets a script delimiter type;.

Definition at line 370 of file ZSqlProcessor.pas.

Boolean TZSQLProcessor::GetParamCheck (  )  [private]

Gets a parameters check value.

Returns:
a parameters check value.

Definition at line 792 of file ZSqlProcessor.pas.

TStrings TZSQLProcessor::GetScript (  )  [private]

Gets the SQL script.

Returns:
the SQL script strings.

Definition at line 749 of file ZSqlProcessor.pas.

string TZSQLProcessor::GetStatement ( Integer  Index  )  [private]

Gets a parsed statement by it's index.

Returns:
a SQL statement.

Definition at line 326 of file ZSqlProcessor.pas.

Integer TZSQLProcessor::GetStatementCount (  )  [private]

Gets a statements count.

Returns:
a number of parsed statements.

Definition at line 342 of file ZSqlProcessor.pas.

TZSQLProcessor::LoadFromFile ( const string  FileName  ) 

Loads a SQL Processor from the local file.

Parameters:
FileName a name of the file.

Definition at line 521 of file ZSqlProcessor.pas.

TZSQLProcessor::LoadFromStream ( TStream  Stream  ) 

Loads a SQL Processor from the stream.

Parameters:
Stream a stream object.

Definition at line 534 of file ZSqlProcessor.pas.

TParam TZSQLProcessor::ParamByName ( const string  Value  ) 

Gets a SQL parameter by its name.

Parameters:
Value a parameter name.
Returns:
a found parameter object.

Definition at line 607 of file ZSqlProcessor.pas.

TZSQLProcessor::Parse (  ) 

Parses the loaded SQL Processor.

Definition at line 619 of file ZSqlProcessor.pas.

TZSQLProcessor::SetCleanupStatements ( const Boolean  Value  )  [private]

Definition at line 822 of file ZSqlProcessor.pas.

TZSQLProcessor::SetConnection ( TZConnection  Value  )  [private]

Sets a new SQL connection component.

Parameters:
Value am SQL connection component.

Definition at line 356 of file ZSqlProcessor.pas.

TZSQLProcessor::SetDelimiter ( const string  Value  )  [private]

Sets a new Processor delimiter.

Parameters:
Value a new Processor delimiter.

Definition at line 408 of file ZSqlProcessor.pas.

TZSQLProcessor::SetDelimiterType ( TZDelimiterType  Value  )  [private]

Sets a new Processor delimiter type.

Parameters:
Value a new Processor delimiter type.

Definition at line 382 of file ZSqlProcessor.pas.

TZSQLProcessor::SetParamCheck ( Boolean  Value  )  [private]

Sets a new parameters check value.

Parameters:
Value a parameters check value.

Definition at line 804 of file ZSqlProcessor.pas.

TZSQLProcessor::SetParams ( TParams  Value  )  [private]

Sets a new set of parameters.

Parameters:
Value a set of parameters.

Definition at line 423 of file ZSqlProcessor.pas.

TZSQLProcessor::SetScript ( TStrings  Value  )  [private]

Sets a new SQL script.

Parameters:
Value a new SQL script.

Definition at line 436 of file ZSqlProcessor.pas.

TZSQLProcessor::SetStatementParams ( IZPreparedStatement  Statement,
const TStringDynArray  ParamNames,
TParams  Params 
) [protected]

Fill prepared statement with parameters.

Parameters:
Statement a prepared SQL statement.
ParamNames an array of parameter names.
Params a collection of SQL parameters.

Definition at line 669 of file ZSqlProcessor.pas.

TZSQLProcessor::UpdateSQLStrings ( TObject  Sender  )  [private]

Updates parameters from SQL statement.

Parameters:
Sender an event sender object.

Definition at line 761 of file ZSqlProcessor.pas.


Member Data Documentation

See also:
FAfterExecute For reading

FAfterExecute For writing

Definition at line 271 of file ZSqlProcessor.pas.

See also:
FBeforeExecute For reading

FBeforeExecute For writing

Definition at line 274 of file ZSqlProcessor.pas.

See also:
GetCleanupStatements For reading

SetCleanupStatements For writing

Definition at line 265 of file ZSqlProcessor.pas.

See also:
FConnection For reading

SetConnection For writing

Definition at line 254 of file ZSqlProcessor.pas.

See also:
GetDelimiter For reading

SetDelimiter For writing

Definition at line 261 of file ZSqlProcessor.pas.

See also:
GetDelimiterType For reading

SetDelimiterType For writing

Definition at line 258 of file ZSqlProcessor.pas.

Definition at line 112 of file ZSqlProcessor.pas.

Definition at line 110 of file ZSqlProcessor.pas.

Definition at line 108 of file ZSqlProcessor.pas.

Definition at line 114 of file ZSqlProcessor.pas.

TParams TZSQLProcessor::FParams [private]

Definition at line 102 of file ZSqlProcessor.pas.

Definition at line 104 of file ZSqlProcessor.pas.

Definition at line 106 of file ZSqlProcessor.pas.

See also:
FOnError For reading

FOnError For writing

Definition at line 268 of file ZSqlProcessor.pas.

See also:
GetParamCheck For reading

SetParamCheck For writing

Definition at line 245 of file ZSqlProcessor.pas.

See also:
FParams For reading

SetParams For writing

Definition at line 248 of file ZSqlProcessor.pas.

See also:
GetScript For reading

SetScript For writing

Definition at line 251 of file ZSqlProcessor.pas.

See also:
GetStatementCount For reading

Definition at line 237 of file ZSqlProcessor.pas.

See also:
GetStatement For reading

Definition at line 240 of file ZSqlProcessor.pas.


The documentation for this class was generated from the following file:

Generated on Wed Dec 30 08:42:57 2009 for zeoslib by  doxygen 1.5.7.1