1 33 package smallsql.database; 34 35 import java.sql.*; 36 import java.math.*; 37 import java.util.Map ; 38 import java.util.Calendar ; 39 import java.net.URL ; 40 import java.io.*; 41 42 43 public class SSCallableStatement extends SSPreparedStatement implements CallableStatement { 44 45 private boolean wasNull; 46 47 SSCallableStatement( SSConnection con, String sql ) throws SQLException { 48 super( con, sql ); 49 } 50 51 SSCallableStatement( SSConnection con, String sql, int rsType, int rsConcurrency ) throws SQLException { 52 super( con, sql, rsType, rsConcurrency ); 53 } 54 55 private Expression getValue(int i) throws SQLException{ 56 57 throw new java.lang.UnsupportedOperationException ("Method getValue() not yet implemented."); 58 } 59 60 private int findParameter( String parameterName ){ 61 62 throw new java.lang.UnsupportedOperationException ("Method findParameter() not yet implemented."); 63 } 64 69 public void registerOutParameter(int i, int sqlType) throws SQLException { 70 71 throw new java.lang.UnsupportedOperationException ("Method registerOutParameter() not yet implemented."); 72 } 73 public void registerOutParameter(int i, int sqlType, int scale) throws SQLException { 74 75 throw new java.lang.UnsupportedOperationException ("Method registerOutParameter() not yet implemented."); 76 } 77 78 79 public boolean wasNull(){ 80 return wasNull; 81 } 82 83 84 public String getString(int i) throws SQLException { 85 try{ 86 String obj = getValue(i).getString(); 87 wasNull = obj == null; 88 return obj; 89 }catch(Exception e){ 90 throw Utils.createSQLException( e ); 91 } 92 } 93 public boolean getBoolean(int i) throws SQLException { 94 try{ 95 Expression expr = getValue(i); 96 wasNull = expr.isNull(); 97 return expr.getBoolean(); 98 }catch(Exception e){ 99 throw Utils.createSQLException( e ); 100 } 101 } 102 public byte getByte(int i) throws SQLException { 103 return (byte)getInt( i ); 104 } 105 public short getShort(int i) throws SQLException { 106 return (byte)getInt( i ); 107 } 108 public int getInt(int i) throws SQLException { 109 try{ 110 Expression expr = getValue(i); 111 wasNull = expr.isNull(); 112 return expr.getInt(); 113 }catch(Exception e){ 114 throw Utils.createSQLException( e ); 115 } 116 } 117 public long getLong(int i) throws SQLException { 118 try{ 119 Expression expr = getValue(i); 120 wasNull = expr.isNull(); 121 return expr.getLong(); 122 }catch(Exception e){ 123 throw Utils.createSQLException( e ); 124 } 125 } 126 public float getFloat(int i) throws SQLException { 127 try{ 128 Expression expr = getValue(i); 129 wasNull = expr.isNull(); 130 return expr.getFloat(); 131 }catch(Exception e){ 132 throw Utils.createSQLException( e ); 133 } 134 } 135 public double getDouble(int i) throws SQLException { 136 try{ 137 Expression expr = getValue(i); 138 wasNull = expr.isNull(); 139 return expr.getLong(); 140 }catch(Exception e){ 141 throw Utils.createSQLException( e ); 142 } 143 } 144 public BigDecimal getBigDecimal(int i, int scale) throws SQLException { 145 try{ 146 MutableNumeric obj = getValue(i).getNumeric(); 147 wasNull = obj == null; 148 if(wasNull) return null; 149 return obj.toBigDecimal(scale); 150 }catch(Exception e){ 151 throw Utils.createSQLException( e ); 152 } 153 } 154 public byte[] getBytes(int i) throws SQLException { 155 try{ 156 byte[] obj = getValue(i).getBytes(); 157 wasNull = obj == null; 158 return obj; 159 }catch(Exception e){ 160 throw Utils.createSQLException( e ); 161 } 162 } 163 public Date getDate(int i) throws SQLException { 164 try{ 165 Expression expr = getValue(i); 166 wasNull = expr.isNull(); 167 if(wasNull) return null; 168 return DateTime.getDate( expr.getLong() ); 169 }catch(Exception e){ 170 throw Utils.createSQLException( e ); 171 } 172 } 173 public Time getTime(int i) throws SQLException { 174 try{ 175 Expression expr = getValue(i); 176 wasNull = expr.isNull(); 177 if(wasNull) return null; 178 return DateTime.getTime( expr.getLong() ); 179 }catch(Exception e){ 180 throw Utils.createSQLException( e ); 181 } 182 } 183 public Timestamp getTimestamp(int i) throws SQLException { 184 try{ 185 Expression expr = getValue(i); 186 wasNull = expr.isNull(); 187 if(wasNull) return null; 188 return DateTime.getTimestamp( expr.getLong() ); 189 }catch(Exception e){ 190 throw Utils.createSQLException( e ); 191 } 192 } 193 public Object getObject(int i) throws SQLException { 194 try{ 195 Object obj = getValue(i).getObject(); 196 wasNull = obj == null; 197 return obj; 198 }catch(Exception e){ 199 throw Utils.createSQLException( e ); 200 } 201 } 202 public BigDecimal getBigDecimal(int i) throws SQLException { 203 try{ 204 MutableNumeric obj = getValue(i).getNumeric(); 205 wasNull = obj == null; 206 if(wasNull) return null; 207 return obj.toBigDecimal(); 208 }catch(Exception e){ 209 throw Utils.createSQLException( e ); 210 } 211 } 212 public Object getObject(int i, Map map) throws SQLException { 213 214 throw new java.lang.UnsupportedOperationException ("Method getObject() not yet implemented."); 215 } 216 public Ref getRef(int i) throws SQLException { 217 218 throw new java.lang.UnsupportedOperationException ("Method getRef() not yet implemented."); 219 } 220 public Blob getBlob(int i) throws SQLException { 221 222 throw new java.lang.UnsupportedOperationException ("Method getBlob() not yet implemented."); 223 } 224 public Clob getClob(int i) throws SQLException { 225 226 throw new java.lang.UnsupportedOperationException ("Method getClob() not yet implemented."); 227 } 228 public Array getArray(int i) throws SQLException { 229 230 throw new java.lang.UnsupportedOperationException ("Method getArray() not yet implemented."); 231 } 232 public Date getDate(int i, Calendar cal) throws SQLException { 233 234 throw new java.lang.UnsupportedOperationException ("Method getDate() not yet implemented."); 235 } 236 public Time getTime(int i, Calendar cal) throws SQLException { 237 238 throw new java.lang.UnsupportedOperationException ("Method getTime() not yet implemented."); 239 } 240 public Timestamp getTimestamp(int i, Calendar cal) throws SQLException { 241 242 throw new java.lang.UnsupportedOperationException ("Method getTimestamp() not yet implemented."); 243 } 244 public void registerOutParameter(int i, int sqlType, String typeName) throws SQLException { 245 246 throw new java.lang.UnsupportedOperationException ("Method registerOutParameter() not yet implemented."); 247 } 248 public void registerOutParameter(String parameterName, int sqlType) throws SQLException { 249 registerOutParameter( findParameter( parameterName ), sqlType ); 250 } 251 public void registerOutParameter(String parameterName, int sqlType, int scale) throws SQLException { 252 registerOutParameter( findParameter( parameterName ), sqlType, scale ); 253 } 254 public void registerOutParameter(String parameterName, int sqlType, String typeName) throws SQLException { 255 registerOutParameter( findParameter( parameterName ), sqlType, typeName ); 256 } 257 public URL getURL(int parameterIndex) throws SQLException { 258 259 throw new java.lang.UnsupportedOperationException ("Method getURL() not yet implemented."); 260 } 261 public void setURL(String parameterName, URL x) throws SQLException { 262 setURL( findParameter( parameterName ), x ); 263 } 264 public void setNull(String parameterName, int sqlType) throws SQLException { 265 setNull( findParameter( parameterName ), sqlType ); 266 } 267 public void setBoolean(String parameterName, boolean x) throws SQLException { 268 setBoolean( findParameter( parameterName ), x ); 269 } 270 public void setByte(String parameterName, byte x) throws SQLException { 271 setByte( findParameter( parameterName ), x ); 272 } 273 public void setShort(String parameterName, short x) throws SQLException { 274 setShort( findParameter( parameterName ), x ); 275 } 276 public void setInt(String parameterName, int x) throws SQLException { 277 setInt( findParameter( parameterName ), x ); 278 } 279 public void setLong(String parameterName, long x) throws SQLException { 280 setLong( findParameter( parameterName ), x ); 281 } 282 public void setFloat(String parameterName, float x) throws SQLException { 283 setFloat( findParameter( parameterName ), x ); 284 } 285 public void setDouble(String parameterName, double x) throws SQLException { 286 setDouble( findParameter( parameterName ), x ); 287 } 288 public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException { 289 setBigDecimal( findParameter( parameterName ), x ); 290 } 291 public void setString(String parameterName, String x) throws SQLException { 292 setString( findParameter( parameterName ), x ); 293 } 294 public void setBytes(String parameterName, byte[] x) throws SQLException { 295 setBytes( findParameter( parameterName ), x ); 296 } 297 public void setDate(String parameterName, Date x) throws SQLException { 298 setDate( findParameter( parameterName ), x ); 299 } 300 public void setTime(String parameterName, Time x) throws SQLException { 301 setTime( findParameter( parameterName ), x ); 302 } 303 public void setTimestamp(String parameterName, Timestamp x) throws SQLException { 304 setTimestamp( findParameter( parameterName ), x ); 305 } 306 public void setAsciiStream(String parameterName, InputStream x, int length) throws SQLException { 307 setAsciiStream( findParameter( parameterName ), x, length ); 308 } 309 public void setBinaryStream(String parameterName, InputStream x, int length) throws SQLException { 310 setBinaryStream( findParameter( parameterName ), x, length ); 311 } 312 public void setObject(String parameterName, Object x, int sqlType, int scale) throws SQLException { 313 setObject( findParameter( parameterName ), x, sqlType, scale ); 314 } 315 public void setObject(String parameterName, Object x, int sqlType) throws SQLException { 316 setObject( findParameter( parameterName ), x, sqlType ); 317 } 318 public void setObject(String parameterName, Object x) throws SQLException { 319 setObject( findParameter( parameterName ), x ); 320 } 321 public void setCharacterStream(String parameterName, Reader x, int length) throws SQLException { 322 setCharacterStream( findParameter( parameterName ), x, length ); 323 } 324 public void setDate(String parameterName, Date x, Calendar cal) throws SQLException { 325 setDate( findParameter( parameterName ), x, cal ); 326 } 327 public void setTime(String parameterName, Time x, Calendar cal) throws SQLException { 328 setTime( findParameter( parameterName ), x, cal ); 329 } 330 public void setTimestamp(String parameterName, Timestamp x, Calendar cal) throws SQLException { 331 setTimestamp( findParameter( parameterName ), x, cal ); 332 } 333 public void setNull(String parameterName, int sqlType, String typeName) throws SQLException { 334 setNull( findParameter( parameterName ), sqlType, typeName ); 335 } 336 public String getString(String parameterName) throws SQLException { 337 return getString( findParameter( parameterName ) ); 338 } 339 public boolean getBoolean(String parameterName) throws SQLException { 340 return getBoolean( findParameter( parameterName ) ); 341 } 342 public byte getByte(String parameterName) throws SQLException { 343 return getByte( findParameter( parameterName ) ); 344 } 345 public short getShort(String parameterName) throws SQLException { 346 return getShort( findParameter( parameterName ) ); 347 } 348 public int getInt(String parameterName) throws SQLException { 349 return getInt( findParameter( parameterName ) ); 350 } 351 public long getLong(String parameterName) throws SQLException { 352 return getLong( findParameter( parameterName ) ); 353 } 354 public float getFloat(String parameterName) throws SQLException { 355 return getFloat( findParameter( parameterName ) ); 356 } 357 public double getDouble(String parameterName) throws SQLException { 358 return getDouble( findParameter( parameterName ) ); 359 } 360 public byte[] getBytes(String parameterName) throws SQLException { 361 return getBytes( findParameter( parameterName ) ); 362 } 363 public Date getDate(String parameterName) throws SQLException { 364 return getDate( findParameter( parameterName ) ); 365 } 366 public Time getTime(String parameterName) throws SQLException { 367 return getTime( findParameter( parameterName ) ); 368 } 369 public Timestamp getTimestamp(String parameterName) throws SQLException { 370 return getTimestamp( findParameter( parameterName ) ); 371 } 372 public Object getObject(String parameterName) throws SQLException { 373 return getObject( findParameter( parameterName ) ); 374 } 375 public BigDecimal getBigDecimal(String parameterName) throws SQLException { 376 return getBigDecimal( findParameter( parameterName ) ); 377 } 378 public Object getObject(String parameterName, Map map) throws SQLException { 379 return getObject( findParameter( parameterName ), map ); 380 } 381 public Ref getRef(String parameterName) throws SQLException { 382 return getRef( findParameter( parameterName ) ); 383 } 384 public Blob getBlob(String parameterName) throws SQLException { 385 return getBlob( findParameter( parameterName ) ); 386 } 387 public Clob getClob(String parameterName) throws SQLException { 388 return getClob( findParameter( parameterName ) ); 389 } 390 public Array getArray(String parameterName) throws SQLException { 391 return getArray( findParameter( parameterName ) ); 392 } 393 public Date getDate(String parameterName, Calendar cal) throws SQLException { 394 return getDate( findParameter( parameterName ), cal ); 395 } 396 public Time getTime(String parameterName, Calendar cal) throws SQLException { 397 return getTime( findParameter( parameterName ), cal ); 398 } 399 public Timestamp getTimestamp(String parameterName, Calendar cal) throws SQLException { 400 return getTimestamp( findParameter( parameterName ), cal ); 401 } 402 public URL getURL(String parameterName) throws SQLException { 403 return getURL( findParameter( parameterName ) ); 404 } 405 } | Popular Tags |