While you CAN create new objects of this type within your script code, most people will use the built in property which you can access in your scripts via globals.MySQLProfile.
NOTE: The MySQL Connectors that are configured in your script will be OVERRIDDEN when using the CORE HL7 Script Engine software in your CORE HL7 Script Engine profiles. See the online help for the script engine.
This class implements the COREException class for your convenience.
Runtime Properties and Methods:
Property Name |
Data Type |
DBConnectionState |
System.Data.ConnectionState (Read Only) |
IsConnected |
bool (Read Only)- Will indicate whether a connection to the database is currently open. |
Method |
Return Value |
CloseConnection() |
bool - Closes an open connection to the database. |
OpenConnection() |
bool - Opens a connection to the database. |
TestConnection() |
bool - Tests the database connection by first calling VerifyConnection() and then calling CloseConnection(). Returns true if a connection was successfully established. |
VerifyConnection() |
bool - Opens a connection by calling OpenConnection() IF no connection is open. |
SQL Query Methods:
Method |
Return Value |
OpenMySQLDataTable(string sql, string tblName = "", bool fillSchema = false) |
System.Data.DataTable - Executes the query in sql and returns a DataTable object containing the result OR an empty DataTable object on error. IF fillSchema is true it implements the Microsoft DbDataAdapter.FillSchema Method. |
OpenMySQLDataTable(COREScriptSQLQueryItem queryItem, bool fillSchema = false) |
System.Data.DataSet - Executes the query in queryItem.SQLString and returns a DataTable object containing the result named queryItem.TableName OR an empty DataTable object on error. IF fillSchema is true it implements the Microsoft DbDataAdapter.FillSchema Method. |
OpenMySQLQuery(string sql, string tblName = "", bool fillSchema = false)
|
System.Data.DataSet - Executes the query in sql and returns a DataSet object with 1 table containing the result OR an empty DataSet object on error. IF fillSchema is true it implements the Microsoft DbDataAdapter.FillSchema Method. |
OpenMySQLQuery(COREScriptSQLQueryItem queryItem, bool fillSchema = false) |
System.Data.DataSet - Executes the query in queryItem.SQLString and returns a DataSet object with 1 table containing the result named queryItem.TableName OR an empty DataSet object on error. IF fillSchema is true it implements the Microsoft DbDataAdapter.FillSchema Method. |
OpenMySQLQueries ( List<COREScriptSQLQueryItem> queryItems, bool fillSchema = false ) |
System.Data.DataSet - Open multiple SQL Queries with one function call. For each COREScriptSQLQueryItem in queryItems it executes the query in queryItem.SQLString and returns a DataSet object with queryItems.Count DataTables containing the results OR an empty DataSet object on error. IF fillSchema is true it implements the Microsoft DbDataAdapter.FillSchema Method. |
SQL Execution Methods:
Method |
Return Value |
ExecuteSQL(string sql) |
bool - Executes the statement in sql. It will use the connectors ConnectionTimeout value x 5 as the Command Timeout. |
RunTransaction(List<string> sqlStatements, int commandTimeout = -1) |
bool - Executes a MS SQL Transaction containing all commands in sqlStatements with automatic Rollback on failure. You have the option of passing your own Command Timeout value in commandTimeout. If you do not then the connectors ConnectionTimeout value x 5 as the Command Timeout. |

