IDEMPIERE-4962 Performance: change PostgreSQL native dialect mode default to true (#889)
- minor refinement and fix Convert_PostreSQLTest
This commit is contained in:
parent
078d130cd7
commit
f4894c4cb5
|
@ -18,4 +18,5 @@ Bundle-Activator: org.adempiere.db.postgresql.PostgreSQLBundleActivator
|
||||||
Service-Component: OSGI-INF/*.xml
|
Service-Component: OSGI-INF/*.xml
|
||||||
Automatic-Module-Name: org.compiere.db.postgresql.provider
|
Automatic-Module-Name: org.compiere.db.postgresql.provider
|
||||||
Bundle-Vendor: iDempiere Community
|
Bundle-Vendor: iDempiere Community
|
||||||
Export-Package: org.adempiere.db.postgresql.config
|
Export-Package: org.adempiere.db.postgresql.config,
|
||||||
|
org.compiere.dbPort
|
||||||
|
|
|
@ -81,63 +81,15 @@ public class Convert_PostgreSQL extends Convert_SQL92 {
|
||||||
*/
|
*/
|
||||||
protected ArrayList<String> convertStatement(String sqlStatement) {
|
protected ArrayList<String> convertStatement(String sqlStatement) {
|
||||||
ArrayList<String> result = new ArrayList<String>();
|
ArrayList<String> result = new ArrayList<String>();
|
||||||
/** Vector to save previous values of quoted strings **/
|
|
||||||
Vector<String> retVars = new Vector<String>();
|
|
||||||
|
|
||||||
String nonce = sharedNonce;
|
|
||||||
|
|
||||||
// check for collision with nonce
|
|
||||||
while ( sqlStatement.contains(nonce))
|
|
||||||
{
|
|
||||||
nonce = generateNonce();
|
|
||||||
}
|
|
||||||
|
|
||||||
String statement = replaceQuotedStrings(sqlStatement, retVars, nonce);
|
|
||||||
|
|
||||||
|
String statement = null;
|
||||||
if (DB_PostgreSQL.isUseNativeDialect()) {
|
if (DB_PostgreSQL.isUseNativeDialect()) {
|
||||||
|
statement = sqlStatement;
|
||||||
statement = convertSysDate(statement);
|
statement = convertSysDate(statement);
|
||||||
statement = convertSimilarTo(statement);
|
statement = convertSimilarTo(statement);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
statement = convertOracleStatement(sqlStatement);
|
||||||
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);
|
|
||||||
result.add(statement);
|
result.add(statement);
|
||||||
|
|
||||||
if ("true".equals(System.getProperty("org.idempiere.db.debug"))) {
|
if ("true".equals(System.getProperty("org.idempiere.db.debug"))) {
|
||||||
|
@ -154,6 +106,62 @@ public class Convert_PostgreSQL extends Convert_SQL92 {
|
||||||
return result;
|
return result;
|
||||||
} // convertStatement
|
} // convertStatement
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert Oracle SQL statement to PostgreSQL syntax
|
||||||
|
* @param sqlStatement oracle sql statement
|
||||||
|
* @return PostgreSQL statement
|
||||||
|
*/
|
||||||
|
public String convertOracleStatement(String sqlStatement) {
|
||||||
|
String statement;
|
||||||
|
String nonce = sharedNonce;
|
||||||
|
|
||||||
|
// check for collision with nonce
|
||||||
|
while ( sqlStatement.contains(nonce))
|
||||||
|
{
|
||||||
|
nonce = generateNonce();
|
||||||
|
}
|
||||||
|
/** Vector to save previous values of quoted strings **/
|
||||||
|
Vector<String> retVars = new Vector<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)));
|
||||||
|
} else {
|
||||||
|
statement = convertComplexStatement(convertAlias(statement));
|
||||||
|
}
|
||||||
|
if (retVars.size() > 0)
|
||||||
|
statement = recoverQuotedStrings(statement, retVars, nonce);
|
||||||
|
return statement;
|
||||||
|
}
|
||||||
|
|
||||||
private String convertSysDate(String statement) {
|
private String convertSysDate(String statement) {
|
||||||
String retValue = statement;
|
String retValue = statement;
|
||||||
String replacement = "getDate()";
|
String replacement = "getDate()";
|
||||||
|
|
|
@ -23,7 +23,8 @@ Import-Package: org.junit.jupiter.api;version="5.6.0",
|
||||||
Require-Bundle: org.adempiere.base;bundle-version="9.0.0",
|
Require-Bundle: org.adempiere.base;bundle-version="9.0.0",
|
||||||
org.adempiere.base.callout;bundle-version="9.0.0",
|
org.adempiere.base.callout;bundle-version="9.0.0",
|
||||||
org.adempiere.base.process;bundle-version="9.0.0",
|
org.adempiere.base.process;bundle-version="9.0.0",
|
||||||
org.adempiere.payment.processor;bundle-version="9.0.0"
|
org.adempiere.payment.processor;bundle-version="9.0.0",
|
||||||
|
org.compiere.db.postgresql.provider;bundle-version="9.0.0"
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Bundle-Activator: org.idempiere.test.TestActivator
|
Bundle-Activator: org.idempiere.test.TestActivator
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-11
|
Bundle-RequiredExecutionEnvironment: JavaSE-11
|
||||||
|
|
|
@ -15,7 +15,7 @@ package org.idempiere.test.base;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
import org.compiere.util.DB;
|
import org.compiere.dbPort.Convert_PostgreSQL;
|
||||||
import org.idempiere.test.AbstractTestCase;
|
import org.idempiere.test.AbstractTestCase;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
@ -25,10 +25,10 @@ import org.junit.jupiter.api.Test;
|
||||||
* @version 20061225
|
* @version 20061225
|
||||||
*/
|
*/
|
||||||
public final class Convert_PostgreSQLTest extends AbstractTestCase {
|
public final class Convert_PostgreSQLTest extends AbstractTestCase {
|
||||||
//private Convert_PostgreSQL convert = new Convert_PostgreSQL();
|
private String sql;
|
||||||
String sql;
|
private String sqe;
|
||||||
String sqe;
|
private String r;
|
||||||
String r;
|
private Convert_PostgreSQL convert = new Convert_PostgreSQL();
|
||||||
|
|
||||||
public Convert_PostgreSQLTest() {}
|
public Convert_PostgreSQLTest() {}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
|
||||||
+ "WHERE p.M_Product_ID=A_Asset.M_Product_ID "
|
+ "WHERE p.M_Product_ID=A_Asset.M_Product_ID "
|
||||||
+ "AND A_Asset.IsActive='Y' AND A_Asset.M_Product_ID=0";
|
+ "AND A_Asset.IsActive='Y' AND A_Asset.M_Product_ID=0";
|
||||||
|
|
||||||
r = DB.getDatabase().convertStatement(sql);
|
r = convert.convertOracleStatement(sql);
|
||||||
assertEquals(sqe, r);
|
assertEquals(sqe, r);
|
||||||
}
|
}
|
||||||
@Test
|
@Test
|
||||||
|
@ -76,7 +76,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
|
||||||
+"ii.I_ReportLine_ID=(SELECT MIN(I_ReportLine_ID) FROM I_ReportLine iii "
|
+"ii.I_ReportLine_ID=(SELECT MIN(I_ReportLine_ID) FROM I_ReportLine iii "
|
||||||
+"WHERE I_ReportLine.Name=iii.Name AND I_ReportLine.PA_ReportLineSet_ID=iii.PA_ReportLineSet_ID)) "
|
+"WHERE I_ReportLine.Name=iii.Name AND I_ReportLine.PA_ReportLineSet_ID=iii.PA_ReportLineSet_ID)) "
|
||||||
+"AND I_ReportLine.I_IsImported='N' AND I_ReportLine.AD_Client_ID=0";
|
+"AND I_ReportLine.I_IsImported='N' AND I_ReportLine.AD_Client_ID=0";
|
||||||
r = DB.getDatabase().convertStatement(sql);
|
r = convert.convertOracleStatement(sql);
|
||||||
assertEquals(sqe, r);
|
assertEquals(sqe, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
|
||||||
" WHERE old.AD_Language=new.AD_Language" +
|
" WHERE old.AD_Language=new.AD_Language" +
|
||||||
" AND AD_PrintFormatItem_ID =2)";
|
" AND AD_PrintFormatItem_ID =2)";
|
||||||
sqe = "UPDATE AD_PrintFormatItem_Trl SET PrintName=\"old\".PrintName,PrintNameSuffix=\"old\".PrintNameSuffix,IsTranslated=\"old\".IsTranslated FROM AD_PrintFormatItem_Trl \"old\" WHERE \"old\".AD_Language=AD_PrintFormatItem_Trl.AD_Language AND \"old\".AD_PrintFormatItem_ID =0 AND AD_PrintFormatItem_Trl.AD_PrintFormatItem_ID=1 AND EXISTS (SELECT AD_PrintFormatItem_ID FROM AD_PrintFormatItem_trl \"old\" WHERE \"old\".AD_Language=AD_PrintFormatItem_Trl.AD_Language AND AD_PrintFormatItem_ID =2)";
|
sqe = "UPDATE AD_PrintFormatItem_Trl SET PrintName=\"old\".PrintName,PrintNameSuffix=\"old\".PrintNameSuffix,IsTranslated=\"old\".IsTranslated FROM AD_PrintFormatItem_Trl \"old\" WHERE \"old\".AD_Language=AD_PrintFormatItem_Trl.AD_Language AND \"old\".AD_PrintFormatItem_ID =0 AND AD_PrintFormatItem_Trl.AD_PrintFormatItem_ID=1 AND EXISTS (SELECT AD_PrintFormatItem_ID FROM AD_PrintFormatItem_trl \"old\" WHERE \"old\".AD_Language=AD_PrintFormatItem_Trl.AD_Language AND AD_PrintFormatItem_ID =2)";
|
||||||
r = DB.getDatabase().convertStatement(sql);
|
r = convert.convertOracleStatement(sql);
|
||||||
assertEquals(sqe, r);
|
assertEquals(sqe, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,52 +106,52 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
|
||||||
sql = "ALTER TABLE Test MODIFY T_Integer NUMBER(10) NOT NULL";
|
sql = "ALTER TABLE Test MODIFY T_Integer NUMBER(10) NOT NULL";
|
||||||
//sqe = "ALTER TABLE Test ALTER COLUMN T_Integer TYPE NUMERIC(10); ALTER TABLE Test ALTER COLUMN T_Integer SET NOT NULL;";
|
//sqe = "ALTER TABLE Test ALTER COLUMN T_Integer TYPE NUMERIC(10); ALTER TABLE Test ALTER COLUMN T_Integer SET NOT NULL;";
|
||||||
sqe = "INSERT INTO t_alter_column values('test','T_Integer','NUMERIC(10)','NOT NULL',null)";
|
sqe = "INSERT INTO t_alter_column values('test','T_Integer','NUMERIC(10)','NOT NULL',null)";
|
||||||
r = DB.getDatabase().convertStatement(sql);
|
r = convert.convertOracleStatement(sql);
|
||||||
assertEquals(sqe, r);
|
assertEquals(sqe, r);
|
||||||
|
|
||||||
sql = "ALTER TABLE Test MODIFY T_Integer NUMBER(10) NULL";
|
sql = "ALTER TABLE Test MODIFY T_Integer NUMBER(10) NULL";
|
||||||
//sqe = "ALTER TABLE Test ALTER COLUMN T_Integer TYPE NUMERIC(10); ALTER TABLE Test ALTER COLUMN T_Integer DROP NOT NULL;";
|
//sqe = "ALTER TABLE Test ALTER COLUMN T_Integer TYPE NUMERIC(10); ALTER TABLE Test ALTER COLUMN T_Integer DROP NOT NULL;";
|
||||||
sqe = "INSERT INTO t_alter_column values('test','T_Integer','NUMERIC(10)','NULL',null)";
|
sqe = "INSERT INTO t_alter_column values('test','T_Integer','NUMERIC(10)','NULL',null)";
|
||||||
r = DB.getDatabase().convertStatement(sql);
|
r = convert.convertOracleStatement(sql);
|
||||||
assertEquals(sqe, r);
|
assertEquals(sqe, r);
|
||||||
|
|
||||||
sql = "ALTER TABLE Test MODIFY T_Integer NOT NULL";
|
sql = "ALTER TABLE Test MODIFY T_Integer NOT NULL";
|
||||||
sqe = "INSERT INTO t_alter_column values('test','T_Integer',null,'NOT NULL',null)";
|
sqe = "INSERT INTO t_alter_column values('test','T_Integer',null,'NOT NULL',null)";
|
||||||
r = DB.getDatabase().convertStatement(sql);
|
r = convert.convertOracleStatement(sql);
|
||||||
assertEquals(sqe, r);
|
assertEquals(sqe, r);
|
||||||
|
|
||||||
// Line 407 of ImportProduct.java
|
// Line 407 of ImportProduct.java
|
||||||
sql = "ALTER TABLE LPI_Publication MODIFY AD_Client_ID NUMERIC(10) DEFAULT NULL";
|
sql = "ALTER TABLE LPI_Publication MODIFY AD_Client_ID NUMERIC(10) DEFAULT NULL";
|
||||||
//sqe = "ALTER TABLE LPI_Publication ALTER COLUMN AD_Client_ID TYPE NUMERIC(10); ALTER TABLE LPI_Publication ALTER COLUMN AD_Client_ID SET DEFAULT NULL; ";
|
//sqe = "ALTER TABLE LPI_Publication ALTER COLUMN AD_Client_ID TYPE NUMERIC(10); ALTER TABLE LPI_Publication ALTER COLUMN AD_Client_ID SET DEFAULT NULL; ";
|
||||||
sqe = "INSERT INTO t_alter_column values('lpi_publication','AD_Client_ID','NUMERIC(10)',null,'NULL')";
|
sqe = "INSERT INTO t_alter_column values('lpi_publication','AD_Client_ID','NUMERIC(10)',null,'NULL')";
|
||||||
r = DB.getDatabase().convertStatement(sql);
|
r = convert.convertOracleStatement(sql);
|
||||||
assertEquals(sqe, r);
|
assertEquals(sqe, r);
|
||||||
|
|
||||||
//add column with default fail in libero 2pack import
|
//add column with default fail in libero 2pack import
|
||||||
sql = "ALTER TABLE XX ADD A VARCHAR2(10) DEFAULT --";
|
sql = "ALTER TABLE XX ADD A VARCHAR2(10) DEFAULT --";
|
||||||
sqe = "ALTER TABLE XX ADD COLUMN A VARCHAR(10) DEFAULT '--'";
|
sqe = "ALTER TABLE XX ADD COLUMN A VARCHAR(10) DEFAULT '--'";
|
||||||
r = DB.getDatabase().convertStatement(sql);
|
r = convert.convertOracleStatement(sql);
|
||||||
assertEquals(sqe, r.trim());
|
assertEquals(sqe, r.trim());
|
||||||
|
|
||||||
//[ adempiere-Bugs-1746266 ]
|
//[ adempiere-Bugs-1746266 ]
|
||||||
sql = "ALTER TABLE someTableName MODIFY someColumnName NVARCHAR2(64)";
|
sql = "ALTER TABLE someTableName MODIFY someColumnName NVARCHAR2(64)";
|
||||||
sqe = "INSERT INTO t_alter_column values('sometablename','someColumnName','VARCHAR(64)',null,null)";
|
sqe = "INSERT INTO t_alter_column values('sometablename','someColumnName','VARCHAR(64)',null,null)";
|
||||||
r = DB.getDatabase().convertStatement(sql);
|
r = convert.convertOracleStatement(sql);
|
||||||
assertEquals(sqe, r.trim());
|
assertEquals(sqe, r.trim());
|
||||||
|
|
||||||
sql = "ALTER TABLE S_Resource MODIFY IsActive CHAR(1) DEFAULT 'Y'";
|
sql = "ALTER TABLE S_Resource MODIFY IsActive CHAR(1) DEFAULT 'Y'";
|
||||||
sqe = "INSERT INTO t_alter_column values('s_resource','IsActive','CHAR(1)',null,'Y')";
|
sqe = "INSERT INTO t_alter_column values('s_resource','IsActive','CHAR(1)',null,'Y')";
|
||||||
r = DB.getDatabase().convertStatement(sql);
|
r = convert.convertOracleStatement(sql);
|
||||||
assertEquals(sqe, r.trim());
|
assertEquals(sqe, r.trim());
|
||||||
|
|
||||||
sql = "ALTER TABLE PP_Order_NodeNext MODIFY PP_Order_NodeNext_ID NULL";
|
sql = "ALTER TABLE PP_Order_NodeNext MODIFY PP_Order_NodeNext_ID NULL";
|
||||||
sqe = "INSERT INTO t_alter_column values('pp_order_nodenext','PP_Order_NodeNext_ID',null,'NULL',null)";
|
sqe = "INSERT INTO t_alter_column values('pp_order_nodenext','PP_Order_NodeNext_ID',null,'NULL',null)";
|
||||||
r = DB.getDatabase().convertStatement(sql);
|
r = convert.convertOracleStatement(sql);
|
||||||
assertEquals(sqe, r.trim());
|
assertEquals(sqe, r.trim());
|
||||||
|
|
||||||
sql = "ALTER TABLE C_InvoiceTax ADD Created DATE DEFAULT SYSDATE NOT NULL";
|
sql = "ALTER TABLE C_InvoiceTax ADD Created DATE DEFAULT SYSDATE NOT NULL";
|
||||||
sqe = "ALTER TABLE C_InvoiceTax ADD COLUMN Created TIMESTAMP DEFAULT statement_timestamp() NOT NULL";
|
sqe = "ALTER TABLE C_InvoiceTax ADD COLUMN Created TIMESTAMP DEFAULT statement_timestamp() NOT NULL";
|
||||||
r = DB.getDatabase().convertStatement(sql);
|
r = convert.convertOracleStatement(sql);
|
||||||
assertEquals(sqe, r.trim());
|
assertEquals(sqe, r.trim());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
|
||||||
public void test1705768() {
|
public void test1705768() {
|
||||||
sql = "SELECT 'Partner <--> Organization', 's2\\$', 's3' FROM DUAL";
|
sql = "SELECT 'Partner <--> Organization', 's2\\$', 's3' FROM DUAL";
|
||||||
sqe = "SELECT 'Partner <--> Organization', E's2\\\\$', 's3'";
|
sqe = "SELECT 'Partner <--> Organization', E's2\\\\$', 's3'";
|
||||||
r = DB.getDatabase().convertStatement(sql);
|
r = convert.convertOracleStatement(sql);
|
||||||
assertEquals(sqe, r);
|
assertEquals(sqe, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
|
||||||
// [ 1704261 ] can not import currency rate
|
// [ 1704261 ] can not import currency rate
|
||||||
sql = "UPDATE I_Conversion_Rate i SET MultiplyRate = 1 / DivideRate WHERE (MultiplyRate IS NULL OR MultiplyRate = 0) AND DivideRate IS NOT NULL AND DivideRate<>0 AND I_IsImported<>'Y' AND AD_Client_ID=1000000";
|
sql = "UPDATE I_Conversion_Rate i SET MultiplyRate = 1 / DivideRate WHERE (MultiplyRate IS NULL OR MultiplyRate = 0) AND DivideRate IS NOT NULL AND DivideRate<>0 AND I_IsImported<>'Y' AND AD_Client_ID=1000000";
|
||||||
sqe = "UPDATE I_Conversion_Rate SET MultiplyRate = 1 / DivideRate WHERE (MultiplyRate IS NULL OR MultiplyRate = 0) AND DivideRate IS NOT NULL AND DivideRate<>0 AND I_IsImported<>'Y' AND AD_Client_ID=1000000";
|
sqe = "UPDATE I_Conversion_Rate SET MultiplyRate = 1 / DivideRate WHERE (MultiplyRate IS NULL OR MultiplyRate = 0) AND DivideRate IS NOT NULL AND DivideRate<>0 AND I_IsImported<>'Y' AND AD_Client_ID=1000000";
|
||||||
r = DB.getDatabase().convertStatement(sql);
|
r = convert.convertOracleStatement(sql);
|
||||||
assertEquals(sqe, r);
|
assertEquals(sqe, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,13 +179,13 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
|
||||||
//[ 1668720 ] Convert failing in alter table
|
//[ 1668720 ] Convert failing in alter table
|
||||||
sql = "ALTER TABLE GT_TaxBase ADD CONSTRAINT GT_TaxBase_Key PRIMARY KEY (GT_TaxBase_ID)";
|
sql = "ALTER TABLE GT_TaxBase ADD CONSTRAINT GT_TaxBase_Key PRIMARY KEY (GT_TaxBase_ID)";
|
||||||
sqe = "ALTER TABLE GT_TaxBase ADD CONSTRAINT GT_TaxBase_Key PRIMARY KEY (GT_TaxBase_ID)";
|
sqe = "ALTER TABLE GT_TaxBase ADD CONSTRAINT GT_TaxBase_Key PRIMARY KEY (GT_TaxBase_ID)";
|
||||||
r = DB.getDatabase().convertStatement(sql);
|
r = convert.convertOracleStatement(sql);
|
||||||
assertEquals(sqe, r);
|
assertEquals(sqe, r);
|
||||||
|
|
||||||
//[ 1668720 ] Convert failing in alter table
|
//[ 1668720 ] Convert failing in alter table
|
||||||
sql = "ALTER TABLE GT_TaxBase ADD GT_TaxBase_ID NUMBER(10) NOT NULL";
|
sql = "ALTER TABLE GT_TaxBase ADD GT_TaxBase_ID NUMBER(10) NOT NULL";
|
||||||
sqe = "ALTER TABLE GT_TaxBase ADD COLUMN GT_TaxBase_ID NUMERIC(10) NOT NULL";
|
sqe = "ALTER TABLE GT_TaxBase ADD COLUMN GT_TaxBase_ID NUMERIC(10) NOT NULL";
|
||||||
r = DB.getDatabase().convertStatement(sql);
|
r = convert.convertOracleStatement(sql);
|
||||||
assertEquals(sqe, r);
|
assertEquals(sqe, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,12 +194,12 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
|
||||||
//[ 1662983 ] Convert cutting backslash from string
|
//[ 1662983 ] Convert cutting backslash from string
|
||||||
sql = "SELECT 'C:\\Documentos\\Test' FROM DUAL";
|
sql = "SELECT 'C:\\Documentos\\Test' FROM DUAL";
|
||||||
sqe = "SELECT E'C:\\\\Documentos\\\\Test'";
|
sqe = "SELECT E'C:\\\\Documentos\\\\Test'";
|
||||||
r = DB.getDatabase().convertStatement(sql);
|
r = convert.convertOracleStatement(sql);
|
||||||
assertEquals(sqe, r);
|
assertEquals(sqe, r);
|
||||||
|
|
||||||
sql = "SELECT 'C:Document' FROM DUAL";
|
sql = "SELECT 'C:Document' FROM DUAL";
|
||||||
sqe = "SELECT 'C:Document'";
|
sqe = "SELECT 'C:Document'";
|
||||||
r = DB.getDatabase().convertStatement(sql);
|
r = convert.convertOracleStatement(sql);
|
||||||
assertEquals(sqe, r);
|
assertEquals(sqe, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
|
||||||
// Line 407 of ImportProduct.java
|
// Line 407 of ImportProduct.java
|
||||||
sql = "UPDATE M_PRODUCT SET (Value,Name,Description,DocumentNote,Help,UPC,SKU,C_UOM_ID,M_Product_Category_ID,Classification,ProductType,Volume,Weight,ShelfWidth,ShelfHeight,ShelfDepth,UnitsPerPallet,Discontinued,DiscontinuedBy,Updated,UpdatedBy)= (SELECT Value,Name,Description,DocumentNote,Help,UPC,SKU,C_UOM_ID,M_Product_Category_ID,Classification,ProductType,Volume,Weight,ShelfWidth,ShelfHeight,ShelfDepth,UnitsPerPallet,Discontinued,DiscontinuedBy,SysDate,UpdatedBy FROM I_Product WHERE I_Product_ID=?) WHERE M_Product_ID=?";
|
sql = "UPDATE M_PRODUCT SET (Value,Name,Description,DocumentNote,Help,UPC,SKU,C_UOM_ID,M_Product_Category_ID,Classification,ProductType,Volume,Weight,ShelfWidth,ShelfHeight,ShelfDepth,UnitsPerPallet,Discontinued,DiscontinuedBy,Updated,UpdatedBy)= (SELECT Value,Name,Description,DocumentNote,Help,UPC,SKU,C_UOM_ID,M_Product_Category_ID,Classification,ProductType,Volume,Weight,ShelfWidth,ShelfHeight,ShelfDepth,UnitsPerPallet,Discontinued,DiscontinuedBy,SysDate,UpdatedBy FROM I_Product WHERE I_Product_ID=?) WHERE M_Product_ID=?";
|
||||||
sqe = "UPDATE M_PRODUCT SET Value=I_Product.Value,Name=I_Product.Name,Description=I_Product.Description,DocumentNote=I_Product.DocumentNote,Help=I_Product.Help,UPC=I_Product.UPC,SKU=I_Product.SKU,C_UOM_ID=I_Product.C_UOM_ID,M_Product_Category_ID=I_Product.M_Product_Category_ID,Classification=I_Product.Classification,ProductType=I_Product.ProductType,Volume=I_Product.Volume,Weight=I_Product.Weight,ShelfWidth=I_Product.ShelfWidth,ShelfHeight=I_Product.ShelfHeight,ShelfDepth=I_Product.ShelfDepth,UnitsPerPallet=I_Product.UnitsPerPallet,Discontinued=I_Product.Discontinued,DiscontinuedBy=I_Product.DiscontinuedBy,Updated=statement_timestamp(),UpdatedBy=I_Product.UpdatedBy FROM I_Product WHERE I_Product.I_Product_ID=? AND M_PRODUCT.M_Product_ID=?";
|
sqe = "UPDATE M_PRODUCT SET Value=I_Product.Value,Name=I_Product.Name,Description=I_Product.Description,DocumentNote=I_Product.DocumentNote,Help=I_Product.Help,UPC=I_Product.UPC,SKU=I_Product.SKU,C_UOM_ID=I_Product.C_UOM_ID,M_Product_Category_ID=I_Product.M_Product_Category_ID,Classification=I_Product.Classification,ProductType=I_Product.ProductType,Volume=I_Product.Volume,Weight=I_Product.Weight,ShelfWidth=I_Product.ShelfWidth,ShelfHeight=I_Product.ShelfHeight,ShelfDepth=I_Product.ShelfDepth,UnitsPerPallet=I_Product.UnitsPerPallet,Discontinued=I_Product.Discontinued,DiscontinuedBy=I_Product.DiscontinuedBy,Updated=statement_timestamp(),UpdatedBy=I_Product.UpdatedBy FROM I_Product WHERE I_Product.I_Product_ID=? AND M_PRODUCT.M_Product_ID=?";
|
||||||
r = DB.getDatabase().convertStatement(sql);
|
r = convert.convertOracleStatement(sql);
|
||||||
assertEquals(sqe, r);
|
assertEquals(sqe, r);
|
||||||
|
|
||||||
//FinReport, test inner join in multi column update
|
//FinReport, test inner join in multi column update
|
||||||
|
@ -220,7 +220,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
|
||||||
+ "WHERE r.Fact_Acct_ID=fa.Fact_Acct_ID) "
|
+ "WHERE r.Fact_Acct_ID=fa.Fact_Acct_ID) "
|
||||||
+ "WHERE Fact_Acct_ID <> 0 AND AD_PInstance_ID=0";
|
+ "WHERE Fact_Acct_ID <> 0 AND AD_PInstance_ID=0";
|
||||||
sqe = "UPDATE T_Report SET Name=e.Name,Description=fa.Description FROM Fact_Acct fa INNER JOIN AD_Table t ON (fa.AD_Table_ID=t.AD_Table_ID) INNER JOIN AD_Element e ON (t.TableName||'_ID'=e.ColumnName) WHERE T_Report.Fact_Acct_ID=fa.Fact_Acct_ID AND T_Report.Fact_Acct_ID <> 0 AND T_Report.AD_PInstance_ID=0";
|
sqe = "UPDATE T_Report SET Name=e.Name,Description=fa.Description FROM Fact_Acct fa INNER JOIN AD_Table t ON (fa.AD_Table_ID=t.AD_Table_ID) INNER JOIN AD_Element e ON (t.TableName||'_ID'=e.ColumnName) WHERE T_Report.Fact_Acct_ID=fa.Fact_Acct_ID AND T_Report.Fact_Acct_ID <> 0 AND T_Report.AD_PInstance_ID=0";
|
||||||
r = DB.getDatabase().convertStatement(sql);
|
r = convert.convertOracleStatement(sql);
|
||||||
assertEquals(sqe, r);
|
assertEquals(sqe, r);
|
||||||
|
|
||||||
//https://sourceforge.net/forum/message.php?msg_id=4083672
|
//https://sourceforge.net/forum/message.php?msg_id=4083672
|
||||||
|
@ -234,7 +234,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
|
||||||
+" AND (c.ColumnName <> e.ColumnName OR c.Name <> e.Name "
|
+" AND (c.ColumnName <> e.ColumnName OR c.Name <> e.Name "
|
||||||
+" OR NVL(c.Description,' ') <> NVL(e.Description,' ') OR NVL(c.Help,' ') <> NVL(e.Help,' ')))";
|
+" OR NVL(c.Description,' ') <> NVL(e.Description,' ') OR NVL(c.Help,' ') <> NVL(e.Help,' ')))";
|
||||||
sqe = "UPDATE AD_COLUMN SET ColumnName=e.ColumnName,Name=e.Name,Description=e.Description,Help=e.Help, Updated = statement_timestamp() FROM AD_ELEMENT e WHERE AD_COLUMN.AD_Element_ID=e.AD_Element_ID AND EXISTS (SELECT 1 FROM AD_ELEMENT e WHERE AD_COLUMN.AD_Element_ID=e.AD_Element_ID AND (AD_COLUMN.ColumnName <> e.ColumnName OR AD_COLUMN.Name <> e.Name OR COALESCE(AD_COLUMN.Description,' ') <> COALESCE(e.Description,' ') OR COALESCE(AD_COLUMN.Help,' ') <> COALESCE(e.Help,' ')))";
|
sqe = "UPDATE AD_COLUMN SET ColumnName=e.ColumnName,Name=e.Name,Description=e.Description,Help=e.Help, Updated = statement_timestamp() FROM AD_ELEMENT e WHERE AD_COLUMN.AD_Element_ID=e.AD_Element_ID AND EXISTS (SELECT 1 FROM AD_ELEMENT e WHERE AD_COLUMN.AD_Element_ID=e.AD_Element_ID AND (AD_COLUMN.ColumnName <> e.ColumnName OR AD_COLUMN.Name <> e.Name OR COALESCE(AD_COLUMN.Description,' ') <> COALESCE(e.Description,' ') OR COALESCE(AD_COLUMN.Help,' ') <> COALESCE(e.Help,' ')))";
|
||||||
r = DB.getDatabase().convertStatement(sql);
|
r = convert.convertOracleStatement(sql);
|
||||||
assertEquals(sqe, r);
|
assertEquals(sqe, r);
|
||||||
|
|
||||||
sql="UPDATE AD_WF_NODE n"
|
sql="UPDATE AD_WF_NODE n"
|
||||||
|
@ -246,7 +246,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
|
||||||
+" WHERE f.AD_Process_ID=n.AD_Process_ID"
|
+" WHERE f.AD_Process_ID=n.AD_Process_ID"
|
||||||
+" AND (f.Name <> n.Name OR NVL(f.Description,' ') <> NVL(n.Description,' ') OR NVL(f.Help,' ') <> NVL(n.Help,' ')))";
|
+" AND (f.Name <> n.Name OR NVL(f.Description,' ') <> NVL(n.Description,' ') OR NVL(f.Help,' ') <> NVL(n.Help,' ')))";
|
||||||
sqe = "UPDATE AD_WF_NODE SET Name=f.Name,Description=f.Description,Help=f.Help FROM AD_PROCESS f WHERE f.AD_Process_ID=AD_WF_NODE.AD_Process_ID AND AD_WF_NODE.IsCentrallyMaintained = 'Y' AND EXISTS (SELECT 1 FROM AD_PROCESS f WHERE f.AD_Process_ID=AD_WF_NODE.AD_Process_ID AND (f.Name <> AD_WF_NODE.Name OR COALESCE(f.Description,' ') <> COALESCE(AD_WF_NODE.Description,' ') OR COALESCE(f.Help,' ') <> COALESCE(AD_WF_NODE.Help,' ')))";
|
sqe = "UPDATE AD_WF_NODE SET Name=f.Name,Description=f.Description,Help=f.Help FROM AD_PROCESS f WHERE f.AD_Process_ID=AD_WF_NODE.AD_Process_ID AND AD_WF_NODE.IsCentrallyMaintained = 'Y' AND EXISTS (SELECT 1 FROM AD_PROCESS f WHERE f.AD_Process_ID=AD_WF_NODE.AD_Process_ID AND (f.Name <> AD_WF_NODE.Name OR COALESCE(f.Description,' ') <> COALESCE(AD_WF_NODE.Description,' ') OR COALESCE(f.Help,' ') <> COALESCE(AD_WF_NODE.Help,' ')))";
|
||||||
r = DB.getDatabase().convertStatement(sql);
|
r = convert.convertOracleStatement(sql);
|
||||||
assertEquals(sqe, r);
|
assertEquals(sqe, r);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -256,7 +256,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
|
||||||
// test conversion of reserved words inside quotes
|
// test conversion of reserved words inside quotes
|
||||||
sql = "UPDATE AD_Message_Trl SET MsgText='{0} Linea(s) {1,number,#,##0.00} - Total: {2,number,#,##0.00}',MsgTip=NULL,Updated=TO_DATE('2007-01-12 21:44:31','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y' WHERE AD_Message_ID=828 AND AD_Language='es_MX'";
|
sql = "UPDATE AD_Message_Trl SET MsgText='{0} Linea(s) {1,number,#,##0.00} - Total: {2,number,#,##0.00}',MsgTip=NULL,Updated=TO_DATE('2007-01-12 21:44:31','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y' WHERE AD_Message_ID=828 AND AD_Language='es_MX'";
|
||||||
sqe = "UPDATE AD_Message_Trl SET MsgText='{0} Linea(s) {1,number,#,##0.00} - Total: {2,number,#,##0.00}',MsgTip=NULL,Updated=TO_TIMESTAMP('2007-01-12 21:44:31','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y' WHERE AD_Message_ID=828 AND AD_Language='es_MX'";
|
sqe = "UPDATE AD_Message_Trl SET MsgText='{0} Linea(s) {1,number,#,##0.00} - Total: {2,number,#,##0.00}',MsgTip=NULL,Updated=TO_TIMESTAMP('2007-01-12 21:44:31','YYYY-MM-DD HH24:MI:SS'),IsTranslated='Y' WHERE AD_Message_ID=828 AND AD_Language='es_MX'";
|
||||||
r = DB.getDatabase().convertStatement(sql);
|
r = convert.convertOracleStatement(sql);
|
||||||
assertEquals(sqe, r);
|
assertEquals(sqe, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,7 +270,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
|
||||||
+ " WHERE record_id <> 0 " + " AND ad_pinstance_id = 1000024 "
|
+ " WHERE record_id <> 0 " + " AND ad_pinstance_id = 1000024 "
|
||||||
+ " AND pa_reportline_id = 101 " + " AND fact_acct_id = 0 ";
|
+ " AND pa_reportline_id = 101 " + " AND fact_acct_id = 0 ";
|
||||||
sqe = "UPDATE t_report SET NAME=c_elementvalue.VALUE,description=c_elementvalue.NAME FROM c_elementvalue WHERE c_elementvalue.c_elementvalue_id = t_report.record_id AND t_report.record_id <> 0 AND t_report.ad_pinstance_id = 1000024 AND t_report.pa_reportline_id = 101 AND t_report.fact_acct_id = 0";
|
sqe = "UPDATE t_report SET NAME=c_elementvalue.VALUE,description=c_elementvalue.NAME FROM c_elementvalue WHERE c_elementvalue.c_elementvalue_id = t_report.record_id AND t_report.record_id <> 0 AND t_report.ad_pinstance_id = 1000024 AND t_report.pa_reportline_id = 101 AND t_report.fact_acct_id = 0";
|
||||||
r = DB.getDatabase().convertStatement(sql);
|
r = convert.convertOracleStatement(sql);
|
||||||
assertEquals(sqe, r);
|
assertEquals(sqe, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,7 +280,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
|
||||||
//test limit
|
//test limit
|
||||||
sql = "UPDATE I_Order SET M_Warehouse_ID=(SELECT M_Warehouse_ID FROM M_Warehouse w WHERE ROWNUM=1 AND I_Order.AD_Client_ID=w.AD_Client_ID AND I_Order.AD_Org_ID=w.AD_Org_ID) WHERE M_Warehouse_ID IS NULL AND I_IsImported<>'Y' AND AD_Client_ID=11";
|
sql = "UPDATE I_Order SET M_Warehouse_ID=(SELECT M_Warehouse_ID FROM M_Warehouse w WHERE ROWNUM=1 AND I_Order.AD_Client_ID=w.AD_Client_ID AND I_Order.AD_Org_ID=w.AD_Org_ID) WHERE M_Warehouse_ID IS NULL AND I_IsImported<>'Y' AND AD_Client_ID=11";
|
||||||
sqe = "UPDATE I_Order SET M_Warehouse_ID=(SELECT M_Warehouse_ID FROM M_Warehouse w WHERE I_Order.AD_Client_ID=w.AD_Client_ID AND I_Order.AD_Org_ID=w.AD_Org_ID LIMIT 1 ) WHERE M_Warehouse_ID IS NULL AND I_IsImported<>'Y' AND AD_Client_ID=11" ;
|
sqe = "UPDATE I_Order SET M_Warehouse_ID=(SELECT M_Warehouse_ID FROM M_Warehouse w WHERE I_Order.AD_Client_ID=w.AD_Client_ID AND I_Order.AD_Org_ID=w.AD_Org_ID LIMIT 1 ) WHERE M_Warehouse_ID IS NULL AND I_IsImported<>'Y' AND AD_Client_ID=11" ;
|
||||||
r = DB.getDatabase().convertStatement(sql);
|
r = convert.convertOracleStatement(sql);
|
||||||
assertEquals(sqe, r);
|
assertEquals(sqe, r);
|
||||||
|
|
||||||
//Doc_Invoice
|
//Doc_Invoice
|
||||||
|
@ -297,12 +297,12 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
|
||||||
+ " AND po.M_Product_ID=il.M_Product_ID AND po.C_BPartner_ID=i.C_BPartner_ID"
|
+ " AND po.M_Product_ID=il.M_Product_ID AND po.C_BPartner_ID=i.C_BPartner_ID"
|
||||||
+ " AND i.C_Invoice_ID=0)";
|
+ " AND i.C_Invoice_ID=0)";
|
||||||
sqe = "UPDATE M_Product_PO SET PriceLastInv = (SELECT currencyConvert(il.PriceActual,i.C_Currency_ID,M_Product_PO.C_Currency_ID,i.DateInvoiced,i.C_ConversionType_ID,i.AD_Client_ID,i.AD_Org_ID) FROM C_Invoice i, C_InvoiceLine il WHERE i.C_Invoice_ID=il.C_Invoice_ID AND M_Product_PO.M_Product_ID=il.M_Product_ID AND M_Product_PO.C_BPartner_ID=i.C_BPartner_ID AND i.C_Invoice_ID=0 LIMIT 1 ) WHERE EXISTS (SELECT * FROM C_Invoice i, C_InvoiceLine il WHERE i.C_Invoice_ID=il.C_Invoice_ID AND M_Product_PO.M_Product_ID=il.M_Product_ID AND M_Product_PO.C_BPartner_ID=i.C_BPartner_ID AND i.C_Invoice_ID=0)";
|
sqe = "UPDATE M_Product_PO SET PriceLastInv = (SELECT currencyConvert(il.PriceActual,i.C_Currency_ID,M_Product_PO.C_Currency_ID,i.DateInvoiced,i.C_ConversionType_ID,i.AD_Client_ID,i.AD_Org_ID) FROM C_Invoice i, C_InvoiceLine il WHERE i.C_Invoice_ID=il.C_Invoice_ID AND M_Product_PO.M_Product_ID=il.M_Product_ID AND M_Product_PO.C_BPartner_ID=i.C_BPartner_ID AND i.C_Invoice_ID=0 LIMIT 1 ) WHERE EXISTS (SELECT * FROM C_Invoice i, C_InvoiceLine il WHERE i.C_Invoice_ID=il.C_Invoice_ID AND M_Product_PO.M_Product_ID=il.M_Product_ID AND M_Product_PO.C_BPartner_ID=i.C_BPartner_ID AND i.C_Invoice_ID=0)";
|
||||||
r = DB.getDatabase().convertStatement(sql);
|
r = convert.convertOracleStatement(sql);
|
||||||
assertEquals(sqe, r);
|
assertEquals(sqe, r);
|
||||||
|
|
||||||
sql="UPDATE T_InventoryValue SET PricePO = (SELECT currencyConvert (po.PriceList,po.C_Currency_ID,T_InventoryValue.C_Currency_ID,T_InventoryValue.DateValue,null, po.AD_Client_ID,po.AD_Org_ID) FROM M_Product_PO po WHERE po.M_Product_ID=T_InventoryValue.M_Product_ID AND po.IsCurrentVendor='Y' AND RowNum=1), PriceList = (SELECT currencyConvert(pp.PriceList,pl.C_Currency_ID,T_InventoryValue.C_Currency_ID,T_InventoryValue.DateValue,null, pl.AD_Client_ID,pl.AD_Org_ID) FROM M_PriceList pl, M_PriceList_Version plv, M_ProductPrice pp WHERE pp.M_Product_ID=T_InventoryValue.M_Product_ID AND pp.M_PriceList_Version_ID=T_InventoryValue.M_PriceList_Version_ID AND pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID), PriceStd = (SELECT currencyConvert(pp.PriceStd,pl.C_Currency_ID,T_InventoryValue.C_Currency_ID,T_InventoryValue.DateValue,null, pl.AD_Client_ID,pl.AD_Org_ID) FROM M_PriceList pl, M_PriceList_Version plv, M_ProductPrice pp WHERE pp.M_Product_ID=T_InventoryValue.M_Product_ID AND pp.M_PriceList_Version_ID=T_InventoryValue.M_PriceList_Version_ID AND pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID), PriceLimit = (SELECT currencyConvert(pp.PriceLimit,pl.C_Currency_ID,T_InventoryValue.C_Currency_ID,T_InventoryValue.DateValue,null, pl.AD_Client_ID,pl.AD_Org_ID) FROM M_PriceList pl, M_PriceList_Version plv, M_ProductPrice pp WHERE pp.M_Product_ID=T_InventoryValue.M_Product_ID AND pp.M_PriceList_Version_ID=T_InventoryValue.M_PriceList_Version_ID AND pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID)";
|
sql="UPDATE T_InventoryValue SET PricePO = (SELECT currencyConvert (po.PriceList,po.C_Currency_ID,T_InventoryValue.C_Currency_ID,T_InventoryValue.DateValue,null, po.AD_Client_ID,po.AD_Org_ID) FROM M_Product_PO po WHERE po.M_Product_ID=T_InventoryValue.M_Product_ID AND po.IsCurrentVendor='Y' AND RowNum=1), PriceList = (SELECT currencyConvert(pp.PriceList,pl.C_Currency_ID,T_InventoryValue.C_Currency_ID,T_InventoryValue.DateValue,null, pl.AD_Client_ID,pl.AD_Org_ID) FROM M_PriceList pl, M_PriceList_Version plv, M_ProductPrice pp WHERE pp.M_Product_ID=T_InventoryValue.M_Product_ID AND pp.M_PriceList_Version_ID=T_InventoryValue.M_PriceList_Version_ID AND pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID), PriceStd = (SELECT currencyConvert(pp.PriceStd,pl.C_Currency_ID,T_InventoryValue.C_Currency_ID,T_InventoryValue.DateValue,null, pl.AD_Client_ID,pl.AD_Org_ID) FROM M_PriceList pl, M_PriceList_Version plv, M_ProductPrice pp WHERE pp.M_Product_ID=T_InventoryValue.M_Product_ID AND pp.M_PriceList_Version_ID=T_InventoryValue.M_PriceList_Version_ID AND pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID), PriceLimit = (SELECT currencyConvert(pp.PriceLimit,pl.C_Currency_ID,T_InventoryValue.C_Currency_ID,T_InventoryValue.DateValue,null, pl.AD_Client_ID,pl.AD_Org_ID) FROM M_PriceList pl, M_PriceList_Version plv, M_ProductPrice pp WHERE pp.M_Product_ID=T_InventoryValue.M_Product_ID AND pp.M_PriceList_Version_ID=T_InventoryValue.M_PriceList_Version_ID AND pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID)";
|
||||||
sqe = "UPDATE T_InventoryValue SET PricePO = (SELECT currencyConvert (po.PriceList,po.C_Currency_ID,T_InventoryValue.C_Currency_ID,T_InventoryValue.DateValue,null, po.AD_Client_ID,po.AD_Org_ID) FROM M_Product_PO po WHERE po.M_Product_ID=T_InventoryValue.M_Product_ID AND po.IsCurrentVendor='Y' LIMIT 1 ), PriceList = (SELECT currencyConvert(pp.PriceList,pl.C_Currency_ID,T_InventoryValue.C_Currency_ID,T_InventoryValue.DateValue,null, pl.AD_Client_ID,pl.AD_Org_ID) FROM M_PriceList pl, M_PriceList_Version plv, M_ProductPrice pp WHERE pp.M_Product_ID=T_InventoryValue.M_Product_ID AND pp.M_PriceList_Version_ID=T_InventoryValue.M_PriceList_Version_ID AND pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID), PriceStd = (SELECT currencyConvert(pp.PriceStd,pl.C_Currency_ID,T_InventoryValue.C_Currency_ID,T_InventoryValue.DateValue,null, pl.AD_Client_ID,pl.AD_Org_ID) FROM M_PriceList pl, M_PriceList_Version plv, M_ProductPrice pp WHERE pp.M_Product_ID=T_InventoryValue.M_Product_ID AND pp.M_PriceList_Version_ID=T_InventoryValue.M_PriceList_Version_ID AND pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID), PriceLimit = (SELECT currencyConvert(pp.PriceLimit,pl.C_Currency_ID,T_InventoryValue.C_Currency_ID,T_InventoryValue.DateValue,null, pl.AD_Client_ID,pl.AD_Org_ID) FROM M_PriceList pl, M_PriceList_Version plv, M_ProductPrice pp WHERE pp.M_Product_ID=T_InventoryValue.M_Product_ID AND pp.M_PriceList_Version_ID=T_InventoryValue.M_PriceList_Version_ID AND pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID)";
|
sqe = "UPDATE T_InventoryValue SET PricePO = (SELECT currencyConvert (po.PriceList,po.C_Currency_ID,T_InventoryValue.C_Currency_ID,T_InventoryValue.DateValue,null, po.AD_Client_ID,po.AD_Org_ID) FROM M_Product_PO po WHERE po.M_Product_ID=T_InventoryValue.M_Product_ID AND po.IsCurrentVendor='Y' LIMIT 1 ), PriceList = (SELECT currencyConvert(pp.PriceList,pl.C_Currency_ID,T_InventoryValue.C_Currency_ID,T_InventoryValue.DateValue,null, pl.AD_Client_ID,pl.AD_Org_ID) FROM M_PriceList pl, M_PriceList_Version plv, M_ProductPrice pp WHERE pp.M_Product_ID=T_InventoryValue.M_Product_ID AND pp.M_PriceList_Version_ID=T_InventoryValue.M_PriceList_Version_ID AND pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID), PriceStd = (SELECT currencyConvert(pp.PriceStd,pl.C_Currency_ID,T_InventoryValue.C_Currency_ID,T_InventoryValue.DateValue,null, pl.AD_Client_ID,pl.AD_Org_ID) FROM M_PriceList pl, M_PriceList_Version plv, M_ProductPrice pp WHERE pp.M_Product_ID=T_InventoryValue.M_Product_ID AND pp.M_PriceList_Version_ID=T_InventoryValue.M_PriceList_Version_ID AND pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID), PriceLimit = (SELECT currencyConvert(pp.PriceLimit,pl.C_Currency_ID,T_InventoryValue.C_Currency_ID,T_InventoryValue.DateValue,null, pl.AD_Client_ID,pl.AD_Org_ID) FROM M_PriceList pl, M_PriceList_Version plv, M_ProductPrice pp WHERE pp.M_Product_ID=T_InventoryValue.M_Product_ID AND pp.M_PriceList_Version_ID=T_InventoryValue.M_PriceList_Version_ID AND pp.M_PriceList_Version_ID=plv.M_PriceList_Version_ID AND plv.M_PriceList_ID=pl.M_PriceList_ID)";
|
||||||
r = DB.getDatabase().convertStatement(sql);
|
r = convert.convertOracleStatement(sql);
|
||||||
assertEquals(sqe, r);
|
assertEquals(sqe, r);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
@ -311,7 +311,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
|
||||||
//test alias and column list update
|
//test alias and column list update
|
||||||
sql = "UPDATE I_Order o SET (C_BPartner_ID,AD_User_ID)=(SELECT C_BPartner_ID,AD_User_ID FROM AD_User u WHERE o.ContactName=u.Name AND o.AD_Client_ID=u.AD_Client_ID AND u.C_BPartner_ID IS NOT NULL) WHERE C_BPartner_ID IS NULL AND ContactName IS NOT NULL AND EXISTS (SELECT Name FROM AD_User u WHERE o.ContactName=u.Name AND o.AD_Client_ID=u.AD_Client_ID AND u.C_BPartner_ID IS NOT NULL GROUP BY Name HAVING COUNT(*)=1) AND I_IsImported<>'Y' AND AD_Client_ID=11";
|
sql = "UPDATE I_Order o SET (C_BPartner_ID,AD_User_ID)=(SELECT C_BPartner_ID,AD_User_ID FROM AD_User u WHERE o.ContactName=u.Name AND o.AD_Client_ID=u.AD_Client_ID AND u.C_BPartner_ID IS NOT NULL) WHERE C_BPartner_ID IS NULL AND ContactName IS NOT NULL AND EXISTS (SELECT Name FROM AD_User u WHERE o.ContactName=u.Name AND o.AD_Client_ID=u.AD_Client_ID AND u.C_BPartner_ID IS NOT NULL GROUP BY Name HAVING COUNT(*)=1) AND I_IsImported<>'Y' AND AD_Client_ID=11";
|
||||||
sqe = "UPDATE I_Order SET C_BPartner_ID=u.C_BPartner_ID,AD_User_ID=u.AD_User_ID FROM AD_User u WHERE I_Order.ContactName=u.Name AND I_Order.AD_Client_ID=u.AD_Client_ID AND u.C_BPartner_ID IS NOT NULL AND I_Order.C_BPartner_ID IS NULL AND I_Order.ContactName IS NOT NULL AND EXISTS (SELECT Name FROM AD_User u WHERE I_Order.ContactName=u.Name AND I_Order.AD_Client_ID=u.AD_Client_ID AND u.C_BPartner_ID IS NOT NULL GROUP BY Name HAVING COUNT(*)=1) AND I_Order.I_IsImported<>'Y' AND I_Order.AD_Client_ID=11";
|
sqe = "UPDATE I_Order SET C_BPartner_ID=u.C_BPartner_ID,AD_User_ID=u.AD_User_ID FROM AD_User u WHERE I_Order.ContactName=u.Name AND I_Order.AD_Client_ID=u.AD_Client_ID AND u.C_BPartner_ID IS NOT NULL AND I_Order.C_BPartner_ID IS NULL AND I_Order.ContactName IS NOT NULL AND EXISTS (SELECT Name FROM AD_User u WHERE I_Order.ContactName=u.Name AND I_Order.AD_Client_ID=u.AD_Client_ID AND u.C_BPartner_ID IS NOT NULL GROUP BY Name HAVING COUNT(*)=1) AND I_Order.I_IsImported<>'Y' AND I_Order.AD_Client_ID=11";
|
||||||
r = DB.getDatabase().convertStatement(sql);
|
r = convert.convertOracleStatement(sql);
|
||||||
assertEquals(sqe, r);
|
assertEquals(sqe, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,7 +352,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
|
||||||
+ " Account_ID, PostingType, M_Product_ID, C_BPartner_ID,"
|
+ " Account_ID, PostingType, M_Product_ID, C_BPartner_ID,"
|
||||||
+ " C_Project_ID, AD_OrgTrx_ID, C_SalesRegion_ID, C_Activity_ID,"
|
+ " C_Project_ID, AD_OrgTrx_ID, C_SalesRegion_ID, C_Activity_ID,"
|
||||||
+ " C_Campaign_ID, C_LocTo_ID, C_LocFrom_ID, User1_ID, User2_ID, GL_Budget_ID";
|
+ " C_Campaign_ID, C_LocTo_ID, C_LocFrom_ID, User1_ID, User2_ID, GL_Budget_ID";
|
||||||
r = DB.getDatabase().convertStatement(sql);
|
r = convert.convertOracleStatement(sql);
|
||||||
assertEquals(sqe, r);
|
assertEquals(sqe, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,7 +361,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
|
||||||
//From bug [ 1576358 ] and [ 1577055 ]
|
//From bug [ 1576358 ] and [ 1577055 ]
|
||||||
sql = "SELECT TRUNC(TO_DATE('2006-10-13','YYYY-MM-DD'),'Q') FROM DUAL";
|
sql = "SELECT TRUNC(TO_DATE('2006-10-13','YYYY-MM-DD'),'Q') FROM DUAL";
|
||||||
sqe = "SELECT TRUNC(TO_TIMESTAMP('2006-10-13','YYYY-MM-DD'),'Q')";
|
sqe = "SELECT TRUNC(TO_TIMESTAMP('2006-10-13','YYYY-MM-DD'),'Q')";
|
||||||
r = DB.getDatabase().convertStatement(sql);
|
r = convert.convertOracleStatement(sql);
|
||||||
assertEquals(sqe, r);
|
assertEquals(sqe, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -380,7 +380,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
|
||||||
+ " FROM " + "AD_Column_Trl"
|
+ " FROM " + "AD_Column_Trl"
|
||||||
+ " WHERE AD_Language='" + "es_MX" + "')";
|
+ " WHERE AD_Language='" + "es_MX" + "')";
|
||||||
sqe = "INSERT INTO AD_Column_Trl(AD_Language,IsTranslated, AD_Client_ID,AD_Org_ID, Createdby,UpdatedBy, AD_Column_ID,Name) SELECT 'es_MX','N', AD_Client_ID,AD_Org_ID, 100,100, AD_Column_ID,Name FROM AD_Column WHERE AD_Column_ID NOT IN (SELECT AD_Column_ID FROM AD_Column_Trl WHERE AD_Language='es_MX')";
|
sqe = "INSERT INTO AD_Column_Trl(AD_Language,IsTranslated, AD_Client_ID,AD_Org_ID, Createdby,UpdatedBy, AD_Column_ID,Name) SELECT 'es_MX','N', AD_Client_ID,AD_Org_ID, 100,100, AD_Column_ID,Name FROM AD_Column WHERE AD_Column_ID NOT IN (SELECT AD_Column_ID FROM AD_Column_Trl WHERE AD_Language='es_MX')";
|
||||||
r = DB.getDatabase().convertStatement(sql);
|
r = convert.convertOracleStatement(sql);
|
||||||
assertEquals(sqe, r);
|
assertEquals(sqe, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -391,7 +391,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
|
||||||
+ "(SELECT * FROM M_InOutLine l WHERE l.M_InOutLine_ID=ma.M_InOutLine_ID"
|
+ "(SELECT * FROM M_InOutLine l WHERE l.M_InOutLine_ID=ma.M_InOutLine_ID"
|
||||||
+ " AND M_InOut_ID=0)";
|
+ " AND M_InOut_ID=0)";
|
||||||
sqe = "DELETE FROM M_InOutLineMA WHERE EXISTS (SELECT * FROM M_InOutLine l WHERE l.M_InOutLine_ID=M_InOutLineMA.M_InOutLine_ID AND M_InOut_ID=0)";
|
sqe = "DELETE FROM M_InOutLineMA WHERE EXISTS (SELECT * FROM M_InOutLine l WHERE l.M_InOutLine_ID=M_InOutLineMA.M_InOutLine_ID AND M_InOut_ID=0)";
|
||||||
r = DB.getDatabase().convertStatement(sql);
|
r = convert.convertOracleStatement(sql);
|
||||||
assertEquals(sqe, r);
|
assertEquals(sqe, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -402,7 +402,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
|
||||||
+ " SET (TotalDr, TotalCr) = (SELECT COALESCE(SUM(TotalDr),0), COALESCE(SUM(TotalCr),0)"
|
+ " SET (TotalDr, TotalCr) = (SELECT COALESCE(SUM(TotalDr),0), COALESCE(SUM(TotalCr),0)"
|
||||||
+ " FROM GL_Journal j WHERE j.IsActive='Y' AND jb.GL_JournalBatch_ID=j.GL_JournalBatch_ID) "
|
+ " FROM GL_Journal j WHERE j.IsActive='Y' AND jb.GL_JournalBatch_ID=j.GL_JournalBatch_ID) "
|
||||||
+ "WHERE GL_JournalBatch_ID=0";
|
+ "WHERE GL_JournalBatch_ID=0";
|
||||||
r = DB.getDatabase().convertStatement(sql);
|
r = convert.convertOracleStatement(sql);
|
||||||
sqe = "UPDATE GL_JournalBatch SET TotalDr="
|
sqe = "UPDATE GL_JournalBatch SET TotalDr="
|
||||||
+ "( SELECT COALESCE(SUM(TotalDr),0) "
|
+ "( SELECT COALESCE(SUM(TotalDr),0) "
|
||||||
+ "FROM GL_Journal j WHERE j.IsActive='Y' AND "
|
+ "FROM GL_Journal j WHERE j.IsActive='Y' AND "
|
||||||
|
@ -418,12 +418,12 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
|
||||||
public void test1727193() {
|
public void test1727193() {
|
||||||
sql = "UPDATE a set a.ten_decode = 'b'";
|
sql = "UPDATE a set a.ten_decode = 'b'";
|
||||||
sqe = "UPDATE a set a.ten_decode = 'b'";
|
sqe = "UPDATE a set a.ten_decode = 'b'";
|
||||||
r = DB.getDatabase().convertStatement(sql);
|
r = convert.convertOracleStatement(sql);
|
||||||
assertEquals(sqe, r);
|
assertEquals(sqe, r);
|
||||||
|
|
||||||
sql = "UPDATE a set a.b = 'ten_decode'";
|
sql = "UPDATE a set a.b = 'ten_decode'";
|
||||||
sqe = "UPDATE a set a.b = 'ten_decode'";
|
sqe = "UPDATE a set a.b = 'ten_decode'";
|
||||||
r = DB.getDatabase().convertStatement(sql);
|
r = convert.convertOracleStatement(sql);
|
||||||
assertEquals(sqe, r);
|
assertEquals(sqe, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -431,7 +431,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
|
||||||
public void testDecode() {
|
public void testDecode() {
|
||||||
sql = "SELECT supplier_name, decode(supplier_id, 10000, 'IBM', 10001, 'Microsoft', 10002, 'Hewlett Packard', 'Gateway') FROM suppliers";
|
sql = "SELECT supplier_name, decode(supplier_id, 10000, 'IBM', 10001, 'Microsoft', 10002, 'Hewlett Packard', 'Gateway') FROM suppliers";
|
||||||
sqe = "SELECT supplier_name, CASE WHEN supplier_id=10000 THEN 'IBM' WHEN supplier_id=10001 THEN 'Microsoft' WHEN supplier_id=10002 THEN 'Hewlett Packard' ELSE 'Gateway' END FROM suppliers";
|
sqe = "SELECT supplier_name, CASE WHEN supplier_id=10000 THEN 'IBM' WHEN supplier_id=10001 THEN 'Microsoft' WHEN supplier_id=10002 THEN 'Hewlett Packard' ELSE 'Gateway' END FROM suppliers";
|
||||||
r = DB.getDatabase().convertStatement(sql);
|
r = convert.convertOracleStatement(sql);
|
||||||
assertEquals(sqe, r);
|
assertEquals(sqe, r);
|
||||||
|
|
||||||
//doc_matchinv update average cost, bug [ 1742835 ]
|
//doc_matchinv update average cost, bug [ 1742835 ]
|
||||||
|
@ -443,7 +443,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
|
||||||
+ "SET CostAverage = CostAverageCumAmt/CASE WHEN CostAverageCumQty=0 THEN 1 ELSE CostAverageCumQty END "
|
+ "SET CostAverage = CostAverageCumAmt/CASE WHEN CostAverageCumQty=0 THEN 1 ELSE CostAverageCumQty END "
|
||||||
+ "WHERE C_AcctSchema_ID=0"
|
+ "WHERE C_AcctSchema_ID=0"
|
||||||
+ " AND M_Product_ID=0";
|
+ " AND M_Product_ID=0";
|
||||||
r = DB.getDatabase().convertStatement(sql);
|
r = convert.convertOracleStatement(sql);
|
||||||
assertEquals(sqe, r);
|
assertEquals(sqe, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -451,12 +451,12 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
|
||||||
public void test2371805_GetDate() {
|
public void test2371805_GetDate() {
|
||||||
sql = "SELECT getdate() FROM DUAL";
|
sql = "SELECT getdate() FROM DUAL";
|
||||||
sqe = "SELECT statement_timestamp()";
|
sqe = "SELECT statement_timestamp()";
|
||||||
r = DB.getDatabase().convertStatement(sql);
|
r = convert.convertOracleStatement(sql);
|
||||||
assertEquals(sqe, r);
|
assertEquals(sqe, r);
|
||||||
|
|
||||||
sql = "SELECT SYSDATE FROM DUAL";
|
sql = "SELECT SYSDATE FROM DUAL";
|
||||||
sqe = "SELECT statement_timestamp()";
|
sqe = "SELECT statement_timestamp()";
|
||||||
r = DB.getDatabase().convertStatement(sql);
|
r = convert.convertOracleStatement(sql);
|
||||||
assertEquals(sqe, r);
|
assertEquals(sqe, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -490,7 +490,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
|
||||||
sql.append(sql_end);
|
sql.append(sql_end);
|
||||||
sqle.append(sql_end);
|
sqle.append(sql_end);
|
||||||
//
|
//
|
||||||
r = DB.getDatabase().convertStatement(sql.toString());
|
r = convert.convertOracleStatement(sql.toString());
|
||||||
assertEquals(sqle.toString(), r);
|
assertEquals(sqle.toString(), r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -501,7 +501,7 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
|
||||||
public void test2521586() {
|
public void test2521586() {
|
||||||
sql = "INSERT INTO M_Forecast (M_Forecast_ID) VALUES (1000000)";
|
sql = "INSERT INTO M_Forecast (M_Forecast_ID) VALUES (1000000)";
|
||||||
sqe = "INSERT INTO M_Forecast (M_Forecast_ID) VALUES (1000000)";
|
sqe = "INSERT INTO M_Forecast (M_Forecast_ID) VALUES (1000000)";
|
||||||
r = DB.getDatabase().convertStatement(sql);
|
r = convert.convertOracleStatement(sql);
|
||||||
assertEquals(sqe, r);
|
assertEquals(sqe, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -514,13 +514,13 @@ public final class Convert_PostgreSQLTest extends AbstractTestCase {
|
||||||
{
|
{
|
||||||
sql = "INSERT INTO MyTable (a, b, c, d, xml) VALUES ('val1', 'val2', 'this ''is'' a string with ''quotes'' and backslashes ''\\''', 'val4')";
|
sql = "INSERT INTO MyTable (a, b, c, d, xml) VALUES ('val1', 'val2', 'this ''is'' a string with ''quotes'' and backslashes ''\\''', 'val4')";
|
||||||
sqe = "INSERT INTO MyTable (a, b, c, d, xml) VALUES ('val1', 'val2', E'this ''is'' a string with ''quotes'' and backslashes ''\\\\''', 'val4')";
|
sqe = "INSERT INTO MyTable (a, b, c, d, xml) VALUES ('val1', 'val2', E'this ''is'' a string with ''quotes'' and backslashes ''\\\\''', 'val4')";
|
||||||
r = DB.getDatabase().convertStatement(sql);
|
r = convert.convertOracleStatement(sql);
|
||||||
assertEquals(sqe, r);
|
assertEquals(sqe, r);
|
||||||
|
|
||||||
sql = "SELECT AD_Tab.AD_Tab_ID,NULL,COALESCE(AD_Tab.Name,'-1') ||'_'|| COALESCE((SELECT COALESCE(AD_Window.Name,'') FROM AD_Window WHERE AD_Tab.AD_Window_ID=AD_Window.AD_Window_ID),'-1'),AD_Tab.IsActive"
|
sql = "SELECT AD_Tab.AD_Tab_ID,NULL,COALESCE(AD_Tab.Name,'-1') ||'_'|| COALESCE((SELECT COALESCE(AD_Window.Name,'') FROM AD_Window WHERE AD_Tab.AD_Window_ID=AD_Window.AD_Window_ID),'-1'),AD_Tab.IsActive"
|
||||||
+" FROM AD_Tab WHERE AD_Tab.AD_Tab_ID=?";
|
+" FROM AD_Tab WHERE AD_Tab.AD_Tab_ID=?";
|
||||||
sqe = sql;
|
sqe = sql;
|
||||||
r = DB.getDatabase().convertStatement(sql);
|
r = convert.convertOracleStatement(sql);
|
||||||
assertEquals(sqe, r);
|
assertEquals(sqe, r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue