public abstract class SimpleDriver extends AbstractDriver
Modifier and Type | Field and Description |
---|---|
static String |
DEF_FUNCTION_CLASS
The default function class.
|
static String |
END_ON_EXCEPTION
The "end on exception" sql.
|
static String |
ON_EXCEPTION
The "on exception" sql.
|
ALLOWED_IDENT_CHARS
BASE_CLASS_PATH, CASE_SENSITIVE_LOWER, CASE_SENSITIVE_LOWER_STR, CASE_SENSITIVE_UNDEFINED, CASE_SENSITIVE_UPPER, CASE_SENSITIVE_UPPER_STR, CMD_OPTIONS_PARAM, DB_PARAM, DDL_TYPE, ETL_CODE, FUNC_TYPE, PROC_TYPE, SERVER_PARAM, TABLE_TYPE
APP, COMMAND, ETL_DRIVER, FORMATTER, IDE_NODE, NO_RANK, WIDGET
Constructor and Description |
---|
SimpleDriver()
Instantiates a new simple driver.
|
Modifier and Type | Method and Description |
---|---|
String |
convertStringForStorage(String value)
Converts string so it can be used as s part of sql.
|
String |
convertValueForStorage(Object fieldValue,
int fieldType,
boolean isFromTable)
Converts value to string depending on
fieldType so it can be
used as s part of sql. |
void |
deleteStagingBinary(Connection conn,
String tableName)
Deletes staging table.
|
String |
filter(String value)
Filters string.
|
String |
getAddColumnSql()
Gets the ADD COLUMN SQL.
|
String |
getAlterTableAddColumnSql(String name,
FieldDef column,
FieldsRepository fieldsRepository)
Gets the alter table add column sql.
|
String |
getBegin()
Gets the "begin" sql statement.
|
String |
getBeginSplited()
Gets the "begin" token for splited sql.
|
Object |
getBlob(ResultSet rs,
int pos)
Gets the blob from the result set.
|
String |
getCallSql(String name)
Gets the "call" sql.
|
char |
getCharUsedForColumnsWithSpaces()
Gets the open and close char used for columns with spaces.
|
Object |
getClob(ResultSet rs,
int pos)
Gets the CLOB from the result set.
|
String |
getCreateTableSql(String name,
DataSet dataSet,
boolean isTemporary,
String key,
FieldsRepository fieldsRepository)
Gets the "create table" sql.
|
String |
getCursorLoopEndSql(String name,
DataSet dataSet)
Gets the "loop end" sql for the cursor.
|
String |
getCursorLoopStartSql(String name,
String cursorSql,
DataSet dataSet)
Gets the "loop start" sql for the cursor.
|
String |
getCursorRecAccessSql(String fieldName)
Gets the record access sql for the cursor.
|
String |
getDeclare()
Gets the "declare" sql.
|
String |
getDeclareCursorEndSql()
Gets the "declare cursor end" sql.
|
String |
getDeclareCursorSql(String sql,
String name,
String cursorSql,
DataSet dataSet)
Gets the "declare cursor" sql.
|
String |
getDeclareCursorVarSql(String sql,
DataSet dataSet,
String key,
FieldsRepository fieldsRepository,
Set<String> variables)
Gets the "declare cursor variable" sql.
|
String |
getDefaultFunctionClass()
Gets the default function class name.
|
String |
getDefaultType()
Gets the default database type.
|
String |
getDelimiter()
Gets the default delimiter.
|
TypedKeyValue<String,Integer> |
getDestinationInfo(String sql)
Gets the destination name and exception handler type from the sql.
|
String |
getDropSql(String type,
String name)
Gets the "drop" sql.
|
String |
getEnd()
Gets the "end" sql.
|
String |
getEndSplited()
Gets the "end" token for the splited sql statement.
|
String |
getIf()
Gets the "if" token.
|
String |
getIfBegin()
Gets the "if begin" token.
|
String |
getIfElse()
Gets the "if else" token.
|
String |
getIfEnd()
Gets the "if end" token.
|
String |
getInitSql()
Gets the initialization sql.
|
int |
getLinesLimit()
Gets the maximum number of lines in the sql block supported by database.
|
int |
getMaxCharSize()
Gets the maximum character size.
|
int |
getMaxPrecision()
Gets the maximum precision.
|
int |
getMaxScale()
Gets the maximum scale.
|
int |
getMaxStringLiteralSize()
Gets the maximum string literal size.
|
int |
getMaxVarcharSize()
Gets the maximum varchar size.
|
String |
getMergeStatement(TypedKeyValue<List<String>,List<Object>> fieldsAndValues,
String tableName,
String key)
Gets the merge statement.
|
String |
getMetadataSelectClause()
Gets the metadata "select" clause.
|
String |
getMetadataWhereClause()
Gets the metadata "where" clause.
|
Object |
getObject(ResultSet rs,
int index,
FieldDef fieldDef)
Gets the object from result set.
|
String |
getOnException(OnException onException)
Gets the "on exception" sql.
|
String |
getOnExceptionBegin(OnException onException,
long row)
Gets the "on exception begin" sql.
|
String |
getOnExceptionEnd()
Gets the "on exception end" sql.
|
int |
getParamType(String type)
Gets the parameter type from the output variable type.
|
Driver |
getParentDriver()
Gets the parent driver.
|
String |
getParentDriverName()
Gets the parent driver class name.
|
int |
getPrecision(int precision,
String type)
Gets the correct precision for the given type.
|
String |
getSafeDelimiter()
Gets the safe delimiter which can be added to any sql statetement.
|
String |
getTempTableName(String name)
Gets the temporary table name.
|
String |
getTopSelectClause(int top)
Gets the "top select" clause.
|
String |
getTopTrailClause(int top)
Gets the "top trail" clause.
|
String |
getTopWhereClause(int top)
Gets the "top where" clause.
|
String |
getType(FieldDef fieldDef,
String key,
FieldsRepository fieldsRepository)
Gets the native field type.
|
String |
getVarDeclare()
Gets the variable declare statement.
|
String |
getVarName(String name)
Gets the variable name.
|
int |
getWrongScale()
Gets the wrong scale.
|
boolean |
ignoreExceptionsDuringInit()
The "Ignore exceptions during initialization" flag.
|
boolean |
isMergeInNonCallableSupported()
Checks if "merge" statement can be not callable.
|
boolean |
needSeparateConnectionForDdl()
Check if driver requires separate connection for ddl statements.
|
String |
replaceOnException(String sql)
Replaces sql on exception.
|
boolean |
requiresRollbackAfterSqlError()
Returns true if database requires rollback after sql error.
|
void |
setBlob(PreparedStatement pstmt,
Object value,
int pos)
Sets the blob field.
|
void |
setClob(PreparedStatement pstmt,
Object value,
int pos)
Sets the clob field.
|
void |
setInitSql(String value)
Sets the initialization sql.
|
void |
setLinesLimit(int value)
Sets the maximum number of lines in the sql block supported by database.
|
void |
setMaxCharSize(int value)
Sets the maximum char size.
|
void |
setMaxPrecision(int value)
Sets the maximum precision.
|
void |
setMaxScale(int value)
Sets the maximum scale.
|
void |
setMaxStringLiteralSize(int value)
Sets the maximum string literal size.
|
void |
setMaxVarcharSize(int value)
Sets the maximum varchar size.
|
void |
setParentDriverName(String value)
Sets the parent driver class name.
|
boolean |
supportsAnonymousBlocks()
"Supports anonymous blocks" flag.
|
boolean |
supportsBinaryInProc()
"Supports binary data types in procedures" flag.
|
boolean |
supportsCallableStatement()
"Supports callable statement" flag.
|
boolean |
supportsExplainPlan()
"Supports explain plan" flag.
|
boolean |
supportsExternalTool()
"Supports external tool" flag.
|
boolean |
supportsInnerFunctions()
"Supports inner functions" flag.
|
boolean |
supportsParamsInAnonymousBlocks()
"Supports parameters in anonymous blocks" flag.
|
boolean |
supportsRollbackAfterDDL()
"Supports rollback after ddl" flag.
|
void |
updateStagingBlob(Connection conn,
Variable var,
String pkValue,
Object value)
Updates staging blob.
|
void |
updateStagingClob(Connection conn,
Variable var,
String pkValue,
Object value)
Updates staging clob.
|
Object |
value2StorageValue(int fieldType,
Object value,
Map<String,String> params,
boolean booleanToNumber)
Converts value for storage.
|
alwaysEncloseTableAndColumnsInQuotes, captureLog, compareTo, externalToolRequiresRedirect, getAllowedIdentifierChars, getAlterTableAddColumnSql, getAutotrace, getCaseSensitive, getCmdOptions, getColumns, getConfigFileName, getConnectionFile, getDefaultNull, getDeleteStatement, getDisplayName, getErrorLinePattern, getExtensionRank, getHome, getIdentifierName, getIdentifierName, getInsertStatement, getLicensePropertyName, getLocalUnitClassPath, getNativeType, getObjectCheckSql, getPostDeclareSql, getProperties, getSafeSql, getSelectStatement, getSqlForAutotrace, getSqlForExplainPlan, getSqlKeywordsFileName, getStartTransactionSql, getStringFieldSizeMultiplier, getTableName, getTablePrefixWhenAddingTable, getType, getUpdateStatement, isEqualDriver, requiresExecuteQuery, requiresSeparateConnectionForIndexes, setAlwaysEncloseTableAndColumnsInQuotes, setCaseSensitive, setStringFieldSizeMultiplier, setUpConnection, supportColonInFormatter, supportsAutotrace, supportsLogging, supportsNotNullable, supportsParallelExtract, supportsParallelLoad, supportsParentDriver, supportsPreparedStatement, supportsPreparedStatementInParallelThreads, supportsPreparedStatementInTransaction, tableName2Name, typeHasSize
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
disableMetadataOnWrite, getCmdForExternalTool, getExplainPlan, getExternalToolName, getIoProcessorClassName, getJdbcDriverClassName, getMetadataClassName, getName, getPropsWizardResource, getSqlForExternalTool, getUrlPattern, ifDoesNotExistSql, ifExistsSql, openCloseConnectionOnDdl, requiresSemicolonInMerge, supportedJoinTypes, supportedSetOperations, supportsIndexes, supportsScripts
getIconPath, getVendor, getVersion, getXmlConfigFileName
public static final String DEF_FUNCTION_CLASS
public static final String ON_EXCEPTION
public static final String END_ON_EXCEPTION
public String convertStringForStorage(String value)
Driver
value
- the valuepublic String getSafeDelimiter()
Driver
getSafeDelimiter
in interface Driver
getSafeDelimiter
in class AbstractDriver
public String getDelimiter()
Driver
getDelimiter
in interface Driver
getDelimiter
in class AbstractDriver
public String convertValueForStorage(Object fieldValue, int fieldType, boolean isFromTable)
Driver
fieldType
so it can be
used as s part of sql.fieldValue
- the field valuefieldType
- the field type Types
}isFromTable
- if true the value is coming from result set, otherwise - from
the database cursorpublic void deleteStagingBinary(Connection conn, String tableName) throws Exception
Driver
conn
- the connectiontableName
- the table nameException
- in case of any errorpublic String filter(String value)
Driver
filter
in interface Driver
filter
in class AbstractDriver
value
- the valuepublic String getBegin()
Driver
public String getBeginSplited()
Driver
public Object getBlob(ResultSet rs, int pos) throws Exception
Driver
rs
- the result setpos
- the position ofr the blob fieldException
- in case of any errorpublic String getCallSql(String name)
Driver
name
- the name of the procedurepublic char getCharUsedForColumnsWithSpaces()
Driver
public Object getClob(ResultSet rs, int pos) throws Exception
Driver
rs
- the result setpos
- the position of the clob fieldException
- in case of any errorpublic Driver getParentDriver()
Driver
getParentDriver
in interface Driver
getParentDriver
in class AbstractDriver
public String getCreateTableSql(String name, DataSet dataSet, boolean isTemporary, String key, FieldsRepository fieldsRepository)
Driver
name
- the table namedataSet
- the data setisTemporary
- if true the table is temporarykey
- the key field(s)fieldsRepository
- the fields repositoryFieldsRepository
public String getAlterTableAddColumnSql(String name, FieldDef column, FieldsRepository fieldsRepository)
Driver
getAlterTableAddColumnSql
in interface Driver
getAlterTableAddColumnSql
in class AbstractDriver
name
- the namecolumn
- the columnfieldsRepository
- the fields repositorypublic String getCursorLoopEndSql(String name, DataSet dataSet)
Driver
name
- the name of the cusrordataSet
- the data setpublic String getCursorLoopStartSql(String name, String cursorSql, DataSet dataSet)
Driver
name
- the name of the cursorcursorSql
- the cursor sqldataSet
- the data setpublic String getCursorRecAccessSql(String fieldName)
Driver
fieldName
- the field namepublic String getDeclare()
Driver
public String getDeclareCursorEndSql()
Driver
public String getDeclareCursorSql(String sql, String name, String cursorSql, DataSet dataSet)
Driver
sql
- the sqlname
- the name of the cursorcursorSql
- the cursor sqldataSet
- the data setpublic String getDeclareCursorVarSql(String sql, DataSet dataSet, String key, FieldsRepository fieldsRepository, Set<String> variables)
Driver
sql
- the sqldataSet
- the data setkey
- the key field(s)fieldsRepository
- the fields repositoryvariables
- the variablesFieldsRepository
public String getDefaultFunctionClass()
Driver
Function
public String getDefaultType()
Driver
public TypedKeyValue<String,Integer> getDestinationInfo(String sql)
Driver
sql
- the sqlpublic String getDropSql(String type, String name)
Driver
type
- the object type. Possible values: PROC_TYPE, FUNC_TYPE,
DDL_TYPE, TABLE_TYPEname
- the object namepublic String getEnd()
Driver
public String getEndSplited()
Driver
public String getIf()
Driver
public String getIfBegin()
Driver
public String getIfElse()
Driver
public String getIfEnd()
Driver
public String getInitSql()
Driver
public int getLinesLimit()
Driver
public int getMaxCharSize()
Driver
public int getMaxPrecision()
Driver
public int getMaxScale()
Driver
public int getMaxStringLiteralSize()
Driver
public int getMaxVarcharSize()
Driver
public String getMergeStatement(TypedKeyValue<List<String>,List<Object>> fieldsAndValues, String tableName, String key)
Driver
getMergeStatement
in interface Driver
getMergeStatement
in class AbstractDriver
fieldsAndValues
- the fields and valuestableName
- the table namekey
- the key field(s)public String getMetadataSelectClause()
Driver
public String getMetadataWhereClause()
Driver
public Object getObject(ResultSet rs, int index, FieldDef fieldDef) throws Exception
Driver
rs
- the result setindex
- the index of the fieldfieldDef
- the field typeException
- in case of any errorpublic String getOnException(OnException onException)
Driver
onException
- the OnExceptionOnException
public String getOnExceptionBegin(OnException onException, long row)
Driver
onException
- the OnExceptionrow
- the rowOnException
public String getOnExceptionEnd()
Driver
public int getParamType(String type)
Driver
type
- the output variable typepublic String getParentDriverName()
Driver
public String getTempTableName(String name)
Driver
name
- the namepublic String getTopSelectClause(int top)
Driver
top
- the maximum number of rows to selectpublic String getTopTrailClause(int top)
Driver
top
- the maximum number of rows to selectpublic String getTopWhereClause(int top)
Driver
top
- the maximum number of rows to selectpublic String getType(FieldDef fieldDef, String key, FieldsRepository fieldsRepository)
Driver
fieldDef
- the field definitionkey
- the key field(s)fieldsRepository
- the fields repositorypublic String getVarDeclare()
Driver
public String getVarName(String name)
Driver
name
- the namepublic int getWrongScale()
Driver
public boolean ignoreExceptionsDuringInit()
Driver
public boolean isMergeInNonCallableSupported()
Driver
isMergeInNonCallableSupported
in interface Driver
isMergeInNonCallableSupported
in class AbstractDriver
public boolean needSeparateConnectionForDdl()
Driver
needSeparateConnectionForDdl
in interface Driver
needSeparateConnectionForDdl
in class AbstractDriver
public String replaceOnException(String sql)
Driver
sql
- the sqlpublic boolean requiresRollbackAfterSqlError()
Driver
requiresRollbackAfterSqlError
in interface Driver
requiresRollbackAfterSqlError
in class AbstractDriver
public void setBlob(PreparedStatement pstmt, Object value, int pos) throws Exception
Driver
pstmt
- the prepared statementvalue
- the valuepos
- the position for the blob fieldException
- in case of any errorpublic void setClob(PreparedStatement pstmt, Object value, int pos) throws Exception
Driver
pstmt
- the prepared statementvalue
- the valuepos
- the position of the clob fieldException
- in case of any errorpublic void setInitSql(String value)
Driver
value
- the new initialization sqlpublic void setLinesLimit(int value)
Driver
value
- the new lines limitpublic void setMaxCharSize(int value)
Driver
value
- the new maximum char sizepublic void setMaxPrecision(int value)
Driver
value
- the new maximum precisionpublic void setMaxScale(int value)
Driver
value
- the new maximum scalepublic void setMaxStringLiteralSize(int value)
Driver
value
- the new maximum string literal sizepublic void setMaxVarcharSize(int value)
Driver
value
- the new maximum varchar sizepublic void setParentDriverName(String value)
Driver
value
- the parent driver class namepublic boolean supportsAnonymousBlocks()
Driver
public boolean supportsBinaryInProc()
Driver
public boolean supportsCallableStatement()
Driver
public boolean supportsExplainPlan()
Driver
public boolean supportsExternalTool()
Driver
public boolean supportsInnerFunctions()
Driver
public boolean supportsParamsInAnonymousBlocks()
Driver
public boolean supportsRollbackAfterDDL()
Driver
public void updateStagingBlob(Connection conn, Variable var, String pkValue, Object value) throws Exception
Driver
conn
- the connectionvar
- the variablepkValue
- the primary key valuevalue
- the valueException
- in case of any errorpublic void updateStagingClob(Connection conn, Variable var, String pkValue, Object value) throws Exception
Driver
conn
- the connectionvar
- the variablepkValue
- the primary key valuevalue
- the valueException
- in case of any errorpublic Object value2StorageValue(int fieldType, Object value, Map<String,String> params, boolean booleanToNumber)
Driver
fieldType
- the field type Types
value
- the valueparams
- the parametersbooleanToNumber
- if true convert boolean true/false to 1/0public String getAddColumnSql()
Driver
getAddColumnSql
in interface Driver
getAddColumnSql
in class AbstractDriver
public int getPrecision(int precision, String type)
Driver
precision
- the precisiontype
- the typeCopyright © 2010-2020 Toolsverse. All Rights Reserved.