C# Класс ALFA.MySQLDatabase

This class encapsulates database access for ALFA CLR scripts that uses an independent MySQL connection. N.B. Most code should NOT use a MySQLDatabase object, because doing so may monopolize a valuable connection pool connection. Use ALFA.ALFADatabase instead for most SQL accesses UNLESS they must be done from a dedicated thread context, like the ACR_ServerCommunicator GameWorldManager query thread.
Наследование: IALFADatabase, IDisposable
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
ACR_IncrementStatistic ( string Statistic ) : void

Increment a global tracking statistic counter stored in the database (if statistic tracking was enabled).

ACR_SQLEncodeSpecialChars ( string s ) : string

This routine escapes characters for a SQL query.

ACR_SQLExecute ( string SQL ) : void

This routine performs a synchronous SQL query. If there were pending asynchronous queries in the queue, the pending queries are drained first. The query must not return any results.

ACR_SQLFetch ( ) : bool

This routine fetches the next rowset from the database.

ACR_SQLGetAffectedRows ( ) : int

This routine returns the number of rows affected by a query.

ACR_SQLGetData ( ) : string

This routine returns the first column of data from the current SQL rowset.

ACR_SQLGetData ( int ColumnIndex ) : string

This routine returns the specified column of data from the current SQL rowset.

ACR_SQLQuery ( string SQL ) : void

This routine performs a synchronous SQL query. If there were pending asynchronous queries in the queue, the pending queries are drained first.

Dispose ( ) : void

Dispose the object.

MySQLDatabase ( string ConnectionString = null, bool Dedicated = false ) : System

Create a new database object (which can be shared by multiple script objects).

Приватные методы

Метод Описание
Dispose ( bool Disposing ) : void

Dispose the object.

ForceLoadMySQL ( ) : void

This method forces MySQL.Data.dll to be loaded and linked.

LinkToMySQLAssembly ( string ConnectionString = null, bool Dedicated = false ) : void

This method links to the MySQL assembly, ensuring that the assembly is loaded. If necessary the assembly is loaded from the NWNX4 installation directory.

LinkToMySQLAssembly_AssemblyResolve ( object sender, ResolveEventArgs args ) : Assembly

This assembly resolve handler is designed to handle a failure to resolve the MySQL.Data.dll assembly. It returns the pre-loaded assembly for linkage.

Описание методов

ACR_IncrementStatistic() публичный метод

Increment a global tracking statistic counter stored in the database (if statistic tracking was enabled).
public ACR_IncrementStatistic ( string Statistic ) : void
Statistic string Supplies the counter name.
Результат void

ACR_SQLEncodeSpecialChars() публичный метод

This routine escapes characters for a SQL query.
public ACR_SQLEncodeSpecialChars ( string s ) : string
s string Supplies the string to escape.
Результат string

ACR_SQLExecute() публичный метод

This routine performs a synchronous SQL query. If there were pending asynchronous queries in the queue, the pending queries are drained first. The query must not return any results.
public ACR_SQLExecute ( string SQL ) : void
SQL string Supplies the SQL query text to execute.
Результат void

ACR_SQLFetch() публичный метод

This routine fetches the next rowset from the database.
public ACR_SQLFetch ( ) : bool
Результат bool

ACR_SQLGetAffectedRows() публичный метод

This routine returns the number of rows affected by a query.
public ACR_SQLGetAffectedRows ( ) : int
Результат int

ACR_SQLGetData() публичный метод

This routine returns the first column of data from the current SQL rowset.
public ACR_SQLGetData ( ) : string
Результат string

ACR_SQLGetData() публичный метод

This routine returns the specified column of data from the current SQL rowset.
public ACR_SQLGetData ( int ColumnIndex ) : string
ColumnIndex int Supplies the zero-based column index to /// retrieve.
Результат string

ACR_SQLQuery() публичный метод

This routine performs a synchronous SQL query. If there were pending asynchronous queries in the queue, the pending queries are drained first.
public ACR_SQLQuery ( string SQL ) : void
SQL string Supplies the SQL query text to execute.
Результат void

Dispose() публичный метод

Dispose the object.
public Dispose ( ) : void
Результат void

MySQLDatabase() публичный метод

Create a new database object (which can be shared by multiple script objects).
public MySQLDatabase ( string ConnectionString = null, bool Dedicated = false ) : System
ConnectionString string Optionally supplies an overload /// connection string. If null, the default string is built from the /// NWNX MySQL plugin's configuration file.
Dedicated bool Supplies true if the database object is to /// use a dedicated connection.
Результат System