📄 sscallablestatement.java
字号:
/* =============================================================
* SmallSQL : a free Java DBMS library for the Java(tm) platform
* =============================================================
*
* (C) Copyright 2004-2006, by Volker Berlin.
*
* Project Info: http://www.smallsql.de/
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
* in the United States and other countries.]
*
* ---------------
* SSCallableStatament.java
* ---------------
* Author: Volker Berlin
*
*/
package smallsql.database;
import java.sql.*;
import java.math.*;
import java.util.Map;
import java.util.Calendar;
import java.net.URL;
import java.io.*;
public class SSCallableStatement extends SSPreparedStatement implements CallableStatement {
private boolean wasNull;
SSCallableStatement( SSConnection con, String sql ) throws SQLException {
super( con, sql );
}
SSCallableStatement( SSConnection con, String sql, int rsType, int rsConcurrency ) throws SQLException {
super( con, sql, rsType, rsConcurrency );
}
private Expression getValue(int i) throws SQLException{
/**@todo: Implement this java.sql.CallableStatement method*/
throw new java.lang.UnsupportedOperationException("Method getValue() not yet implemented.");
}
private int findParameter( String parameterName ){
/**@todo: Implement this java.sql.CallableStatement method*/
throw new java.lang.UnsupportedOperationException("Method findParameter() not yet implemented.");
}
/*==============================================================================
Public Interface
==============================================================================*/
public void registerOutParameter(int i, int sqlType) throws SQLException {
/**@todo: Implement this java.sql.CallableStatement method*/
throw new java.lang.UnsupportedOperationException("Method registerOutParameter() not yet implemented.");
}
public void registerOutParameter(int i, int sqlType, int scale) throws SQLException {
/**@todo: Implement this java.sql.CallableStatement method*/
throw new java.lang.UnsupportedOperationException("Method registerOutParameter() not yet implemented.");
}
public boolean wasNull(){
return wasNull;
}
public String getString(int i) throws SQLException {
try{
String obj = getValue(i).getString();
wasNull = obj == null;
return obj;
}catch(Exception e){
throw Utils.createSQLException( e );
}
}
public boolean getBoolean(int i) throws SQLException {
try{
Expression expr = getValue(i);
wasNull = expr.isNull();
return expr.getBoolean();
}catch(Exception e){
throw Utils.createSQLException( e );
}
}
public byte getByte(int i) throws SQLException {
return (byte)getInt( i );
}
public short getShort(int i) throws SQLException {
return (byte)getInt( i );
}
public int getInt(int i) throws SQLException {
try{
Expression expr = getValue(i);
wasNull = expr.isNull();
return expr.getInt();
}catch(Exception e){
throw Utils.createSQLException( e );
}
}
public long getLong(int i) throws SQLException {
try{
Expression expr = getValue(i);
wasNull = expr.isNull();
return expr.getLong();
}catch(Exception e){
throw Utils.createSQLException( e );
}
}
public float getFloat(int i) throws SQLException {
try{
Expression expr = getValue(i);
wasNull = expr.isNull();
return expr.getFloat();
}catch(Exception e){
throw Utils.createSQLException( e );
}
}
public double getDouble(int i) throws SQLException {
try{
Expression expr = getValue(i);
wasNull = expr.isNull();
return expr.getLong();
}catch(Exception e){
throw Utils.createSQLException( e );
}
}
public BigDecimal getBigDecimal(int i, int scale) throws SQLException {
try{
MutableNumeric obj = getValue(i).getNumeric();
wasNull = obj == null;
if(wasNull) return null;
return obj.toBigDecimal(scale);
}catch(Exception e){
throw Utils.createSQLException( e );
}
}
public byte[] getBytes(int i) throws SQLException {
try{
byte[] obj = getValue(i).getBytes();
wasNull = obj == null;
return obj;
}catch(Exception e){
throw Utils.createSQLException( e );
}
}
public Date getDate(int i) throws SQLException {
try{
Expression expr = getValue(i);
wasNull = expr.isNull();
if(wasNull) return null;
return DateTime.getDate( expr.getLong() );
}catch(Exception e){
throw Utils.createSQLException( e );
}
}
public Time getTime(int i) throws SQLException {
try{
Expression expr = getValue(i);
wasNull = expr.isNull();
if(wasNull) return null;
return DateTime.getTime( expr.getLong() );
}catch(Exception e){
throw Utils.createSQLException( e );
}
}
public Timestamp getTimestamp(int i) throws SQLException {
try{
Expression expr = getValue(i);
wasNull = expr.isNull();
if(wasNull) return null;
return DateTime.getTimestamp( expr.getLong() );
}catch(Exception e){
throw Utils.createSQLException( e );
}
}
public Object getObject(int i) throws SQLException {
try{
Object obj = getValue(i).getObject();
wasNull = obj == null;
return obj;
}catch(Exception e){
throw Utils.createSQLException( e );
}
}
public BigDecimal getBigDecimal(int i) throws SQLException {
try{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -