...
- pjs.sqlHelper.formatTableName(targetDB, tableName):
- IN: Target database (string). Valid values are "IBMi", "mysql", "mssql", and "oracledb".
- IN: Table name. It can also include a library or schema (such as mylib/mytable or myschema.mytable)
- OUT: The string of a table name along with all escape characters.
This function does support exact case match, but if no match then looks for first match regardless of case.
In MySQL table1 is returned as `table1`, but in MSSQL it is returned as [table1]
- pjs.sqlHelper.formatColumnName(targetDB, columnName):
- IN: Target database (string). Valid values are "IBMi", "mysql", "mssql", and "oracledb".
- IN: Column name. It can also include the table name/as (such as customers.id)
- OUT: The string of a table field name along with all the escape characters.
This function does support exact case match, but if no match then looks for first match regardless of case.
In MySQL field1 is returned as `field1`, but in MSSQL it is returned as [field1]
- pjs.sqlHelper.getParameterToken(targetDB, value, dataType):
- IN: Target database (string). Valid values are "IBMi", "mysql", "mssql", and "oracledb".
- IN: actual value
- IN: column type (such as number, date, time, datetime, char, etc)
- OUT: Return the string token. In almost every case this will return a "?"
Reason for this → Oracle does not support date, time, or timestamp column types)
- IN: Target database (string). Valid values are "IBMi", "mysql", "mssql", and "oracledb".
- injectLimits(targetDB, sqlString, rows, skip) - this is useful when doing loading data a page at a time
- IN: Target database (string). Valid values are "IBMi", "mysql", "mssql", and "oracledb".
- IN: sql Statement
- IN: Maximum # of rows to return, null = no max
- IN: # of rows to skip, null = do not skip any
- OUT: Returns a new SQL statement with the necessary verbiage so that the statement will only return those results.
- pjs.sqlHelper.finalizeSQL(targetDB, sqlString, sqlArgs)
- IN: Target database (string). Valid values are "IBMi", "mysql", "mssql", and "oracledb".
- IN: sql Statement
- IN: The SQL Arguments array (if any)
- OUT: Returns a new SQL statement with a finalized statement for this type of database.
Reason for this → MSSQL requires the tokens to be named instead of the simple "?"
If debugged is enabled, it will also automatically call the dumpSQLStatement()
- pjs.sqlHelper.dumpSQLStatement(sqlString, sqlArgs) - this is useful when will trying to figure out what SQL statement was generated
- IN: sql Statement
- IN: The SQL Arguments array (if any)
- Send the entire resolved sql statement to the standard output log (or console)
...