The APIs allows for interaction with database objects without having to write pure SQL syntax.  Which make using them simpler and more robust.

These APIs also allow for:

1) More database independent.  Since you are not writing the explicit SQL syntax.

2) Can incorporate DbDefn file, which supports things such as data type overrides and shared business logic.

The pjs.query API is very powerful, however it does require that you to write valid SQL syntax that work for the running database.

These Data APIs are created so that you do not need to know much, if any, SQL.

Here are some scenarios where your SQL logic would not be simple:

  1. When your table or column name is also a database reserved name (like from, as, date, etc), you need to escape them in your SQL syntax, and not all databases use the same escape character.
  2. Not all database support all the same data types, such as Oracle does not support Date type parameters, and your SQL syntax and parameters would need to be adjusted.
  3. Not all database support the ? parameter marker, such as Microsoft SQL, and your SQL syntax would differ slightly.
  4. Some database installations support case-sensitive table and column names.  If it does, your SQL syntax would need to change.
  5. The SQL syntax may work on one database, but not on another

These Data APIs create the correct SQL statement based on the current database and handle all these scenarios and more...

// These 2 lines will return the exact same results
let rcds1 = pjs.query("select * from customers");
let rcds2 ="customers");

// Here you can see some differences on how to get records with criteria.  Both will return the exact same result.
const parm1 = "USA";
const strName = "B"

let rcds3 = pjs.query("select * from customers where country = ? and customerName > ?", [parm1, strName]);

let filter = ["country", "=", parm1),"customerName", ">", strName)
let rcds4 ="customers", filter);