public void setStatementFromAddress(CCallableStatement ccstmt,
CAddressStruct address, int nStartFrom) throws SQLException
{
nStartFrom = nStartFrom - 12;
ccstmt.setString(nStartFrom + 0, address.getStreet());
ccstmt.setLong(nStartFrom + 1, address.getCityID());
ccstmt.setString(nStartFrom + 2, address.getCity());
ccstmt.setLong(nStartFrom + 3, address.getCountyID());
ccstmt.setString(nStartFrom + 4, address.getCounty());
ccstmt.setString(nStartFrom + 5, address.getRegionID());
ccstmt.setString(nStartFrom + 6, address.getRegion());
ccstmt.setLong(nStartFrom + 7, address.getCountryID());
ccstmt.setString(nStartFrom + 8, address.getCountry());
ccstmt.setString(nStartFrom + 9, address.getZIP());
ccstmt.setString(nStartFrom + 10, address.getPhone());
ccstmt.setString(nStartFrom + 11, address.getFax());
ccstmt.setString(nStartFrom + 12, address.getEMail());
}
среда, 1 апреля 2009 г.
nStartFrom - 12
Quite a fun usage of variable nStartFrom:
пятница, 20 марта 2009 г.
Ugly condition
I have found a method for validating date:
After a short thinking, this condition can be simplified to:
// check that it is valid format
// d,m,y
// m,y
// y
if ((nYearFrom != null && nMonthFrom != null && nDayFrom != null ||
nYearFrom != null && nMonthFrom != null ||
nYearFrom != null) &&
(nYearTo != null && nMonthTo != null && nDayTo != null ||
nYearTo != null && nMonthTo != null ||
nYearTo != null))
After a short thinking, this condition can be simplified to:
if (nYearFrom != null && nYearTo != null)
File.separatorChar
I have just found a funny snippet in Java code:
Actualy class java.io.File has two constants:
This is the same symbol, but separatorChar is a char, and separator is a String.
So, instead if using String.valueOf(File.separatorChar) developer could use File.separator.
File pom = new File(dir.getAbsoluteFile()
+ String.valueOf(File.separatorChar) + "pom.xml");
Actualy class java.io.File has two constants:
public static final char separatorChar = '\';
public static final String separator = "" + separatorChar;
This is the same symbol, but separatorChar is a char, and separator is a String.
So, instead if using String.valueOf(File.separatorChar) developer could use File.separator.
Подписаться на:
Сообщения (Atom)