OpenPetra
Free Administration Software for Non-Profits
Ict.Common.DB.TMySQL Class Reference

Allows access to MySQL databases using the 'MySQL AB ADO.Net Driver for MySQL' .NET Data Provider. More...

Inheritance diagram for Ict.Common.DB.TMySQL:
Ict.Common.DB.IDataBaseRDBMS

Public Member Functions

DbConnection GetConnection (String AServer, String APort, String ADatabaseName, String AUsername, ref String APassword, ref String AConnectionString, StateChangeEventHandler AStateChangeEventHandler)
 Creates a MySqlConnection connection using the 'MySQL AB ADO.Net Driver for MySQL' .NET Data Provider. More...
 
void InitConnection (DbConnection AConnection)
 Initialises the connection after it was opened. Doesn't do anything with MySQL! More...
 
bool LogException (Exception AException, ref string AErrorMessage)
 Formats an error message if the Exception is of Type 'MySqlException'. More...
 
String FormatQueryRDBMSSpecific (String ASqlQuery)
 Formats a SQL query so that it works for MySQL. See also the comments for TDataBase.FormatQueryRDBMSSpecific. More...
 
DbParameter[] ConvertOdbcParameters (DbParameter[] AParameterArray, ref string ASqlStatement)
 Converts an Array of DbParameter (eg. OdbcParameter) to an Array of NpgsqlParameter. If the Parameters don't have a name yet, they are given one because MySQL needs named Parameters. More...
 
DbCommand NewCommand (ref string ACommandText, DbConnection AConnection, DbParameter[] AParametersArray, TDBTransaction ATransaction)
 Creates a DbCommand object. This formats the sql query for MySQL, and transforms the parameters. More...
 
DbDataAdapter NewAdapter ()
 Creates a DbDataAdapter for MySQL. More...
 
void FillAdapter (DbDataAdapter TheAdapter, ref DataSet AFillDataSet, Int32 AStartRecord, Int32 AMaxRecords, string ADataTableName)
 Fills a DbDataAdapter that was created with the NewAdapter Method. More...
 
void FillAdapter (DbDataAdapter TheAdapter, ref DataTable AFillDataTable, Int32 AStartRecord, Int32 AMaxRecords)
 Fills a DbDataAdapter that was created with the NewAdapter Method. More...
 
bool AdjustIsolationLevel (ref IsolationLevel AIsolationLevel)
 Some RDMBS's have some problems with certain Isolation Levels - not so MySQL. More...
 
System.Int64 GetNextSequenceValue (String ASequenceName, TDBTransaction ATransaction, TDataBase ADatabase)
 Returns the next sequence value for the given Sequence from the DB. More...
 
System.Int64 GetCurrentSequenceValue (String ASequenceName, TDBTransaction ATransaction, TDataBase ADatabase)
 Returns the current sequence value for the given Sequence from the DB. More...
 
void RestartSequence (String ASequenceName, TDBTransaction ATransaction, TDataBase ADatabase, Int64 ARestartValue)
 Restart a sequence with the given value. More...
 
void UpdateDatabase (TFileVersionInfo ADBVersion, TFileVersionInfo AExeVersion, string AHostOrFile, string ADatabasePort, string ADatabaseName, string AUsername, string APassword)
 Updating of a MySQL database has not been implemented yet, need to do this still manually. More...
 
void ClearAllConnectionPools ()
 Clearing of all Connection Pools is not yet implemented for MySQL...! More...
 
void ClearConnectionPool (DbConnection ADBConnection)
 Clearing of a Connection Pool is not yet implemented for MySQL...! More...
 

Detailed Description

Allows access to MySQL databases using the 'MySQL AB ADO.Net Driver for MySQL' .NET Data Provider.

Member Function Documentation

◆ AdjustIsolationLevel()

bool Ict.Common.DB.TMySQL.AdjustIsolationLevel ( ref IsolationLevel  AIsolationLevel)
inline

Some RDMBS's have some problems with certain Isolation Levels - not so MySQL.

Parameters
AIsolationLevelIsolation Level.
Returns
True if Isolation Level was modified.

Implements Ict.Common.DB.IDataBaseRDBMS.

◆ ClearAllConnectionPools()

void Ict.Common.DB.TMySQL.ClearAllConnectionPools ( )
inline

Clearing of all Connection Pools is not yet implemented for MySQL...!

◆ ClearConnectionPool()

void Ict.Common.DB.TMySQL.ClearConnectionPool ( DbConnection  ADBConnection)
inline

Clearing of a Connection Pool is not yet implemented for MySQL...!

Implements Ict.Common.DB.IDataBaseRDBMS.

◆ ConvertOdbcParameters()

DbParameter[] Ict.Common.DB.TMySQL.ConvertOdbcParameters ( DbParameter[]  AParameterArray,
ref string  ASqlStatement 
)
inline

Converts an Array of DbParameter (eg. OdbcParameter) to an Array of NpgsqlParameter. If the Parameters don't have a name yet, they are given one because MySQL needs named Parameters.

Furthermore, the parameter placeholders '?' in the the passed in ASqlStatement are replaced with MySQL '?paramX' placeholders (where 'paramX' is the name of the Parameter).

