public class DatabaseCommandsHelper
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COPYDBTABLECOLUMNTOFILE |
static java.lang.String |
COPYDBTABLETOFILE |
static java.lang.String |
DELETEDBTABLERECORDS |
static java.lang.String |
EXECSQLCOMMIT |
static java.lang.String |
EXECSQLQUERY |
static java.lang.String |
GETDBTABLECOLUMNCOUNT |
static java.lang.String |
GETDBTABLEROWCOUNT |
static java.lang.String |
GETDBVALUE |
protected static java.sql.Connection |
lastConn |
protected static java.lang.String |
lastConnPass |
protected static java.lang.String |
lastConnUrl |
protected static java.lang.String |
lastConnUser |
static java.lang.String |
SETJDBCDRIVER |
static java.lang.String |
VERIFYDATABASENULLVALUE |
static java.lang.String |
VERIFYDATABASEVALUE |
static java.lang.String |
VERIFYDBNULLVALUE |
static java.lang.String |
VERIFYDBVALUE |
Constructor and Description |
---|
DatabaseCommandsHelper() |
Modifier and Type | Method and Description |
---|---|
static void |
copyDBTableColumnToFile(Processor pr)
Purpose: copyDBTableColumnToFile |
static void |
copyDBTableToFile(Processor pr)
Purpose: copyDBTableToFile |
static void |
deleteDBTableRecords(Processor pr)
Purpose: deleteDBTableRecords Deletes records in a database table 0. |
static boolean |
equalsDatabaseCommand(java.lang.String command) |
static void |
execSQLCommit(Processor pr)
Purpose: execSqlCommit Commits the pending queries on the database. |
static void |
execSQLQuery(Processor pr)
Purpose: execSQLQuery Executes the query provided in a queryStr on the database table. |
protected static java.sql.Connection |
getConnection(java.lang.String url,
java.lang.String user,
java.lang.String pass)
Purpose: getConnection; does this first: if (loadedDriver == null) loadDriver(null); then opens the connection |
static void |
getDBTableColumnCount(Processor pr)
Purpose: getDBTableColumnCount Executes 'select * from table' and returns the total column count. |
static void |
getDBTableRowCount(Processor pr)
Purpose: getDBTableRowCount Executes 'select * from table' and returns the total row count. |
static void |
getDBValue(Processor pr)
Purpose: getDBValue getAlternateParams: 0. |
protected static java.lang.Class |
loadDriver(java.lang.String driver)
Purpose: load driver |
static void |
setJdbcDriver(Processor pr)
Purpose: setJdbcDriver |
static void |
verifyDatabaseNullValue(Processor pr)
Purpose: verifyDatabaseNullValue Verifies that the value of a field in a database table is NULL. |
static void |
verifyDatabaseValue(Processor pr)
Purpose: verifyDatabaseValue: Verifies the case-sensitive value of a field in a database table. |
static void |
verifyDBNullValue(Processor pr)
Purpose: verifyDBNullValue: same as verifyDatabaseNullValue |
static void |
verifyDBValue(Processor pr)
Purpose: verifyDBValue: same as verifyDatabaseValue |
public static final java.lang.String SETJDBCDRIVER
public static final java.lang.String COPYDBTABLECOLUMNTOFILE
public static final java.lang.String COPYDBTABLETOFILE
public static final java.lang.String DELETEDBTABLERECORDS
public static final java.lang.String EXECSQLQUERY
public static final java.lang.String EXECSQLCOMMIT
public static final java.lang.String GETDBTABLECOLUMNCOUNT
public static final java.lang.String GETDBTABLEROWCOUNT
public static final java.lang.String GETDBVALUE
public static final java.lang.String VERIFYDATABASENULLVALUE
public static final java.lang.String VERIFYDATABASEVALUE
public static final java.lang.String VERIFYDBNULLVALUE
public static final java.lang.String VERIFYDBVALUE
protected static java.lang.String lastConnUrl
protected static java.lang.String lastConnUser
protected static java.lang.String lastConnPass
protected static java.sql.Connection lastConn
public static boolean equalsDatabaseCommand(java.lang.String command)
protected static java.sql.Connection getConnection(java.lang.String url, java.lang.String user, java.lang.String pass) throws java.sql.SQLException
url,
- Stringuser,
- Stringpass,
- Stringjava.sql.SQLException
protected static java.lang.Class loadDriver(java.lang.String driver) throws java.sql.SQLException
driver,
- String, if null will load the DEFAULT_DRIVERjava.sql.SQLException
public static void setJdbcDriver(Processor pr) throws SAFSException
pr,
- ProcessorSAFSException
public static void copyDBTableColumnToFile(Processor pr) throws SAFSException
This routine will export the contents of a DBTable to a delimeted file.
A data source name and Query String is required.
0. ADBAlias - ignored
1. ATableAlias - ignored
2. DBSourceName
Name of the Datasource containing the DBTable
3. FileOut
Name of the output file.
4. SQLQuery
The file will contain the results of the executed Query. The query is NOT validated by this function.
5. [ DirectoryOut ]
If not specified the file will be stored in the default test directory.
6. [ SQLStatus ]
A variable which holds the current SQL run status.
7. [ delimiter ]
If not specified the default ',' seperator will be used.
8. [ UserID ]
UserID for accessing the Datasource (if required).
9. [ Password ]
Password for accessing the Datasource (if required).
Examples:
C, CopyDBTableColumnToFile, ADBAlias, ATableAlias, Data Source Name (dsn), OutputFileName, [SQLQuery], [OutputDirectory], [Delimiter], [sqlStatus], "[UID]", "[PWD]"
pr,
- ProcessorSAFSException
public static void copyDBTableToFile(Processor pr) throws SAFSException
This routine will export the contents of a DBTable to a delimeted file.
A data source name, file out name, and table name are required.
0. ADBAlias - ignored
1. ATableAlias - ignored
2. DBSourceName
Name of the Datasource containing the DBTable
3. FileOut
Name of the output file.
4. DBTableName
Name of the TABLE to access within the DBSourceName
5. [ ColumnCount ]
If specified the output file will contain only the number of columns specified.
6. [ RowCount ]
If specified the output file will contain only the number of columns specified.
7. [ SQLQuery ]
If specified, the file will contain the results of the executed Query. The query is NOT validated by this function.
8. [ delimiter ]
If not specified the default ',' seperator will be used.
9. [ DirectoryOut ]
If not specified the file will be stored in the default test directory.
10. [ SQLStatus ]
A variable which holds the current SQL run status.
11. [ UserID ]
UserID for accessing the Datasource (if required).
12. [ Password ]
Password for accessing the Datasource (if required).
Examples:
C, CopyDBTableToFile, ADBAlias, ATableAlias, Data Source Name (dsn), OutputFileName, tableName, [ColumnCount],[rowCount], [SQLQuery], [Delimiter], [OutputDirectory], [sqlStatus], "[UID]", "[PWD]"
pr,
- ProcessorSAFSException
public static void deleteDBTableRecords(Processor pr) throws SAFSException
pr,
- ProcessorSAFSException
public static void execSQLQuery(Processor pr) throws SAFSException
pr,
- ProcessorSAFSException
public static void execSQLCommit(Processor pr) throws SAFSException
pr,
- ProcessorSAFSException
public static void getDBTableColumnCount(Processor pr) throws SAFSException
pr,
- ProcessorSAFSException
public static void getDBTableRowCount(Processor pr) throws SAFSException
pr,
- ProcessorSAFSException
public static void getDBValue(Processor pr) throws SAFSException
pr,
- ProcessorSAFSException
public static void verifyDatabaseNullValue(Processor pr) throws SAFSException
pr,
- ProcessorSAFSException
public static void verifyDatabaseValue(Processor pr) throws SAFSException
pr,
- ProcessorSAFSException
public static void verifyDBNullValue(Processor pr) throws SAFSException
pr,
- ProcessorSAFSException
public static void verifyDBValue(Processor pr) throws SAFSException
pr,
- ProcessorSAFSException
Copyright © SAS Institute. All Rights Reserved.