refactoring - uppercase reserved word UPDATE DELETE

This commit is contained in:
Carlos Ruiz 2009-11-05 14:57:49 +00:00
parent e2a839bcfa
commit ad7a0a1ad8
17 changed files with 49 additions and 49 deletions

View File

@ -146,7 +146,7 @@ public class CommonTranslationHandler extends AbstractElementHandler implements
ArrayList<String> pipoColumns = getExportableColumns(parentTable); ArrayList<String> pipoColumns = getExportableColumns(parentTable);
StringBuffer sqlBuf = new StringBuffer("update "+parentTable+"_trl set "); StringBuffer sqlBuf = new StringBuffer("UPDATE "+parentTable+"_trl SET ");
for (String columnName : pipoColumns) { for (String columnName : pipoColumns) {
@ -156,8 +156,8 @@ public class CommonTranslationHandler extends AbstractElementHandler implements
String sql = sqlBuf.substring(0, sqlBuf.length()-1); String sql = sqlBuf.substring(0, sqlBuf.length()-1);
sql += " where ad_language = '"+atts.getValue("AD_Language")+ sql += " WHERE ad_language = '"+atts.getValue("AD_Language")+
"' and "+parentTable+"_ID="+parentID; "' AND "+parentTable+"_ID="+parentID;
try { try {
PreparedStatement pstm = DB.prepareStatement(sql, PreparedStatement pstm = DB.prepareStatement(sql,

View File

@ -74,7 +74,7 @@ public class ApplyMigrationScripts extends SvrProcess {
+ e.getMessage()); + e.getMessage());
log.severe(e.getMessage()); log.severe(e.getMessage());
} finally { } finally {
sql = "update ad_migrationscript set status = ? , isApply = 'N' where ad_migrationscript_id = ? "; sql = "UPDATE ad_migrationscript SET status = ? , isApply = 'N' WHERE ad_migrationscript_id = ? ";
pstmt = DB.prepareStatement(sql, this.get_TrxName()); pstmt = DB.prepareStatement(sql, this.get_TrxName());
if (execOk) { if (execOk) {
pstmt.setString(1, "CO"); pstmt.setString(1, "CO");

View File

@ -219,7 +219,7 @@ public class PrepareMigrationScripts extends SvrProcess {
msg = msg + "Script " + fileName.get(i) + " failed!"; msg = msg + "Script " + fileName.get(i) + " failed!";
continue; continue;
} }
sql = "update AD_MigrationScript set script = ? where AD_MigrationScript_ID = ?"; sql = "UPDATE AD_MigrationScript SET script = ? WHERE AD_MigrationScript_ID = ?";
pstmt = DB.prepareStatement(sql, this.get_TrxName()); pstmt = DB.prepareStatement(sql, this.get_TrxName());
pstmt.setBytes(1, body.toString().getBytes()); pstmt.setBytes(1, body.toString().getBytes());
pstmt.setInt(2, seqID); pstmt.setInt(2, seqID);
@ -232,7 +232,7 @@ public class PrepareMigrationScripts extends SvrProcess {
msg = msg + "Script Body " + fileName.get(i) + " failed!"; msg = msg + "Script Body " + fileName.get(i) + " failed!";
pstmt = DB pstmt = DB
.prepareStatement( .prepareStatement(
"delete from ad_migrationscript WHERE ad_migrationscript_id = ?", "DELETE FROM ad_migrationscript WHERE ad_migrationscript_id = ?",
this.get_TrxName()); this.get_TrxName());
pstmt.setInt(1, seqID); pstmt.setInt(1, seqID);
result = pstmt.executeUpdate(); result = pstmt.executeUpdate();

View File

@ -388,13 +388,13 @@ public final class Convert_PostgreSQLTest extends TestCase{
//[ 1727193 ] Convert failed with decode in quoted string //[ 1727193 ] Convert failed with decode in quoted string
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 = convert.convert(sql); r = convert.convert(sql);
assertEquals(sqe, r[0]); assertEquals(sqe, r[0]);
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 = convert.convert(sql); r = convert.convert(sql);
assertEquals(sqe, r[0]); assertEquals(sqe, r[0]);
} }

View File

@ -46,8 +46,8 @@ public class RefListElement {
} }
public String getUpdateString() { public String getUpdateString() {
return "update AD_Ref_List set value='" + value + "', name='" + name + "'" return "UPDATE AD_Ref_List SET value='" + value + "', name='" + name + "'"
+ " where AD_Ref_List_ID=" + id + ";"; + " WHERE AD_Ref_List_ID=" + id + ";";
} }
public String getInsertString() { public String getInsertString() {

View File

@ -113,7 +113,7 @@ public class ClientManager
protected static void updateAccountingProcessor(Properties ctx, protected static void updateAccountingProcessor(Properties ctx,
int adClientId, String trxName) throws OperationException int adClientId, String trxName) throws OperationException
{ {
String updStmt = "Update C_AcctProcessor set FrequencyType='M' where AD_Client_ID=" String updStmt = "UPDATE C_AcctProcessor set FrequencyType='M' where AD_Client_ID="
+ adClientId; + adClientId;
int updates = DB.executeUpdate(updStmt, trxName); int updates = DB.executeUpdate(updStmt, trxName);

View File

@ -923,15 +923,15 @@ public class InvoiceManager extends AbstractDocumentManager
PreparedStatement pstmt1 = null; PreparedStatement pstmt1 = null;
PreparedStatement pstmt2 = null; PreparedStatement pstmt2 = null;
String sql = "update C_Invoice set DOCSTATUS=" + "'" String sql = "UPDATE C_Invoice SET DOCSTATUS=" + "'"
+ DocumentEngine.STATUS_Voided + "'" + DocumentEngine.STATUS_Voided + "'"
+ " where AD_CLIENT_ID=" + Env.getAD_Client_ID(ctx) + " WHERE AD_CLIENT_ID=" + Env.getAD_Client_ID(ctx)
+ " and C_INVOICE_ID=" + invoice.get_ID(); + " AND C_INVOICE_ID=" + invoice.get_ID();
String sql2 = "update C_Invoice set DOCACTION=" + "'" String sql2 = "UPDATE C_Invoice SET DOCACTION=" + "'"
+ DocumentEngine.ACTION_None + "'" + DocumentEngine.ACTION_None + "'"
+ " where AD_CLIENT_ID=" + Env.getAD_Client_ID(ctx) + " WHERE AD_CLIENT_ID=" + Env.getAD_Client_ID(ctx)
+ " and C_INVOICE_ID=" + invoice.get_ID(); + " AND C_INVOICE_ID=" + invoice.get_ID();
pstmt1 = DB.prepareStatement(sql,invoice.get_TrxName()); pstmt1 = DB.prepareStatement(sql,invoice.get_TrxName());
pstmt2 = DB.prepareStatement(sql2,invoice.get_TrxName()); pstmt2 = DB.prepareStatement(sql2,invoice.get_TrxName());

View File

@ -722,15 +722,15 @@ public class MinOutManager extends AbstractDocumentManager
PreparedStatement pstmt1 = null; PreparedStatement pstmt1 = null;
PreparedStatement pstmt2 = null; PreparedStatement pstmt2 = null;
String sql = "update M_INOUT set DOCSTATUS=" + "'" String sql = "UPDATE M_INOUT SET DOCSTATUS=" + "'"
+ DocumentEngine.STATUS_Voided + "'" + DocumentEngine.STATUS_Voided + "'"
+ " where AD_CLIENT_ID=" + Env.getAD_Client_ID(ctx) + " WHERE AD_CLIENT_ID=" + Env.getAD_Client_ID(ctx)
+ " and M_INOUT_ID=" + inout.get_ID(); + " AND M_INOUT_ID=" + inout.get_ID();
String sql2 = "update M_INOUT set DOCACTION=" + "'" String sql2 = "UPDATE M_INOUT SET DOCACTION=" + "'"
+ DocumentEngine.ACTION_None + "'" + DocumentEngine.ACTION_None + "'"
+ " where AD_CLIENT_ID=" + Env.getAD_Client_ID(ctx) + " WHERE AD_CLIENT_ID=" + Env.getAD_Client_ID(ctx)
+ " and M_INOUT_ID=" + inout.get_ID(); + " AND M_INOUT_ID=" + inout.get_ID();
pstmt1 = DB.prepareStatement(sql,null); pstmt1 = DB.prepareStatement(sql,null);
pstmt2 = DB.prepareStatement(sql2,null); pstmt2 = DB.prepareStatement(sql2,null);

View File

@ -381,7 +381,7 @@ public class OrderManager
throw new OperationException("Cannot delete order that is already processed"); throw new OperationException("Cannot delete order that is already processed");
} }
String sql = "delete from C_ORDERLINE where C_ORDER_ID = " + order.get_ID(); String sql = "DELETE FROM C_ORDERLINE WHERE C_ORDER_ID = " + order.get_ID();
int no = DB.executeUpdate(sql, trxName); int no = DB.executeUpdate(sql, trxName);

View File

@ -927,7 +927,7 @@ public class POSManager
for(int i=0;i<orderlineIds.length;i++) for(int i=0;i<orderlineIds.length;i++)
{ {
String sql="delete from c_orderline where c_orderline_id="+orderlineIds[i].intValue(); String sql="DELETE FROM c_orderline WHERE c_orderline_id="+orderlineIds[i].intValue();
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
try try

View File

@ -89,7 +89,7 @@ public class PartialPOSManager extends POSManager
for(int i=0;i<orderlineIds.length;i++) for(int i=0;i<orderlineIds.length;i++)
{ {
String sql="delete from c_orderline where c_orderline_id="+orderlineIds[i].intValue(); String sql="DELETE FROM c_orderline WHERE c_orderline_id="+orderlineIds[i].intValue();
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
try try

View File

@ -202,8 +202,8 @@ public class DunningManager
public static void associateAllBpartnerWithDunning(Properties ctx) throws OperationException public static void associateAllBpartnerWithDunning(Properties ctx) throws OperationException
{ {
String sql = "update c_Bpartner set C_DUNNING_ID="+getOrCreateDunning(ctx)+ String sql = "UPDATE c_Bpartner SET C_DUNNING_ID="+getOrCreateDunning(ctx)+
" where AD_CLIENT_ID="+Env.getAD_Client_ID(ctx); " WHERE AD_CLIENT_ID="+Env.getAD_Client_ID(ctx);
int no = DB.executeUpdate(sql, null); int no = DB.executeUpdate(sql, null);

View File

@ -271,7 +271,7 @@ public class PriceListManager
BigDecimal priceStd = newPrice; BigDecimal priceStd = newPrice;
BigDecimal priceLimit = newPrice; BigDecimal priceLimit = newPrice;
String updateSql = "Update M_PRODUCTPRICE set" + String updateSql = "UPDATE M_PRODUCTPRICE set" +
" UPDATED = sysdate" + " UPDATED = sysdate" +
", UPDATEDBY = " + ad_user_id + ", UPDATEDBY = " + ad_user_id +
", PRICELIST = " + priceList + ", PRICELIST = " + priceList +

View File

@ -680,11 +680,11 @@ public class RoleManager
{ {
StringBuffer strBuff = new StringBuffer(); StringBuffer strBuff = new StringBuffer();
strBuff.append("update ").append(MRoleOrgAccess.Table_Name); strBuff.append("UPDATE ").append(MRoleOrgAccess.Table_Name);
strBuff.append(" set isActive='").append(isChecked).append("'"); strBuff.append(" SET isActive='").append(isChecked).append("'");
strBuff.append(" where ad_client_id=").append(Env.getAD_Client_ID(ctx)); strBuff.append(" WHERE ad_client_id=").append(Env.getAD_Client_ID(ctx));
strBuff.append(" and ad_org_id=").append(bean.getOrgId()); strBuff.append(" AND ad_org_id=").append(bean.getOrgId());
strBuff.append(" and ad_role_id=").append(bean.getRoleId()); strBuff.append(" AND ad_role_id=").append(bean.getRoleId());
PreparedStatement pstmt1 = DB.prepareStatement(strBuff.toString(), trxName); PreparedStatement pstmt1 = DB.prepareStatement(strBuff.toString(), trxName);

View File

@ -398,9 +398,9 @@ public class InventoryCartManager
public static void deleteInventoryLine(Properties ctx,int inventoryId,int M_INVENTORYLINE_ID) public static void deleteInventoryLine(Properties ctx,int inventoryId,int M_INVENTORYLINE_ID)
{ {
String sql="delete from M_INVENTORYLine where M_INVENTORYLINE_ID="+M_INVENTORYLINE_ID+ String sql="DELETE FROM M_INVENTORYLine WHERE M_INVENTORYLINE_ID="+M_INVENTORYLINE_ID+
" and M_INVENTORY_ID="+inventoryId+ " AND M_INVENTORY_ID="+inventoryId+
" and AD_CLIENT_ID="+Env.getAD_Client_ID(ctx); " AND AD_CLIENT_ID="+Env.getAD_Client_ID(ctx);
DB.executeUpdate(sql,null); DB.executeUpdate(sql,null);
@ -408,9 +408,9 @@ public class InventoryCartManager
public static void deleteInventoryLines(Properties ctx,int inventoryId) public static void deleteInventoryLines(Properties ctx,int inventoryId)
{ {
String sql="delete from M_INVENTORYLine where " + String sql="DELETE FROM M_INVENTORYLine WHERE " +
" M_INVENTORY_ID="+inventoryId+ " M_INVENTORY_ID="+inventoryId+
" and AD_CLIENT_ID="+Env.getAD_Client_ID(ctx); " AND AD_CLIENT_ID="+Env.getAD_Client_ID(ctx);
DB.executeUpdate(sql,null); DB.executeUpdate(sql,null);

View File

@ -426,9 +426,9 @@ public class InventoryManager
private static void updateCountQty(Properties ctx,int inventoryID) private static void updateCountQty(Properties ctx,int inventoryID)
{ {
String sql = "update M_INVENTORYLINE set QTYCOUNT=1 where M_INVENTORYLINE_ID="+ String sql = "UPDATE M_INVENTORYLINE SET QTYCOUNT=1 WHERE M_INVENTORYLINE_ID="+
"(select max(M_INVENTORYLINE_ID) from M_INVENTORYLINE where AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+ "(SELECT MAX(M_INVENTORYLINE_ID) FROM M_INVENTORYLINE WHERE AD_CLIENT_ID="+Env.getAD_Client_ID(ctx)+
" and M_INVENTORY_ID="+inventoryID+")"; " AND M_INVENTORY_ID="+inventoryID+")";
DB.executeUpdate(sql, null); DB.executeUpdate(sql, null);
} }
@ -482,9 +482,9 @@ public class InventoryManager
public static void deleteInventoryLine(Properties ctx,int inventoryId,int M_INVENTORYLINE_ID) public static void deleteInventoryLine(Properties ctx,int inventoryId,int M_INVENTORYLINE_ID)
{ {
String sql="delete from M_INVENTORYLine where M_INVENTORYLINE_ID="+M_INVENTORYLINE_ID+ String sql="DELETE FROM M_INVENTORYLine WHERE M_INVENTORYLINE_ID="+M_INVENTORYLINE_ID+
" and M_INVENTORY_ID="+inventoryId+ " AND M_INVENTORY_ID="+inventoryId+
" and AD_CLIENT_ID="+Env.getAD_Client_ID(ctx); " AND AD_CLIENT_ID="+Env.getAD_Client_ID(ctx);
DB.executeUpdate(sql,null); DB.executeUpdate(sql,null);

View File

@ -1224,9 +1224,9 @@ public class MMovementManager
*/ */
public static void deleteMovementLines(Properties ctx,int movementId) public static void deleteMovementLines(Properties ctx,int movementId)
{ {
String sql="delete from M_MovementLine where " + String sql="DELETE FROM M_MovementLine WHERE " +
" M_Movement_Id="+movementId+ " M_Movement_Id="+movementId+
" and AD_CLIENT_ID="+Env.getAD_Client_ID(ctx); " AND AD_CLIENT_ID="+Env.getAD_Client_ID(ctx);
DB.executeUpdate(sql,null); DB.executeUpdate(sql,null);