-
Notifications
You must be signed in to change notification settings - Fork 16
API PreparedStatement
Michael Anderson edited this page Dec 13, 2017
·
1 revision
A PreparedStatement takes an SQL expression as a string and makes it executable or queryable against a database table. A PreparedStatement is a Statement that always calls the prepare method in the constructor.
connection.prepareStatement( sql : string )
Parameter | Type | Description |
---|---|---|
sql | string | The SQL expression used to form the statement. |
Sends a query to the database after escaping and substituting any parameters passed in.
statement.query( ...args: Array<any> ) => Promise<Array<any>>
Parameter | Type | Description |
---|---|---|
args | Array<any> | A rest parameter array of values to be substituted for the ? tokens in the SQL. The number of parameters must match the number of ? tokens. |
Type | Description |
---|---|
Promise<Array<Object>> | An arry of database rows represented as JSON objects. |
Executes a statement on the database after escaping and substituting any parameters passed in.
statement.execute( ...args: Array<any> ) => any
Parameter | Type | Description |
---|---|---|
args | Array<any> | A rest parameter array of values to be substituted for the ? tokens in the SQL. The number of parameters must match the number of ? tokens. |
Type | Description |
---|---|
Promise<Any> | If the underlying driver returns anything, it will be returned in a promise. Not all drivers or databases have a return from an execute. |