1 33 34 package com.internetcds.jdbc.tds; 35 36 import java.sql.*; 37 import java.math.BigDecimal ; 38 import java.util.Calendar ; 39 40 41 73 public class CallableStatement_base 74 extends com.internetcds.jdbc.tds.PreparedStatement_base 75 { 76 public static final String cvsVersion = "$Id: CallableStatement_base.java,v 1.1 2006/06/23 10:39:04 sinisa Exp $"; 77 78 79 private String procedureName = null; 80 81 82 public CallableStatement_base( 83 java.sql.Connection conn_, 84 Tds tds_, 85 String sql) 86 throws SQLException 87 { 88 super(conn_, tds_, sql); 89 int i; 90 procedureName = ""; 91 i = 0; 92 while(i<sql.length() 93 && (! 94 (Character.isLetterOrDigit(sql.charAt(i)) 95 || sql.charAt(i) == '#'))) 96 { 97 i++; 98 } 99 100 while(i<sql.length() 101 && (Character.isLetterOrDigit(sql.charAt(i)) 102 || sql.charAt(i) == '#' 103 || sql.charAt(i) == '_')) 104 { 105 procedureName = procedureName + sql.charAt(i); 106 i++; 107 } 108 109 if (procedureName.length() == 0) 110 { 111 throw new SQLException("Did not find name in sql string"); 112 } 113 } 114 115 116 117 118 130 public BigDecimal getBigDecimal(int parameterIndex, int scale) 131 throws SQLException 132 { 133 throw new SQLException("Not implemented"); 134 } 135 136 137 144 public boolean getBoolean(int parameterIndex) throws SQLException 145 { 146 throw new SQLException("Not implemented"); 147 } 148 149 150 157 public byte getByte(int parameterIndex) throws SQLException 158 { 159 throw new SQLException("Not implemented"); 160 } 161 162 163 170 public byte[] getBytes(int parameterIndex) throws SQLException 171 { 172 throw new SQLException("Not implemented"); 173 } 174 175 176 183 public java.sql.Date getDate(int parameterIndex) throws SQLException 184 { 185 throw new SQLException("Not implemented"); 186 } 187 188 189 196 public double getDouble(int parameterIndex) throws SQLException 197 { 198 throw new SQLException("Not implemented"); 199 } 200 201 202 209 public float getFloat(int parameterIndex) throws SQLException 210 { 211 throw new SQLException("Not implemented"); 212 } 213 214 215 222 public int getInt(int parameterIndex) throws SQLException 223 { 224 throw new SQLException("Not implemented"); 225 } 226 227 228 235 public long getLong(int parameterIndex) throws SQLException 236 { 237 throw new SQLException("Not implemented"); 238 } 239 240 241 244 245 261 public Object getObject(int parameterIndex) throws SQLException 262 { 263 throw new SQLException("Not implemented"); 264 } 265 266 267 274 public short getShort(int parameterIndex) throws SQLException 275 { 276 throw new SQLException("Not implemented"); 277 } 278 279 280 287 public String getString(int parameterIndex) throws SQLException 288 { 289 throw new SQLException("Not implemented"); 290 } 291 292 293 300 public java.sql.Time getTime(int parameterIndex) throws SQLException 301 { 302 throw new SQLException("Not implemented"); 303 } 304 305 306 313 public java.sql.Timestamp getTimestamp(int parameterIndex) 314 throws SQLException 315 { 316 throw new SQLException("Not implemented"); 317 } 318 319 320 336 public void registerOutParameter(int parameterIndex, int sqlType) 337 throws SQLException 338 { 339 throw new SQLException("Not implemented"); 340 } 341 342 343 358 public void registerOutParameter(int parameterIndex, int sqlType, int scale) 359 throws SQLException 360 { 361 throw new SQLException("Not implemented"); 362 } 363 364 365 376 public boolean wasNull() throws SQLException 377 { 378 throw new SQLException("Not implemented"); 379 } 380 381 public boolean execute() 382 throws SQLException 383 { 384 boolean result; 385 386 closeResults(); 387 updateCount = -2; 388 389 ParameterUtils.verifyThatParametersAreSet(parameterList); 391 392 result = executeCall(procedureName, 394 parameterList, 395 parameterList); 396 397 return result; 398 } 399 400 401 402 404 416 public BigDecimal getBigDecimal(int parameterIndex) throws SQLException 417 { 418 NotImplemented(); 419 return null; 420 } 421 422 423 424 442 public java.sql.Date getDate(int parameterIndex, Calendar cal) 443 throws SQLException 444 { 445 NotImplemented(); 446 return null; 447 } 448 449 450 468 public java.sql.Time getTime(int parameterIndex, Calendar cal) 469 throws SQLException 470 { 471 NotImplemented(); 472 return null; 473 } 474 475 476 495 public java.sql.Timestamp getTimestamp(int parameterIndex, Calendar cal) 496 throws SQLException 497 { 498 NotImplemented(); 499 return null; 500 } 501 502 503 504 539 public void registerOutParameter (int paramIndex, int sqlType, String typeName) 540 throws SQLException 541 { 542 NotImplemented(); 543 } 544 545 546 547 548 static public void main(String args[]) 549 throws java.lang.ClassNotFoundException , 550 java.lang.IllegalAccessException , 551 java.lang.InstantiationException 552 { 553 try 554 { 555 String url = url = "" 556 + "jdbc:freetds:" 557 + "//" 558 + "kap" 559 + "/" 560 + "pubs"; 561 562 Class.forName("com.internetcds.jdbc.tds.Driver").newInstance(); 563 java.sql.Connection connection; 564 connection = DriverManager.getConnection(url, 565 "testuser", 566 "password"); 567 568 java.sql.CallableStatement call = connection.prepareCall( 569 "sp_tables ?"); 570 call.setString(1, "%"); 571 java.sql.ResultSet rs = call.executeQuery(); 572 573 while(rs.next()) 574 { 575 String qualifier = rs.getString("TABLE_QUALIFIER"); 576 String owner = rs.getString("TABLE_OWNER"); 577 String name = rs.getString("TABLE_NAME"); 578 String type = rs.getString("TABLE_TYPE"); 579 String remarks = rs.getString("REMARKS"); 580 581 System.out.println("qualifier: " + qualifier); 582 System.out.println("owner: " + owner); 583 System.out.println("name: " + name); 584 System.out.println("type: " + type); 585 System.out.println("remarks: " + remarks); 586 System.out.println(""); 587 } 588 } 589 catch(SQLException e) 590 { 591 e.printStackTrace(); 592 System.out.println(e.getMessage()); 593 } 594 } 595 } 596 | Popular Tags |