-
Notifications
You must be signed in to change notification settings - Fork 16
API Connection
new Connection( connection: string|ConnectionObject, driver?: DatabaseDriver )
Type: string or ConnectionObject
Defines the connection parameters, including driver name, host name, credentials, and database.
Type: DatabaseDriver
An optional parameter. Used to pass in a specific driver class. If this is specified, the driver name is ignored in the connection argument.
Type: string
Access: read only
Returns the derived connection URL string. Whether the connection is parsed from a passed string, or derived from a ConnectionObject, this property is always made up of the underlying ConnectionObject properties. This means it may be different from the passed value.
Type: DatabaseDriver
Access: read only
Returns a reference to the class used for the database driver.
Syntax
connection.createStatement( sql: string ) => Statement
Type: string
The SQL string in the dialect of the underlying driver, with the exception that the parameter token is always a question mark ?
.
Type: Statement
A statement object which will be used for further database actions. This statement is reusable.
Syntax
connection.prepareStatement( sql: string ) => PreparedStatement
Type: string
The SQL string in the dialect of the underlying driver, with the exception that the parameter token is always a question mark ?
.
Type: PreparedStatement
A prepared statement object which will be used for further database actions. This statement is reusable.
This is the preferred method for creating reusable statements as it forces the preparation of the statement which significantly reduces the risk of SQL injection attacks.
Syntax
connection.close() => Promise<true>