Firebird
Firebird
The Firebird module is responsible for connecting to a Firebird DBMS, performing queries and handling the results inside the robot.
Methods
connection
Method responsible for creating a connection with a Firebird database.
const connection = await Database.Firebird.connection["v1_0_0"]({
connectionType: "remoteHost",
host: "localhost",
port: 3050,
database: "C:\\dados\\robertyBD.fdb",
user: "SYSDBA",
password: "masterkey",
connectTimeout: 10,
queryTimeout: 60,
})
Required parameters
connectionType: String - expects"localFile"(database in a local file) or"remoteHost"(database on a server).
Optional parameters
host: String - address of the Firebird server. Used only whenconnectionTypeis"remoteHost".port: Number - port of the Firebird server. Used only whenconnectionTypeis"remoteHost".database: String - path of the database file.user: String - database user.password: String - user's password.connectTimeout: Number - maximum time, in seconds, to wait for the server to accept the connection.queryTimeout: Number - default time limit, in seconds, for every query run on this connection.0= no limit.
Return
Returns the open connection, which must be stored in a variable (like connection in the example) and provided in the connection parameter of the other methods.
Version v2_0_0 of this method receives, instead of the access data, the connectionId of a connection configured in the workspace (Workspace → Connections), besides the same connectTimeout and queryTimeout:
const connection = await Database.Firebird.connection["v2_0_0"]({
connectionId: "id-of-the-connection-configured-in-the-workspace",
connectTimeout: 10,
queryTimeout: 60,
})
close
Method responsible for closing an open connection with a Firebird database.
await Database.Firebird.close["v1_0_0"]({
connection: connection,
})
Required parameters
connection: Return of the connection action - expects the connection obtained through the connection action.
Optional parameters
This action has no optional parameters.
Return
This action has no returns.
query
Method responsible for performing a query directly in the database through the connection obtained by the connection action.
const query = await Database.Firebird.query["v1_0_0"]({
query: `SELECT * FROM tabela`,
connection: connection,
timeout: 120
})
Required parameters
connection: Return of the connection action - expects the connection obtained through the connection action.query: String - expects a string with the query to be performed.
Optional parameters
timeout: Number - time limit, in seconds, for this query. When omitted, the connection'squeryTimeoutapplies.0= no limit. When the limit is reached, the promise rejects with an error whose message starts withTimeout. When neithertimeoutnor the connection'squeryTimeoutis provided, there is no limit. Because Firebird cannot cancel a running query, the connection is closed and a new one must be opened.
Return
The constant or variable created, such as the query of the example shown earlier, receives a value of the Object type. The object returned has the following properties:
query.query: String - returns the query that was used.query.results: Array - returns every result obtained with the query.query.resultsCount: Number - returns the number of rows obtained in the result.