Database.Connection
Description
A class for connecting to and querying a database.
Every database connector that you create in your model's toolbox will have a Database.Connection associated with it. To access the connection associated with a connector, use the name-based constructor, providing the name of the database connector.
Database.Connection con = Database.Connection("DBConnector1");
Properties
isConnected | 1 if the connection is currently connected, 0 otherwise. |
Methods
connect | Attempts to connect to the database. |
disconnect | Disconnects from the database. |
prepareStatement | Creates a new Database.PreparedStatement object for executing the SQL statement. |
query | Executes a SQL query, returning the result. |
Constructor
Database.Connection | Retrieves the connection associated with a named database connector. |
Details
Do no remove, this fixes the anchor on doc.flexsim.com
Database.Connection.isConnected
readonly int isConnected
Description
1 if the connection is currently connected, 0 otherwise.
Do no remove, this fixes the anchor on doc.flexsim.com
Database.Connection.connect()
int connect( ) |
Returns
int | 1 if successful, 0 otherwise. |
Description
Attempts to connect to the database.
Do no remove, this fixes the anchor on doc.flexsim.com
Do no remove, this fixes the anchor on doc.flexsim.com
Database.Connection.prepareStatement()
Database.PreparedStatement prepareStatement( string sqlStatement ) |
Parameters
sqlStatement | The SQL statement to be executed by the Database.PreparedStatement. |
Returns
Database.PreparedStatement | A newly created Database.PreparedStatement. |
Description
Creates a new Database.PreparedStatement object for executing the SQL statement.
Prepared statements are bound to the tree. A connection will automatically remove all its prepared statements when it is disconnected.
Do no remove, this fixes the anchor on doc.flexsim.com
Database.Connection.query()
Database.ResultSet query( string sqlQuery ) |
Parameters
sqlQuery | The SQL query to execute. |
Description
Executes a SQL query, returning the result.
Do no remove, this fixes the anchor on doc.flexsim.com
Database.Connection Constructor
Database.Connection( string connectorName ) |
Parameters
connectorName | The name of the connector whose connection should be retrieved. |
Description
Retrieves the connection associated with a named database connector.
Database.Connection con = Database.Connection("DBConnector1");