FlexScript Class - 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
Details
Do no remove, this fixes the anchor on doc.flexsim.com
readonly int isConnected
Description
1 if the connection is currently connected, 0 otherwise.
Do no remove, this fixes the anchor on doc.flexsim.com
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
Description
Disconnects from the database.
Do no remove, this fixes the anchor on doc.flexsim.com
Parameters
sqlStatement
The SQL statement to be executed by the Database.PreparedStatement.
Returns
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
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(
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");