Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The return value is passed to the above APIs as the first parameter, followed by the other parameters as documented for each API. The database connection definition object also has a property called 'connection' which has a reference to the corresponding entry from the databaseConnections configuration option.

Exception Handling

An exception is is thrown if the database connection name is not valid.

...

Code Block
languagejs
titleData API
varconst record = {
  id: 123,
  firstname: "Joe",
  lastname: "Customer"
};
  
pjs.data.add("customers", record); // Runs against default database connection.
pjs.data.add(pjs.getDB("crm"), "customers", record) // Runs against database connection "crm".


Code Block
languagejs
titleRetrieve configuration
const connectionInfo = pjs.getDB().connection; // Default connection.
if (connectionInfo.driver === "IBMi") {
  // IBM i-specific code.
}
else if (connection.driver === "mysql") {
  // MySQL/MariaDB-specific code.
}