Parameters
AParameterArrayArray of DbParameter that is to be converted.
ASqlStatementSQL Statement. It will be converted!
Returns
Array of MysqlParameter (converted from AParameterArray .

Implements Ict.Common.DB.IDataBaseRDBMS.

◆ FillAdapter() [1/2]

void Ict.Common.DB.TMySQL.FillAdapter ( DbDataAdapter  TheAdapter,
ref DataSet  AFillDataSet,
Int32  AStartRecord,
Int32  AMaxRecords,
string  ADataTableName 
)
inline

Fills a DbDataAdapter that was created with the NewAdapter Method.

Parameters
TheAdapter
AFillDataSet
AStartRecord
AMaxRecords
ADataTableName

Implements Ict.Common.DB.IDataBaseRDBMS.

◆ FillAdapter() [2/2]

void Ict.Common.DB.TMySQL.FillAdapter ( DbDataAdapter  TheAdapter,
ref DataTable  AFillDataTable,
Int32  AStartRecord,
Int32  AMaxRecords 
)
inline

Fills a DbDataAdapter that was created with the NewAdapter Method.

Overload of FillAdapter, just for one table.

Parameters
TheAdapter
AFillDataTable
AStartRecord
AMaxRecords

Implements Ict.Common.DB.IDataBaseRDBMS.

◆ FormatQueryRDBMSSpecific()

String Ict.Common.DB.TMySQL.FormatQueryRDBMSSpecific ( String  ASqlQuery)
inline

Formats a SQL query so that it works for MySQL. See also the comments for TDataBase.FormatQueryRDBMSSpecific.

Parameters
ASqlQuerySQL Query.
Returns
Formatted SQL Query.

Implements Ict.Common.DB.IDataBaseRDBMS.

◆ GetConnection()

DbConnection Ict.Common.DB.TMySQL.GetConnection ( String  AServer,
String  APort,
String  ADatabaseName,
String  AUsername,
ref String  APassword,
ref String  AConnectionString,
StateChangeEventHandler  AStateChangeEventHandler 
)
inline

Creates a MySqlConnection connection using the 'MySQL AB ADO.Net Driver for MySQL' .NET Data Provider.

Parameters
AServerDatabase Server.
APortPort that the DB server is running on.
ADatabaseNameName of the database that we want to connect to.
AUsernameUsername for opening the MySQL connection.
APasswordPassword for opening the MySQL connection.
AConnectionStringConnection string; if it is not empty, it will overrule the previous parameters.
AStateChangeEventHandlerEvent Handler for connection state changes.
Returns
Instantiated MySqlConnection, but not opened yet (null if connection could not be established).

Implements Ict.Common.DB.IDataBaseRDBMS.

◆ GetCurrentSequenceValue()

System.Int64 Ict.Common.DB.TMySQL.GetCurrentSequenceValue ( String  ASequenceName,
TDBTransaction  ATransaction,
TDataBase  ADatabase 
)
inline

Returns the current sequence value for the given Sequence from the DB.

Parameters
ASequenceNameName of the Sequence.
ATransactionAn instantiated Transaction in which the Query to the DB will be enlisted.
ADatabaseDatabase object that can be used for querying.
Returns
Sequence Value.

Implements Ict.Common.DB.IDataBaseRDBMS.

◆ GetNextSequenceValue()

System.Int64 Ict.Common.DB.TMySQL.GetNextSequenceValue ( String  ASequenceName,
TDBTransaction  ATransaction,
TDataBase  ADatabase 
)
inline

Returns the next sequence value for the given Sequence from the DB.

Parameters
ASequenceNameName of the Sequence.
ATransactionAn instantiated Transaction in which the Query to the DB will be enlisted.
ADatabaseDatabase object that can be used for querying.
Returns
Sequence Value.

Implements Ict.Common.DB.IDataBaseRDBMS.

◆ InitConnection()

void Ict.Common.DB.TMySQL.InitConnection ( DbConnection  AConnection)
inline

Initialises the connection after it was opened. Doesn't do anything with MySQL!

Parameters
AConnectionDB Connection.

Implements Ict.Common.DB.IDataBaseRDBMS.

◆ LogException()

bool Ict.Common.DB.TMySQL.LogException ( Exception  AException,
ref string  AErrorMessage 
)
inline

Formats an error message if the Exception is of Type 'MySqlException'.

Parameters
AException
AErrorMessage
Returns
True if this is an MySqlException.

Implements Ict.Common.DB.IDataBaseRDBMS.

◆ NewAdapter()

DbDataAdapter Ict.Common.DB.TMySQL.NewAdapter ( )
inline

Creates a DbDataAdapter for MySQL.

Important: Since an object that derives from DbDataAdapter is returned you ought to call .Dispose() on the returned object to release its resouces! (DbDataAdapter inherits from DataAdapter which itself inherits from Component, which implements IDisposable!)

Returns
Instantiated MySqlDataAdapter.

Implements Ict.Common.DB.IDataBaseRDBMS.

◆ NewCommand()

DbCommand Ict.Common.DB.TMySQL.NewCommand ( ref string  ACommandText,
DbConnection  AConnection,
DbParameter[]  AParametersArray,
TDBTransaction  ATransaction 
)
inline

Creates a DbCommand object. This formats the sql query for MySQL, and transforms the parameters.

Parameters
ACommandText
AConnection
AParametersArray
ATransaction
Returns
Instantiated MySqlCommand.

Implements Ict.Common.DB.IDataBaseRDBMS.

◆ RestartSequence()

void Ict.Common.DB.TMySQL.RestartSequence ( String  ASequenceName,
TDBTransaction  ATransaction,
TDataBase  ADatabase,
Int64  ARestartValue 
)
inline

Restart a sequence with the given value.

Implements Ict.Common.DB.IDataBaseRDBMS.

◆ UpdateDatabase()

void Ict.Common.DB.TMySQL.UpdateDatabase ( TFileVersionInfo  ADBVersion,
TFileVersionInfo  AExeVersion,
string  AHostOrFile,
string  ADatabasePort,
string  ADatabaseName,
string  AUsername,
string  APassword 
)
inline

Updating of a MySQL database has not been implemented yet, need to do this still manually.


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