Qualified column names in ORDER BY. Thank's to Felix.

This commit is contained in:
trifonnt 2009-09-24 15:13:28 +00:00
parent 9c243122b6
commit f9e57a6412
7 changed files with 11 additions and 11 deletions

View File

@ -155,7 +155,7 @@ public class MAdvertisement extends X_W_Advertisement
if (m_SalesRep_ID == 0)
m_SalesRep_ID = DB.getSQLValue(null,
"SELECT AD_User_ID FROM AD_User "
+ "WHERE C_BPartner_ID=? AND IsActive='Y' ORDER BY 1", getC_BPartner_ID());
+ "WHERE C_BPartner_ID=? AND IsActive='Y' ORDER BY AD_User_ID", getC_BPartner_ID());
}
return m_SalesRep_ID;
} // getSalesRep_ID

View File

@ -330,7 +330,7 @@ public class MLanguage extends X_AD_Language
*/
public int maintain (boolean add)
{
String sql = "SELECT TableName FROM AD_Table WHERE TableName LIKE '%_Trl' ORDER BY 1";
String sql = "SELECT TableName FROM AD_Table WHERE TableName LIKE '%_Trl' ORDER BY TableName";
PreparedStatement pstmt = null;
ResultSet rs = null;
int retNo = 0;
@ -384,7 +384,7 @@ public class MLanguage extends X_AD_Language
+ " INNER JOIN AD_Table t ON (c.AD_Table_ID=t.AD_Table_ID) "
+ "WHERE t.TableName=?"
+ " AND c.IsTranslated='Y' AND c.IsActive='Y' "
+ "ORDER BY 1";
+ "ORDER BY c.ColumnName";
ArrayList<String> columns = new ArrayList<String>(5);
PreparedStatement pstmt = null;
ResultSet rs = null;

View File

@ -72,11 +72,11 @@ public class MRoleTest extends TestCase
// add test code here
String sql = m_role.addAccessSQL(
"SELECT r.a,r.b,r.c FROM AD_Role r WHERE EXISTS "
+ "(SELECT AD_Column c WHERE c.a=c.b) ORDER BY 1",
+ "(SELECT AD_Column c WHERE c.a=c.b) ORDER BY r.a",
"r",
MRole.SQL_FULLYQUALIFIED, MRole.SQL_RO);
System.out.println(sql);
assertEquals(sql, "SELECT r.a,r.b,r.c FROM AD_Role r WHERE EXISTS (SELECT AD_Column c WHERE c.a=c.b) AND r.AD_Client_ID=0 AND r.AD_Org_ID=0 ORDER BY 1");
assertEquals(sql, "SELECT r.a,r.b,r.c FROM AD_Role r WHERE EXISTS (SELECT AD_Column c WHERE c.a=c.b) AND r.AD_Client_ID=0 AND r.AD_Org_ID=0 ORDER BY r.a");
}

View File

@ -3233,7 +3233,7 @@ public abstract class PO
s_acctColumns = new ArrayList<String>();
String sql = "SELECT c.ColumnName "
+ "FROM AD_Column c INNER JOIN AD_Table t ON (c.AD_Table_ID=t.AD_Table_ID) "
+ "WHERE t.TableName=? AND c.IsActive='Y' AND c.AD_Reference_ID=25 ORDER BY 1";
+ "WHERE t.TableName=? AND c.IsActive='Y' AND c.AD_Reference_ID=25 ORDER BY c.ColumnName";
PreparedStatement pstmt = null;
ResultSet rs = null;
try

View File

@ -177,7 +177,7 @@ public class PO_Record
*/
static void validate ()
{
String sql = "SELECT AD_Table_ID, TableName FROM AD_Table WHERE IsView='N' ORDER BY 2";
String sql = "SELECT AD_Table_ID, TableName FROM AD_Table WHERE IsView='N' ORDER BY TableName";
PreparedStatement pstmt = null;
ResultSet rs = null;
try

View File

@ -108,7 +108,7 @@ public class PrintFormatUtil
+ " AND pfi.AD_Column_ID=c.AD_Column_ID"
+ " AND pfi.AD_PrintFormat_ID=?)" // 1
+ " AND c.AD_Table_ID=? " // 2
+ "ORDER BY 1";
+ "ORDER BY c.AD_Column_ID";
PreparedStatement pstmt = null;
ResultSet rs = null;
int counter = 0;

View File

@ -136,7 +136,7 @@ public class TranslationDialog extends CPanel
String sql = "SELECT Name, AD_Client_ID "
+ "FROM AD_Client "
+ "WHERE IsActive='Y' "
+ "ORDER BY 2";
+ "ORDER BY AD_Client_ID";
try
{
PreparedStatement pstmt = DB.prepareStatement(sql, null);
@ -158,7 +158,7 @@ public class TranslationDialog extends CPanel
sql = "SELECT Name, AD_Language "
+ "FROM AD_Language "
+ "WHERE IsActive='Y' AND (IsSystemLanguage='Y' OR IsBaseLanguage='Y')"
+ "ORDER BY 1";
+ "ORDER BY Name";
try
{
PreparedStatement pstmt = DB.prepareStatement(sql, null);
@ -181,7 +181,7 @@ public class TranslationDialog extends CPanel
sql = "SELECT Name, TableName "
+ "FROM AD_Table "
+ "WHERE TableName LIKE '%_Trl' AND TableName<>'AD_Column_Trl' "
+ "ORDER BY 1";
+ "ORDER BY Name";
try
{
PreparedStatement pstmt = DB.prepareStatement(sql, null);