IDEMPIERE-4465 Native Postgres - Error on Convert Layer (#400)
* IDEMPIERE-4465 Native Postgres - Error on Convert Layer * IDEMPIERE-4465 Native Postgres - Error on Convert Layer
This commit is contained in:
parent
b778904d42
commit
71049fa02b
|
@ -81,16 +81,9 @@ public class Convert_PostgreSQL extends Convert_SQL92 {
|
|||
*/
|
||||
protected ArrayList<String> convertStatement(String sqlStatement) {
|
||||
ArrayList<String> result = new ArrayList<String>();
|
||||
if (DB_PostgreSQL.isUseNativeDialect()) {
|
||||
sqlStatement = convertSysDate(sqlStatement);
|
||||
sqlStatement = convertSimilarTo(sqlStatement);
|
||||
result.add(sqlStatement);
|
||||
return result;
|
||||
}
|
||||
|
||||
/** Vector to save previous values of quoted strings **/
|
||||
Vector<String> retVars = new Vector<String>();
|
||||
|
||||
|
||||
String nonce = sharedNonce;
|
||||
|
||||
// check for collision with nonce
|
||||
|
@ -100,39 +93,48 @@ public class Convert_PostgreSQL extends Convert_SQL92 {
|
|||
}
|
||||
|
||||
String statement = replaceQuotedStrings(sqlStatement, retVars, nonce);
|
||||
statement = convertWithConvertMap(statement);
|
||||
statement = convertSimilarTo(statement);
|
||||
statement = DB_PostgreSQL.removeNativeKeyworkMarker(statement);
|
||||
|
||||
String cmpString = statement.toUpperCase();
|
||||
boolean isCreate = cmpString.startsWith("CREATE ");
|
||||
|
||||
// Process
|
||||
if (isCreate && cmpString.indexOf(" FUNCTION ") != -1)
|
||||
;
|
||||
else if (isCreate && cmpString.indexOf(" TRIGGER ") != -1)
|
||||
;
|
||||
else if (isCreate && cmpString.indexOf(" PROCEDURE ") != -1)
|
||||
;
|
||||
else if (isCreate && cmpString.indexOf(" VIEW ") != -1)
|
||||
;
|
||||
else if (cmpString.indexOf("ALTER TABLE") != -1) {
|
||||
statement = recoverQuotedStrings(statement, retVars, nonce);
|
||||
retVars.clear();
|
||||
statement = convertDDL(convertComplexStatement(statement));
|
||||
/*
|
||||
} else if (cmpString.indexOf("ROWNUM") != -1) {
|
||||
result.add(convertRowNum(convertComplexStatement(convertAlias(statement))));*/
|
||||
} else if (cmpString.indexOf("DELETE ") != -1
|
||||
&& cmpString.indexOf("DELETE FROM") == -1) {
|
||||
statement = convertDelete(statement);
|
||||
statement = convertComplexStatement(convertAlias(statement));
|
||||
} else if (cmpString.indexOf("DELETE FROM") != -1) {
|
||||
statement = convertComplexStatement(convertAlias(statement));
|
||||
} else if (cmpString.indexOf("UPDATE ") != -1) {
|
||||
statement = convertComplexStatement(convertUpdate(convertAlias(statement)));
|
||||
if (DB_PostgreSQL.isUseNativeDialect()) {
|
||||
|
||||
statement = convertSysDate(statement);
|
||||
statement = convertSimilarTo(statement);
|
||||
|
||||
} else {
|
||||
statement = convertComplexStatement(convertAlias(statement));
|
||||
|
||||
statement = convertWithConvertMap(statement);
|
||||
statement = convertSimilarTo(statement);
|
||||
statement = DB_PostgreSQL.removeNativeKeyworkMarker(statement);
|
||||
|
||||
String cmpString = statement.toUpperCase();
|
||||
boolean isCreate = cmpString.startsWith("CREATE ");
|
||||
|
||||
// Process
|
||||
if (isCreate && cmpString.indexOf(" FUNCTION ") != -1)
|
||||
;
|
||||
else if (isCreate && cmpString.indexOf(" TRIGGER ") != -1)
|
||||
;
|
||||
else if (isCreate && cmpString.indexOf(" PROCEDURE ") != -1)
|
||||
;
|
||||
else if (isCreate && cmpString.indexOf(" VIEW ") != -1)
|
||||
;
|
||||
else if (cmpString.indexOf("ALTER TABLE") != -1) {
|
||||
statement = recoverQuotedStrings(statement, retVars, nonce);
|
||||
retVars.clear();
|
||||
statement = convertDDL(convertComplexStatement(statement));
|
||||
/*
|
||||
} else if (cmpString.indexOf("ROWNUM") != -1) {
|
||||
result.add(convertRowNum(convertComplexStatement(convertAlias(statement))));*/
|
||||
} else if (cmpString.indexOf("DELETE ") != -1
|
||||
&& cmpString.indexOf("DELETE FROM") == -1) {
|
||||
statement = convertDelete(statement);
|
||||
statement = convertComplexStatement(convertAlias(statement));
|
||||
} else if (cmpString.indexOf("DELETE FROM") != -1) {
|
||||
statement = convertComplexStatement(convertAlias(statement));
|
||||
} else if (cmpString.indexOf("UPDATE ") != -1) {
|
||||
statement = convertComplexStatement(convertUpdate(convertAlias(statement)));
|
||||
} else {
|
||||
statement = convertComplexStatement(convertAlias(statement));
|
||||
}
|
||||
}
|
||||
if (retVars.size() > 0)
|
||||
statement = recoverQuotedStrings(statement, retVars, nonce);
|
||||
|
|
Loading…
Reference in New Issue