|
Compiere 3.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.compiere.sqlj.Compiere
public class Compiere
SQLJ Compiere Control and Utility Class
| Field Summary | |
|---|---|
static BigDecimal |
HUNDRED
Hundred 100 |
static BigDecimal |
ONE
One 1 |
protected static String |
s_pwd
Connection Password |
static String |
s_type
Server Type |
protected static String |
s_uid
Connection User |
protected static String |
s_url
Connection URL |
static String |
TRUNC_DAY
Truncate Day - D |
static String |
TRUNC_MONTH
Truncate Month - MM |
static String |
TRUNC_QUARTER
Truncate Quarter - Q |
static String |
TRUNC_WEEK
Truncate Week - W |
static String |
TRUNC_YEAR
Truncate Year - Y |
static String |
TYPE_DB2
DB2 Server |
static String |
TYPE_ORACLE
Oracle Server |
static BigDecimal |
ZERO
Zero 0 |
| Constructor Summary | |
|---|---|
Compiere()
|
|
| Method Summary | |
|---|---|
static Timestamp |
addDays(Timestamp day,
int offset)
Return Day + offset (truncates) |
static String |
charAt(String source,
int posIndex)
Character At Position |
static Timestamp |
firstOf(Timestamp p_dateTime,
String XX)
Fist of Date |
static String |
getChars(BigDecimal d)
To Characters |
static Timestamp |
getDate()
Mext ID |
static int |
getDaysBetween(Timestamp start,
Timestamp end)
Calculate the number of days between start and end. |
static String |
getProperties()
Get Environment Info |
static String |
getProperty(String key)
Get Environment Info |
static String |
getServerType()
Get Server Type |
static String |
getVersion()
Get Version |
static Timestamp |
nextBusinessDay(Timestamp day)
Next Business Day. |
static String |
Time2Chars(Timestamp t)
get chars from a number |
protected static Timestamp |
trunc(Timestamp t)
Truncate Date |
static Timestamp |
trunc(Timestamp dayTime,
String trunc)
Get truncated day/time |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String TYPE_ORACLE
public static final String TYPE_DB2
public static String s_type
protected static String s_url
protected static String s_uid
protected static String s_pwd
public static final BigDecimal ZERO
public static final BigDecimal ONE
public static final BigDecimal HUNDRED
public static final String TRUNC_DAY
public static final String TRUNC_WEEK
public static final String TRUNC_MONTH
public static final String TRUNC_QUARTER
public static final String TRUNC_YEAR
| Constructor Detail |
|---|
public Compiere()
| Method Detail |
|---|
public static String getVersion()
public static String getProperties()
public static String getProperty(String key)
throws SQLException
key - key
SQLExceptionpublic static String getServerType()
public static Timestamp trunc(Timestamp dayTime,
String trunc)
dayTime - daytrunc - how to truncate TRUNC_*
protected static Timestamp trunc(Timestamp t)
t - time
public static Timestamp firstOf(Timestamp p_dateTime,
String XX)
p_dateTime - dateXX - date part - Supported: DD(default),DY,MM,Q
public static int getDaysBetween(Timestamp start,
Timestamp end)
start - start dateend - end date
public static Timestamp addDays(Timestamp day,
int offset)
day - Dayoffset - day offset
public static Timestamp nextBusinessDay(Timestamp day)
day - day
public static String charAt(String source,
int posIndex)
source - sourceposIndex - position 1 = first
public static Timestamp getDate()
AD_Sequence_ID - sequenceSystem - system
SQLException - public static int nextID (int AD_Sequence_ID, String System)
throws SQLException
{
boolean isSystem = System != null && "Y".equals(System);
int retValue = -1;
StringBuffer sql = new StringBuffer ("SELECT CurrentNext");
if (isSystem)
sql.append("Sys");
sql.append(",IncrementNo FROM AD_Sequence WHERE AD_Sequence_ID=? FOR UPDATE");
PreparedStatement pstmt = prepareStatement(sql.toString(),
ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
ResultSet rs = pstmt.executeQuery();
if (rs.next())
{
retValue = rs.getInt(1);
int incrementNo = rs.getInt(2);
//jz
retValue += incrementNo;
rs.updateInt(2, retValue);
//pstmt.getConnection().commit();
}
rs.close();
pstmt.close();
//
return retValue;
} // nextID
/*
ProcNextID is a procedure version of nextID
Since Derby could not tell diff of signatures, use ProcNextID
public static void ProcNextID (int AD_Sequence_ID, String System, int[] retVal)
throws SQLException
{
retVal[0] = nextID(AD_Sequence_ID, System);
}
/**
Get current Date (Timestamp)public static String getChars(BigDecimal d)
d - double
public static String Time2Chars(Timestamp t)
d - double
|
Compiere 3.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||