Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Version History

Version 1 Next »


The pjs.data APIs allows for interacting with database objects without having to write SQL syntax.

These APIs make accessing database objects simpler and more robust.


This API allows:

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

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


pjs.query is very powerful, however you must be able to write valid SQL syntax.

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

Here are some scenarios where you 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. This syntax may work on one database, but not on another

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


Compare pjs.query and pjs.data.get
// These 2 lines will return the exact same results
let rcds1 = pjs.query("select * from customers");
let rcds2 = pjs.data.get("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 = [
	pjs.data.createCondition("country", "=", parm1),
	pjs.data.createCondition("customerName", "=", strName)
];
let rcds4 = pjs.data.get("customers", filter);



  • No labels