Package org.compiere.dbPort
Class Convert_SQL92
java.lang.Object
org.compiere.dbPort.Convert
org.compiere.dbPort.Convert_SQL92
- Direct Known Subclasses:
Convert_PostgreSQL
Convert from oracle syntax to sql 92 standard
- Author:
- Low Heng Sin
-
Field Summary
Fields inherited from class org.compiere.dbPort.Convert
m_conversionError, m_exception, m_stmt, m_verbose, REGEX_FLAGS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringconvertDecode(String sqlStatement, int fromIndex) Converts Decode.protected StringconvertDelete(String sqlStatement) Converts Delete.protected StringconvertOuterJoin(String sqlStatement) Convert Outer Join.
Converting joins can be very complex when multiple tables/keys are involved.
The main scenarios supported are two tables with multiple key columns and multiple tables with single key columns.protected booleanisOperator(char c) Is character a valid SQL operatorMethods inherited from class org.compiere.dbPort.Convert
cleanUpStatement, closeLogMigrationScript, convert, convertAll, convertIt, convertStatement, convertWithConvertMap, escapeQuotedString, execute, getConversionError, getConvertMap, getException, getGeneratedMigrationScriptFileName, getMigrationScriptFileName, getMigrationScriptFolder, hasError, isDontLogTable, isLogMigrationScript, isOracle, logMigrationScript, recoverQuotedStrings, replaceQuotedStrings, setVerbose
-
Constructor Details
-
Convert_SQL92
public Convert_SQL92()
-
-
Method Details
-
convertOuterJoin
Convert Outer Join.
Converting joins can be very complex when multiple tables/keys are involved.
The main scenarios supported are two tables with multiple key columns and multiple tables with single key columns.SELECT a.Col1, b.Col2 FROM tableA a, tableB b WHERE a.ID=b.ID(+) => SELECT a.Col1, b.Col2 FROM tableA a LEFT OUTER JOIN tableB b ON (a.ID=b.ID) SELECT a.Col1, b.Col2 FROM tableA a, tableB b WHERE a.ID(+)=b.ID => SELECT a.Col1, b.Col2 FROM tableA a RIGHT OUTER JOIN tableB b ON (a.ID=b.ID) Assumptions: - No outer joins in sub queries (ignores sub-queries) - OR condition ignored (not sure what to do, should not happen) Limitations: - Parameters for outer joins must be first - as sequence of parameters changes- Parameters:
sqlStatement-- Returns:
- converted statement
-
convertDecode
Converts Decode.DECODE (a, 1, 'one', 2, 'two', 'none') => CASE WHEN a = 1 THEN 'one' WHEN a = 2 THEN 'two' ELSE 'none' END- Parameters:
sqlStatement-- Returns:
- converted statement
-
convertDelete
Converts Delete.DELETE C_Order i WHERE => DELETE FROM C_Order WHERE- Parameters:
sqlStatement-- Returns:
- converted statement
-
isOperator
protected boolean isOperator(char c) Is character a valid SQL operator- Parameters:
c-- Returns:
- true if c is SQL operator
-