Repo introducution
Repo will let you open a DataEase application for use in node. Before you create a new Repo object, you must have a working Prism object that is successfully initialized.
Repo is from where you connect to your data or updates the structure of your data.
closerepo | boolean | Close the repository. This must be done before opening a new one as only one can be open at the time. |
deletetable | boolean |
Delete a table in the repository. Return true if successful.
Paramters: - tname | name of the table to delete |
execdql
|
string |
Exexute a dql and return the result as a string. Depending of if you use a template or not, you will get a csv or a string build on the template. The template engine used here, is the very simple DataEase 8 version and not the new server version found in DataEase 9.
Paramters: -script | the dql that is been run - template | template to use with exec dql - field1 | data-entry that is picked up in dql as data-entry field1 - field2 | data-entry that is picked up in dql as data-entry field2 - field3 | data-entry that is picked up in dql as data-entry field3 - field4 | data-entry that is picked up in dql as data-entry field4 |
getdateformat |
string |
Based on the setting in prism you get MM/DD/YYYY, DD/MM/YYYY or YYYY/MM/DD where / is replaced by the separator used by prism. |
getdateseparator |
string |
The date separator used by prism |
getdatestandard |
string |
The date standard used by prism. Can be:
1 North American MM/DD/YY 2 International DD/MM/YY 3 Metric YY/MM/DD |
getdesimalseparator | string | The separator used for decimal in floating point and decimal numbers |
getlasterror |
number |
The last error code returned from a prism call |
getlasterrorasstring |
string |
The error as formatted by prism. |
getletter |
string |
The letter used for RDRRxAAA.INI and the like. x is then replaced by this letter. |
getthousandseparator |
string |
The separator used for triplets in a number. Ex 1 000.23 for thousand point twenty three |
gettimeformat |
string |
HH:MM:SS where the : is replaced by the separator used by prism |
gettimeseparator |
string |
The separator used by time |
isopen | boolean | Return True if the repo is open |
listcommands | Array | Return a string array of all commands supported by DQL |
listfunctions |
Array |
Return a string array of all functions supported by DataEase |
listoperators |
Array |
Return a array of all operators supported by DQL |
listtablenames |
Array |
Return a array of all tables in repository |
openrepo | boolean | Open a named repositiory Paramters: - name | name or the repository as can be seen in catalog - path | path to the repository as can be seen in catalog - [username] | if you have a username you want to log in with add it here if omitted blank is used - [password] | if you have a password you want to login with add it here, if omitted blank is used |
rename | boolean | Will close repo if open to clear all, then open it, renname to new name and close again. Paramters - newname | the name to rename to - [newappkey] | if given will tell to generate new appkey or not. If not given a new appkey is generated. |
runfunction |
string |
Call into DPRunFunction with a function name and 0-8 args and return the result. |
How to open a repo
var denode = require('./denode') var prism = new denode.Prism(); var prismpath = __dirname + '\\denode' console.log('Path to this denode is: ' + prismpath); prism.setprismpath(prismpath); var isinit = prism.prisminit(); console.log("is init done with result " + isinit); if (isinit == true) { console.log("Prism init ok"); var repo = new denode.Repo(); repo.openrepo('The repo name', 'C:\\Path\\To\\DataEase\\Application'); console.log(repo.listtablenames()); ... repo.closerepo(); } else console.log("Prism init failed"); prism.prismclose()<br>
This will first load the module and create a connection to prism. Prism need to know where the module is, so we add a prismpath and init prism. Then we create and open a repository. Do what needs doing and make sure to close the repo and shut down prism.