Profound.js Connector provides much of the same Record Level Access support when working with non IBM i database objects. Below is a list of the functions that are not supported with these other database:
- Using files with level checking
- QTEMP
- Record Locking
- Fetching records by relative record number
- Not all of the INFDS (Information Data Structure) values are available
For more information about RLA capabilities, see Record Level Access API.
To begin using RLA/SQL functions within your pjs programs:
Create the DbDefn module which enables you to use RLA functions in lieu of writing a lot of sql
To create a module we need to be able to name and describe some key parts of that table.
- File name --> example product.DbDefn.js
- Important notes:
- The file name must end with .DbDefn.js
- The first part of the name is how your pjs program will reference it :: "product"
- Important notes:
Below is a simple table named PRODUCT that is keyed/ordered by a field called PRID.
is a file named: product.DbDefn.js and put it anywhere under the modules folder. You will likely want to further organize these.
Code Block |
---|
module.exports = {
useSQL: true,
dbObject: "product",
format: "product",
uniqueKey: [
{ field: "prid", ascending: true }
]
} |
If you have an existing pjs program you don't have to do anything to it, as long as it does not use any of the non supported functions.
Here is a simple pjs program that reads all the records of a table.
Code Block |
---|
function products() {
pjs.defineTable("product", { read: true, keyed: true });
product.positionTo(0);
var data = [];
var record = product.fetch();
while (!pjs.endOfData()) {
data.push(record);
record = product.fetch();
}
console.log(JSON.stringify(data,null,2));
}
exports.run = products;
|