UNPKG

profoundjs

Version:

Profound.js Framework and Server

898 lines (746 loc) 35.7 kB
declare let SQL_DEFAULT : number; declare let SQL_CHAR : number; declare let SQL_NUMERIC : number; declare let SQL_DECIMAL : number; declare let SQL_INTEGER : number; declare let SQL_SMALLINT : number; declare let SQL_FLOAT : number; declare let SQL_REAL : number; declare let SQL_DOUBLE : number; declare let SQL_DATETIME : number; declare let SQL_VARCHAR : number; declare let SQL_BLOB : number; declare let SQL_CLOB : number; declare let SQL_DBCLOB : number; declare let SQL_DATALINK : number; declare let SQL_WCHAR : number; declare let SQL_WVARCHAR : number; declare let SQL_BIGINT : number; declare let SQL_BLOB_LOCATOR : number; declare let SQL_CLOB_LOCATOR : number; declare let SQL_DBCLOB_LOCATOR : number; declare let SQL_UTF8_CHAR : number; declare let SQL_WLONGVARCHAR : number; declare let SQL_LONGVARCHAR : number; declare let SQL_GRAPHIC : number; declare let SQL_VARGRAPHIC : number; declare let SQL_LONGVARGRAPHIC : number; declare let SQL_BINARY : number; declare let SQL_VARBINARY : number; declare let SQL_LONGVARBINARY : number; declare let SQL_DATE : number; declare let SQL_TYPE_DATE : number; declare let SQL_TIME : number; declare let SQL_TYPE_TIME : number; declare let SQL_TIMESTAMP : number; declare let SQL_TYPE_TIMESTAMP : number; declare let SQL_CODE_DATE : number; declare let SQL_CODE_TIME : number; declare let SQL_CODE_TIMESTAMP : number; declare let SQL_ALL_TYPES : number; declare let SQL_DECFLOAT : number; declare let SQL_XML : number; declare let SQL_FETCH_NEXT : number; declare let SQL_FETCH_FIRST : number; declare let SQL_FETCH_LAST : number; declare let SQL_FETCH_PRIOR : number; declare let SQL_FETCH_ABSOLUTE : number; declare let SQL_FETCH_RELATIVE : number; declare let SQL_PARAM_INPUT : number; declare let SQL_PARAM_OUTPUT : number; declare let SQL_PARAM_INPUT_OUTPUT : number; // Valid environment attributes declare let SQL_ATTR_OUTPUT_NTS : number; declare let SQL_ATTR_SYS_NAMING : number; declare let SQL_ATTR_DEFAULT_LIB : number; declare let SQL_ATTR_SERVER_MODE : number; declare let SQL_ATTR_JOB_SORT_SEQUENCE : number; declare let SQL_ATTR_ENVHNDL_COUNTER : number; declare let SQL_ATTR_ESCAPE_CHAR : number; declare let SQL_ATTR_INCLUDE_NULL_IN_LEN : number; declare let SQL_ATTR_UTF8 : number; declare let SQL_ATTR_SYSCAP : number; declare let SQL_ATTR_REQUIRE_PROFILE : number; declare let SQL_ATTR_UCS2 : number; declare let SQL_ATTR_TRUNCATION_RTNC : number; declare let SQL_ATTR_DATE_FMT : number; declare let SQL_ATTR_DATE_SEP : number; declare let SQL_ATTR_TIME_FMT : number; declare let SQL_ATTR_TIME_SEP : number; declare let SQL_ATTR_DECIMAL_SEP : number; declare let SQL_ATTR_TXN_INFO : number; declare let SQL_ATTR_TXN_EXTERNAL : number; declare let SQL_ATTR_2ND_LEVEL_TEXT : number; declare let SQL_ATTR_SAVEPOINT_NAME : number; declare let SQL_ATTR_TRACE : number; declare let SQL_ATTR_MAX_PRECISION : number; declare let SQL_ATTR_MAX_SCALE : number; declare let SQL_ATTR_MIN_DIVIDE_SCALE : number; declare let SQL_ATTR_HEX_LITERALS : number; declare let SQL_ATTR_CORRELATOR : number; declare let SQL_ATTR_QUERY_OPTIMIZE_GOAL : number; declare let SQL_ATTR_CONN_SORT_SEQUENCE : number; declare let SQL_ATTR_PREFETCH : number; declare let SQL_ATTR_CLOSEONEOF : number; declare let SQL_ATTR_ANSI_APP : number; declare let SQL_ATTR_INFO_USERID : number; declare let SQL_ATTR_INFO_WRKSTNNAME : number; declare let SQL_ATTR_INFO_APPLNAME : number; declare let SQL_ATTR_INFO_ACCTSTR : number; declare let SQL_ATTR_INFO_PROGRAMID : number; declare let SQL_ATTR_DECFLOAT_ROUNDING_MODE : number; declare let SQL_ATTR_OLD_MTADTA_BEHAVIOR : number; declare let SQL_ATTR_NULL_REQUIRED : number; declare let SQL_ATTR_FREE_LOCATORS : number; declare let SQL_ATTR_EXTENDED_INDICATORS : number; declare let SQL_ATTR_NULLT_ARRAY_RESULTS : number; declare let SQL_ATTR_NULLT_OUTPUT_PARMS : number; declare let SQL_ATTR_TIMESTAMP_PREC : number; declare let SQL_ATTR_CONCURRENT_ACCESS_RESOLUTION : number; declare let SQL_ATTR_APP_ROW_DESC : number; declare let SQL_ATTR_APP_PARAM_DESC : number; declare let SQL_ATTR_IMP_ROW_DESC : number; declare let SQL_ATTR_IMP_PARAM_DESC : number; declare let SQL_ATTR_FOR_FETCH_ONLY : number; declare let SQL_ATTR_CONCURRENCY : number; declare let SQL_ATTR_CURSOR_SCROLLABLE : number; declare let SQL_ATTR_ROWSET_SIZE : number; declare let SQL_ATTR_ROW_ARRAY_SIZE : number; declare let SQL_ATTR_CURSOR_HOLD : number; declare let SQL_ATTR_FULL_OPEN : number; declare let SQL_ATTR_EXTENDED_COL_INFO : number; declare let SQL_ATTR_BIND_TYPE : number; declare let SQL_ATTR_CURSOR_TYPE : number; declare let SQL_ATTR_CURSOR_SENSITIVITY : number; declare let SQL_ATTR_ROW_STATUS_PTR : number; declare let SQL_ATTR_ROWS_FETCHED_PTR : number; declare let SQL_ATTR_ROW_BIND_TYPE : number; declare let SQL_ATTR_PARAMSET_SIZE : number; declare let SQL_ATTR_PARAM_STATUS_PTR : number; declare let SQL_ATTR_PARAMS_PROCESSED_PTR : number; declare let SQL_ATTR_NUMBER_RESULTSET_ROWS_PTR : number; declare let SQL_ATTR_AUTO_IPD : number; declare let SQL_ATTR_ACCESS_MODE : number; declare let SQL_ATTR_AUTOCOMMIT : number; declare let SQL_ATTR_DBC_SYS_NAMING : number; declare let SQL_ATTR_DBC_DEFAULT_LIB : number; declare let SQL_ATTR_ADOPT_OWNER_AUTH : number; declare let SQL_ATTR_SYSBAS_CMT : number; declare let SQL_ATTR_SET_SSA : number; declare let SQL_ATTR_COMMIT : number; declare let SQL_ATTR_TXN_ISOLATION : number; declare let SQL_TXN_ISOLATION : number; declare let SQL_TXN_NO_COMMIT : number; declare let SQL_HEX_SORT_SEQUENCE : number; declare let SQL_JOB_SORT_SEQUENCE : number; declare let SQL_JOBRUN_SORT_SEQUENCE : number; declare let SQL_FALSE : number; declare let SQL_TRUE : number; declare let SQL_NTS : number; declare let SQL_BIND_BY_ROW : number; declare let SQL_BIND_BY_COLUMN : number; declare let SQL_CURSOR_FORWARD_ONLY : number; declare let SQL_CURSOR_STATIC : number; declare let SQL_CURSOR_DYNAMIC : number; declare let SQL_CURSOR_KEYSET_DRIVEN : number; declare let SQL_UNSPECIFIED : number; declare let SQL_INSENSITIVE : number; declare let SQL_SENSITIVE : number; declare let SQL_FMT_ISO : number; declare let SQL_FMT_USA : number; declare let SQL_FMT_EUR : number; declare let SQL_FMT_JIS : number; declare let SQL_FMT_MDY : number; declare let SQL_FMT_DMY : number; declare let SQL_FMT_YMD : number; declare let SQL_FMT_JUL : number; declare let SQL_FMT_HMS : number; declare let SQL_FMT_JOB : number; declare let SQL_SEP_SLASH : number; declare let SQL_SEP_DASH : number; declare let SQL_SEP_PERIOD : number; declare let SQL_SEP_COMMA : number; declare let SQL_SEP_BLANK : number; declare let SQL_SEP_COLON : number; declare let SQL_SEP_JOB : number; declare let SQL_NULL_DATA : number; declare let SQL_MAX_ROWSET_SIZE : number; declare let SQL_FETCH_ALL : number; declare let sqlcode : number; declare let sqlstate : string; declare namespace display { //MISSING SCREEN APIS because they are object methods //MISSING GRID APIs because they are object methods export function close(): void; /** * This method returns a specific display's end of file state indicating * whether the last call to `display.grid.readChanged()` found more changed records. */ export function endOfData(): boolean; /** * True indicates a subfile grid record was found and retrieved. * False indicates the record was not found. */ export function found(): boolean; export function isOpen(): boolean; /** * opens a display file that was previously defined with the userOpen configuration * property set to true in the `pjs.defineDisplay()` call. */ export function open(): void; /** * Returns the current status code of the display object */ export function status(): number; } declare namespace pjs { export let ProfoundJSVar: any; export let DataStucture: any; /** * Allocate a new buffer. */ export function alloc(size: number): Buffer; export function assign(fieldName: string, value: any, halfAdjust?: boolean): any; export function assignCorresponding(into: DataStructure, from: DataStructure): void; export function bitAnd(...values: string): string; export function bitChange(field: ProfoundJSVar, bits: string, resultBit: number): void; export function bitNot(value: string): void; export function bitOr(...values: string): string; export function bitXor(...values: string): string; export function call(program: string, ...parameters: ProfoundJSVar[]): any; export function callProcedure(callInfo: object): any; export function clear(ProfoundJSVar: ProfoundJSVar, options?: Object): void; export function closeDataAreas(): void; export function connect(Database: string, Username?: string, Password?: string): void; export function currencySymbol(): string; /** * Displays a message on the user's screen, waits for user input, then returns which button the user clicked. * @param parm String message or configuration Object. */ export function messageBox(parm): string; /** * Retrieve the content of a dataarea into Profound.js Variable. * * @param into Profound.js Variable with 'dataarea' config. * @param lock Boolean to determine whether to lock after dataarea has been retrieved. */ export function retrieveDataArea(into: ProfoundJSVar, lock?: boolean): void; /** * Set the content of the variable into associated dataarea. * * @param from Profound.js Variable with 'dataarea' config. * @param remainLocked Boolean to determine whether to unlock after dataarea has been set. */ export function setDataArea(from: ProfoundJSVar, remainLocked?: boolean): void; /** * Retrieves data areas using `pjs.retrieveDataArea()` for all fields in the module defined with the 'dataArea' config. */ export function retrieveAllAreas(): void; /** * Sets data areas using `pjs.setDataArea()` for all fields in the module defined with the 'dataArea' configuration option. */ export function setAllAreas(): void; /** * Create a dataarea on IBM i. * @param info Object containing children about the dataarea: `name`, `type` and `length`. Optional: `decimals`, `initValue` and `replace`. */ export function createDataArea(info: object): void; /** * Get the content of a dataarea. * @param name Name of dataarea: `OBJ` / `LIB/OBJ` * @param length Length of data area. * @param lock Lock data area when read. False by default. */ export function getDataArea(name: string, length: number, lock?: boolean): any; /** * Set the content of a dataarea. * @param name Name of dataarea: `OBJ` / `LIB/OBJ` * @param data Data which will be placed into the dataarea. Can also be a Buffer. * @param unlock Unlock data area when written to. False by default. */ export function getDataArea(name: string, data: any | Buffer, unlock?: boolean): void; /** * Deallocate a Profound.js Pointer. * @param ProfoundJSVar Profound.js Pointer. */ export function dealloc(ProfoundJSVar: ProfoundJSVar): void; /** * Returns the number of decimals within a declared field or constant. * @param value Primitive or Profound.js Variable. */ export function decimalPositions(value: number | ProfoundJSVar): number; /** * Declare a stronly typed variable (Profound.js Variable) * Read more here: http://www.profoundlogic.com/docs/pages/viewpage.action?pageId=29524321 * @param name Name if Profound.js variable. * @param config Object containing information about the variable. */ export function define(name: string, config: object): void; /** * Creates a rich display file object that can be used by the program * @param name The object name you will reference throughout your program that represents the Rich Display File * @param file The name of the JSON file containing your Rich Display definition. * The file is searched for in the modules directory of the Profound.js installation. * The name can be qualified with a specific modules subdirectory (e.g. "subdir/mydisplay.json"). * If the name is not qualified, the pathlist is used to search for the Rich Display File. * @param config Configuration options for the Rich Display File. * See more here: http://www.profoundlogic.com/docs/pages/viewpage.action?pageId=31752760 */ export function defineDisplay(name: string, file: string, config: object): void; /** * * @param name A variable of this name will be defined in the calling script and * will be populated with a record file instance. * @param file A String specifying the external name of the file object. The name can optionally be qualified with a library. If the library is not specified, then the library list is used to resolve the file. * If the external name is not specified, then the internal name is used instead * @param config Read more here: http://www.profoundlogic.com/docs/pages/viewpage.action?pageId=31031470 */ export function defineTable(name: string, file: string, config: object): void; export function definePrinter(internalName: string, fileConfig: object): void; export function definePrinter(internalName: string, externalName: string, fileConfig: object): void; /** * This API sets field values using the properties of a JavaScript object. * Each object property that has a matching declared field is used to set the field value. * @param object primitive JavaScript object */ export function setFields(object: object): void; /** * This API assigns JavaScript object property values based on declared field values. * Each property that has a matching declared field name is assigned the value of that field. * @param object primitive JavaScript object * @return The modified object is returned by the API. */ export function getFields(object: object): void | Object; /** * Displays HTML content and waits for the user to respond. * @param file An object containing either `html` or `file` which will be displayed in the session. * @param data This parameter is the data object to pass to the template. If omitted, all strongly * typed fields declared within the global scope are passed to the template. * @param EJSoptions An object specifying EJS options as documented on www.ejs.co. */ export function display(file: object, data?: object, EJSoptions?: object): object; export function editCode(value: number, code: string, currencySymbol: string): string; /** * Find a specific file in a list of directories. * @param name Name of the file. * @param directoryList Array of directories. * @return First directory which contains file. */ export function findIFSFile(name: string, directoryList: string[]): string; export function found(): boolean; /** * @param ProfoundJSVar A Profound.js Variable. * @param data Value of `*data` if variable is varying in length. */ export function getBuffer(ProfoundJSVar: ProfoundJSVar, data?: string): Buffer; export function getDSValue(structure: DataStructure): string; export function toObject(structure: DataStructure): object; export function copyToDS(toDS: DataStructure, fromObj: object): void; export function readIFSFile(path: string, ccsid?: number): Buffer; export function writeIFSFile(path: string, data: Buffer, localCCSID: number, remoteCCSID?: number): void; //export function import(path: string, functions?: string[]): void; export function isShuttingDown(): boolean; /** * Returns the maximum value out of all parameters, where parameters can be any data * type, including numbers, strings, or dates. */ export function max(...values: any): any; /** * Returns the minimum value out of all parameters, where parameters can be any data * type, including numbers, strings, or dates. */ export function min(...values: any): any; /** * **USE WITH CAUTION**. * Move values from one field to another, left or right adjusted, without any type checking. * Right adjusted. * @param source Source Profound.js Variable * @param target Target Profound.js Variable * @param format Time / Date format. Can be null if not required. * @param pad if true, the target variable is first cleared. */ export function move(source: any, target: ProfoundJSVar, format?: string, pad?: boolean): void; /** * **USE WITH CAUTION**. * Move values from one field to another, left or right adjusted, without any type checking. * Left adjusted. * @param source Source Profound.js Variable * @param target Target Profound.js Variable * @param format Time / Date format. Can be null if not required. * @param pad if true, the target variable is first cleared. */ export function moveLeft(source: any, target: ProfoundJSVar, format?: string, pad?: boolean): void; /** * **USE WITH CAUTION**. * moves elements from and/or to an array. If padding is specified, it will clear * out the remaining characters and elements in the target after the move is complete. * @param source Source array. * @param sourceIndex 1 or higher, start from this index when working with the source * @param targetArray Target array * @param targetIndex 1 or higher, start from this index when working with the target * @param padding if passed in as true, the target will be padded. */ export function moveArray(source: ProfoundJSVar, sourceIndex: number, targetArray: ProfoundJSVar, targetIndex: number, padding?: boolean): void; //ALL MOVE X TO X ZONE functions /** * * @param ProfoundJSVar Profound.js Variable which is null-capable. * @param isNull If provided, will set the fields null indicator to provided value. * @return Returns whether the variable is null or not. */ export function nullInd(ProfoundJSVar: ProfoundJSVar, isNull?: boolean): boolean; export function getOccur(structure: DataStructure): number; export function setOccur(structure: DataStructure, occurance: number): void; /** * Used for passing parameters by value with pjs.call(). * @param value Primitive value. * @param config A configuration object of the format used by pjs.define(). */ export function parm(value: any, config: object): object; /** * Used for passing parameters by value with pjs.call(). * @param varname A string containing the name of a Profound.js field. */ export function parm(varname: string): object; export function parseFloat(value: string): number; export function parseInt(value: string): number; //export function pointerString //export function procAddr /** * A shortcut for executing an SQL statement and automatically fetching the results. * There are more variables of the API. See here: http://www.profoundlogic.com/docs/pages/viewpage.action?pageId=37028376 * @param query An SQL statement. * @param parameters If parameter markers are used, pass them in as following parameters. */ export function query(query: string, ...parameters?: any): object; /** * Reallocate storage. * @param pointer The name of a Profound.js pointer Variable that points to a buffer * allocated with pjs.alloc(). * @param newSize The desired size of the buffer. */ export function realloc(pointer: ProfoundJSVar, newSize: number): void; /** * Returns a reference to a Profound.js Variable. */ export function refParm(ProfoundJSVar: ProfoundJSVar): object; /** * `var myModule = pjs.require("mydir/myModule");` * @param modulePath A string containing the module file name to load. * @param options An object with the following properties: * 'hotReload' boolean, 'isProgram' boolean (will then return a single function), * 'isServiceProgram' boolean (will return an object of functions). */ export function require(modulePath: string, options?: object): Function | object; /** * `var myModule = pjs.require("mydir/myModule");` * @param modulePath A string containing the module file name to load. * @param options An object with the following properties: 'hotReload' boolean * @return An object of functions defined in the provided module. */ export function requireModule(modulePath: string, options?: object): object; export function requireServiceProgram(ProfoundJSVar: ProfoundJSVar, options?: Object): object; /** * Run a command on IBM i. * @param command IBM i command. */ export function runCommand(command: string): void; /** * Used to send a request to a JSON API. * @param method HTTP method to use. E.g. `post`, `get`, etc * @param endpoint URL to the web service. * @param options If an object is passed the request will be a JSON request, * otherwise it will be a plain text request. * @return Will return JSON if a JSON message is passed in. */ export function sendRequest(method: string, endpoint: string, message: object | string): any; /** * @param options The 'options' object passed into the request API. * https://github.com/request/request#requestoptions-callback */ export function sendRequest(options: object): any; /** * Used to send a request to a JSON API. * @param method HTTP method to use. E.g. `post`, `get`, etc * @param endpoint URL to the web service. * @param options If an object is passed the request will be a JSON request, * otherwise it will be a plain text request. * @return Will return JSON if a JSON message is passed in. */ export function httpRequest(method: string, endpoint: string, message: object | string): any; /** * @param options The 'options' object passed into the request API. */ export function httpRequest(options: object): any; export function set(ProfoundJSVar: string, value: any): void; /** * Set a Profound.js to the current time. */ export function setCurrentTime(ProfoundJSVar: ProfoundJSVar): void; //export function setFields //export function getSQLOption export function sortArray(array: any[], descending: boolean, startElement?: number, numberOfElements?: number): void; export let START: any; export let END: any; export let HIGH_VALUE: any; export let LOW_VALUE: any; //export function status //export function tableLookup //export function testBit export function testNumeric(number: string): boolean; //export function testTimestamp export function testZone(value: string): object; export function toDate(date: any): Date; export function unsignedInt(value: number, halfAdjust?: boolean): boolean; /** * Commits pending changes to all files that are open under commitment control. */ export function commit(boundary?: boolean): void; /** * Returns the end of file status set by the most recent file operation. */ export function endOfData(): boolean; //export function equal(): boolean; /** * The value returned by this method can be passed to file.update() to * control which fields are updated in the record. * @param fields One or more Profound.js Variables */ export function fields(...fields: ProfoundJSVar): any; /** * This method indicates whether or not a record was found by a prior call * to file.getRecord(), file.positionTo(), file.positionAfter(), * or file.delete(searchArgument). */ export function found(): boolean; /** * This method returns a data structure's sub-field values in an array, * which is suitable for use as the search argument for the file.positionTo(), * file.positionAfter(), file.getRecord(), file.fetchNextEqual(), * file.fetchPreviousEqual(), and file.delete() APIs. * @param structure Profound.js Data Structure */ export function kds(structure: DataStructure): any; /** * Rolls back pending changes to all files that are open under commitment control. */ export function rollBack(): void; //BELOW IS ALL SQL FUNCTIONS AND CLASSES /** * Retrieves the current database connection established by Profound.js. * Each database driver may have its own unique properties and * methods attached to the connection object. */ export function getConnection(): object; /** * Allocates a statement handle. */ export function allocStmt(): SQLStatement; /** * Prepares a statement to execute. You only need to prepare a statement * if you have parameter markers, identified by ? (question mark) symbols, * in the SQL. You may use executeDirect() otherwise. */ export function prepare(query: string): SQLStatement; /** * Returns the IBM i or Profound.js Spaces user name, if signed in. */ export function getUser(): string; /** * Spawns a child processs. * @param cmd The command to run. * @param args Array of arguments to pass to the command. * @param options Options object. See child_process.spawn() for details. * @param input Input to write to stdin of the spawned process. * @return An object containing data from the process's stdout and stderr, if any, along with the exit code or singal that ended the process. */ export function spawn(cmd: string, args?: string[], options?: object, input?: string): object; export class SQLStatement { /** * Close the statement handle. */ public close(): void; /** * Bind variables to parameter markers in a prepared statement. * `[[searchQuery.trim(), SQL_PARAM_INPUT], [searchQuery.trim(), SQL_PARAM_INPUT]]` * @param parameters Must be an array of arrays. For example: */ public bindParameters(parameters: any[]): void; /** * Executes a prepared statement. It should be be called after parameter binding. */ public execute(): void; /** * Execute a non-prepared statement on IBM i, * which can be used if there are no parameter markers in your SQL. */ public executeDirect(query: string): void; /** * Fetch the next row(s) from the cursor associated with the statement handle. * **Used for returning primitive data only.** * @param rows Amount of rows to return. Can pass SQL_FETCH_ALL for all rows. * @return An array of rows. */ public fetch(rows?: number): object[]; //FETCH AND FETCHNEXT ARE THE SAME /** * Fetch the next row(s) from the cursor associated with the statement handle. * **Used for returning primitive data only.** * @param rows Amount of rows to return. Can pass SQL_FETCH_ALL for all rows. * @return An array of rows. */ public fetchNext(rows?: number): object[]; /** * Fetch the prior row(s) from the cursor associated with the statement handle. * **Used for returning primitive data only.** * @param rows Amount of rows to return. Can pass SQL_FETCH_ALL for all rows. * @return An array of rows. */ public fetchPrior(rows?: number): object[]; public fetchFirst(rows?: number): object[]; public fetchLast(rows?: number): object[]; /** * Fetches a row from the cursor associated with the current statement handle, * relative to the cursor's current row. * @param offset Number that specifies the offset of the row to fetch, relative to the current cursor position. * @param rows Amount of rows to return. Can pass SQL_FETCH_ALL for all rows. * @return An array of rows. */ public fetchRelative(offset: number, rows?: number): object[]; /** * Fetches a specific row from the cursor associated with the statement handle. * @param row The row number to fetch. The first row is considered row number 1. * @param rows Amount of rows to return. Can pass SQL_FETCH_ALL for all rows. * @return An array of rows. */ public fetchAbsolute(row: number, rows?: number): object[]; /** * Sets an attribute of the statement handle. */ public setStmtAttr(attribute: any, value: any): void; /** * returns the number of database rows returned from the most recent * fetch from the passed SELECT statement handle. */ public rowCount(): number; /** * Indicates whether or not the last row of the result set was returned * from the most recent fetch on the passed statement handle. */ public hasMoreRows(): boolean; /** * Indicates whether the end of data has been reached for the most recent fetch * of a statement handle. It is the opposite of pjs.hasMoreRows(). */ public endOfData(): boolean; } /** * Profound.js API for accessing data from a database. */ export let data: { /** * A shortcut for adding record(s) to a database. * There are more variables of the API. See here: https://docs.profoundlogic.com/x/gQDrAw * @param dbObject A database table or view. * @param data An object containing same named properties and values, which will to be added into the database. */ add(dbObject: string, data: any): object; /** * A shortcut for creating filter conditions that work across all databases. * There are more variables of the API. See here: https://docs.profoundlogic.com/x/hgDrAw * @param columnName A column name of a database table or view. * @param operator The SQL operator such as: =, >=, is not null, is null... * @param value The value to use for this condition (optional) */ createCondition(columnName: string, operator: string, value?: any): object; /** * A shortcut for deleting record(s) from a database. * There are more variables of the API. See here: https://docs.profoundlogic.com/x/gwDrAw * @param dbObject A database table or view. * @param filter A filter to be applied to narrow which records are deleted; Default is null = Any record */ delete(dbObject: string, filter?: any): object; /** * A shortcut for retrieving record(s) from a database. * There are more variables of the API. See here: https://docs.profoundlogic.com/x/jwDrAw * @param dbObject A database table or view. * @param filter A filter to be applied to narrow which records are retrieved; Default is null = Any record * @param limit Maximum number of records to retrieve; Default is null = No limit * @param skip Number of records to skip; Default is null = 0 * @param orderby The column(s) used to order the records; Default is null = none * @param select The column(s) to be retrieved; Default = * = All columns */ get(dbObject: string, filter?: any, limit?: number, skip?: number, orderby?: any, select?: any): Array<object> | object; /** * A shortcut for retrieving record(s) from a database. * There are more variables of the API. See here: https://docs.profoundlogic.com/x/lgDrAw * @param dbObject A database table or view. * @param filter A filter to be applied to narrow which records are counted; Default is null = Any record */ getCount(dbObject: string, filter?: any): number; /** * A shortcut for updating record(s) from a database. * There are more variables of the API. See here: https://docs.profoundlogic.com/x/mADrAw * @param dbObject A database table or view. * @param filter A filter to be applied to narrow which records are deleted; null = All records * @param data An object containing same named properties and values, which will to be applied/updated to each record. */ update(dbObject: string, filter: any, data: any): object; } /** * Profound.js API helper for creating database agnostic SQL statements. */ export let sqlHelper: { /** * Format a table/view name * See here: https://docs.profoundlogic.com/x/_gAyAw for additional information. * @param targetDB The target database type: IBMi, mysql, mssql, oracledb... * @param dbObject A database table or view. * @returns dbOjectName with appropiate escape characters */ formatTableName(targetDB: string, dbObject: string): string; /** * Format a column name * See here: https://docs.profoundlogic.com/x/_gAyAw for additional information. * @param targetDB The target database type: IBMi, mysql, mssql, oracledb... * @param columnName A database column name. * @returns columnName with appropiate escape characters */ formatColumnName(targetDB: string, columnName: string): string; /** * Get parameter token based on type of database * See here: https://docs.profoundlogic.com/x/_gAyAw for additional information. * @param targetDB The target database type: IBMi, mysql, mssql, oracledb... * @param value The value of the parameter * @param columnType The data type of this parameter * @returns parameter token */ getParameterToken(targetDB: string, value: any, columnType: string): string; /** * Inject limits into a SQL Statement * See here: https://docs.profoundlogic.com/x/_gAyAw for additional information. * @param targetDB The target database type: IBMi, mysql, mssql, oracledb... * @param sqlString An sql string. * @param limit Maximum number of rows to return, null = no max * @param skip Number of rows to skip, null = do not skip any * @returns sqlString with limits injected into it */ injectLimits(targetDB: string, sqlString: string, limit: number, skip: number): string; /** * Finalize a SQL statement so that it can be passed into the pjs.query() API * See here: https://docs.profoundlogic.com/x/_gAyAw for additional information. * @param targetDB The target database type: IBMi, mysql, mssql, oracledb... * @param sqlString An sql string. * @param paramters The parameters values. * @returns Database specific SQL statement */ finalizeSQL(targetDB: string, sqlString: string, parameters: any[]): string; /** * Log an SQL statement with parameter values * See here: https://docs.profoundlogic.com/x/_gAyAw for additional information. * @param sqlString An sql string. * @param paramters The parameters values. */ dumpSQLStatement(sqlString: string, parameters: any[]): void; } }