Let's try this...
The inlinde code is the same as the attachements. Let me know if you don't
get the attchements.
BigDecimalBinding.java
/**
*
* Copyright 2004 Hogstrom
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.tranql.sql.jdbc.binding;
import java.math.BigDecimal;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Types;
import org.tranql.ql.QueryBinding;
/**
*
*
*
*
*/
public class BigDecimalBinding extends AbstractBinding {
public BigDecimalBinding(int index, QueryBinding transform) {
super(index, transform);
}
public Object getValue(ResultSet rs) throws SQLException {
BigDecimal value = rs.getBigDecimal(index);
return rs.wasNull() ? null : value;
}
public void setValue(PreparedStatement ps, Object value) throws
SQLException {
if (value == null) {
ps.setNull(index, getSQLType());
} else {
ps.setBigDecimal(index, (BigDecimal) value);
}
}
public void register(CallableStatement cs) throws SQLException {
cs.registerOutParameter(index, getSQLType());
}
public Object getValue(CallableStatement cs) throws SQLException {
BigDecimal value = cs.getBigDecimal(index);
return cs.wasNull() ? null : value;
}
public int getSQLType() {
return Types.DECIMAL;
}
}
The Diff for Binding Factory:
? bigdecimal.diff
RCS file:
/home/projects/tranql/scm/tranql/src/java/org/tranql/sql/jdbc/binding/BindingFactory.java,v
retrieving revision 1.11
diff -r1.11 BindingFactory.java
19a20
import java.math.BigDecimal;
73a75
CTR_BY_JAVA_CLASS.put(BigDecimal.class,
BigDecimalBinding.class.getConstructor(ctrArgs)); // $hogstrom
100a103
CTR_BY_SQL_TYPE.put(new Integer(Types.DECIMAL),
BigDecimalBinding.class.getConstructor(ctrArgs)); // $hogstrom
- Matt