⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 callablestatement_base.java

📁 数据仓库工具
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
//                                                                            
// Copyright 1998, 1999 CDS Networks, Inc., Medford Oregon                    
//                                                                            
// All rights reserved.                                                       
//                                                                            
// Redistribution and use in source and binary forms, with or without         
// modification, are permitted provided that the following conditions are met:
// 1. Redistributions of source code must retain the above copyright          
//    notice, this list of conditions and the following disclaimer.           
// 2. Redistributions in binary form must reproduce the above copyright       
//    notice, this list of conditions and the following disclaimer in the     
//    documentation and/or other materials provided with the distribution.    
// 3. All advertising materials mentioning features or use of this software   
//    must display the following acknowledgement:                             
//      This product includes software developed by CDS Networks, Inc.        
// 4. The name of CDS Networks, Inc.  may not be used to endorse or promote   
//    products derived from this software without specific prior              
//    written permission.                                                     
//                                                                            
// THIS SOFTWARE IS PROVIDED BY CDS NETWORKS, INC. ``AS IS'' AND              
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE      
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
// ARE DISCLAIMED.  IN NO EVENT SHALL CDS NETWORKS, INC. BE LIABLE            
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS    
// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)      
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY  
// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF     
// SUCH DAMAGE.                                                               
//                                                                            


package com.internetcds.jdbc.tds;

import java.sql.*;
import java.math.BigDecimal;
import java.util.Calendar;


/**
 * <P>CallableStatement is used to execute SQL stored procedures.
 *
 * <P>JDBC provides a stored procedure SQL escape that allows stored
 * procedures to be called in a standard way for all RDBMS's. This
 * escape syntax has one form that includes a result parameter and one
 * that does not. If used, the result parameter must be registered as
 * an OUT parameter. The other parameters may be used for input,
 * output or both. Parameters are refered to sequentially, by
 * number. The first parameter is 1.
 *
 * <P><CODE>
 * {?= call <procedure-name>[<arg1>,<arg2>, ...]}<BR>
 * {call <procedure-name>[<arg1>,<arg2>, ...]}
 * </CODE>
 *
 * <P>IN parameter values are set using the set methods inherited from
 * PreparedStatement. The type of all OUT parameters must be
 * registered prior to executing the stored procedure; their values
 * are retrieved after execution via the get methods provided here.
 *
 * <P>A Callable statement may return a ResultSet or multiple
 * ResultSets. Multiple ResultSets are handled using operations
 * inherited from Statement.
 *
 * <P>For maximum portability, a call's ResultSets and update counts
 * should be processed prior to getting the values of output
 * parameters.
 *
 * @see Connection#prepareCall
 * @see ResultSet
 */
public class CallableStatement_base 
   extends com.internetcds.jdbc.tds.PreparedStatement_base 
{
   public static final String cvsVersion = "$Id: CallableStatement_base.java,v 1.1 2003/04/29 18:07:50 sinisa Exp $";


   private String   procedureName = null;


   public CallableStatement_base(
      java.sql.Connection conn_, 
      Tds                 tds_, 
      String              sql)
      throws SQLException
   {
      super(conn_, tds_, sql);
      int   i;
      procedureName = "";
      i = 0;
      while(i<sql.length() 
            && (!
                (Character.isLetterOrDigit(sql.charAt(i))
                 || sql.charAt(i) == '#')))
      {
         i++;
      }
      
      while(i<sql.length()
            && (Character.isLetterOrDigit(sql.charAt(i))
                || sql.charAt(i) == '#'
                || sql.charAt(i) == '_'))
      {
         procedureName = procedureName + sql.charAt(i);
         i++;
      }
      
      if (procedureName.length() == 0)
      {
         throw new SQLException("Did not find name in sql string");
      }
   }




   /**
    * Get the value of a NUMERIC parameter as a java.math.BigDecimal object.
    *
    * @param parameterIndex the first parameter is 1, the second is 2, ...
    *
    * @param scale a value greater than or equal to zero representing the
    * desired number of digits to the right of the decimal point
    *
    * @return the parameter value; if the value is SQL NULL, the result is
    * null
    * @exception SQLException if a database-access error occurs.
    */
   public BigDecimal getBigDecimal(int parameterIndex, int scale)
      throws SQLException
   {
      throw new SQLException("Not implemented");
   }


   /**
    * Get the value of a BIT parameter as a Java boolean.
    *
    * @param parameterIndex the first parameter is 1, the second is 2, ...
    * @return the parameter value; if the value is SQL NULL, the result is false
    * @exception SQLException if a database-access error occurs.
    */
   public boolean getBoolean(int parameterIndex) throws SQLException
   {
      throw new SQLException("Not implemented");
   }


   /**
    * Get the value of a TINYINT parameter as a Java byte.
    *
    * @param parameterIndex the first parameter is 1, the second is 2, ...
    * @return the parameter value; if the value is SQL NULL, the result is 0
    * @exception SQLException if a database-access error occurs.
    */
   public byte getByte(int parameterIndex) throws SQLException
   {
      throw new SQLException("Not implemented");
   }


   /**
    * Get the value of a SQL BINARY or VARBINARY parameter as a Java byte[]
    *
    * @param parameterIndex the first parameter is 1, the second is 2, ...
    * @return the parameter value; if the value is SQL NULL, the result is null
    * @exception SQLException if a database-access error occurs.
    */
   public byte[] getBytes(int parameterIndex) throws SQLException
   {
      throw new SQLException("Not implemented");
   }


   /**
    * Get the value of a SQL DATE parameter as a java.sql.Date object
    *
    * @param parameterIndex the first parameter is 1, the second is 2, ...
    * @return the parameter value; if the value is SQL NULL, the result is null
    * @exception SQLException if a database-access error occurs.
    */
   public java.sql.Date getDate(int parameterIndex) throws SQLException
   {
      throw new SQLException("Not implemented");
   }


   /**
    * Get the value of a DOUBLE parameter as a Java double.
    *
    * @param parameterIndex the first parameter is 1, the second is 2, ...
    * @return the parameter value; if the value is SQL NULL, the result is 0
    * @exception SQLException if a database-access error occurs.
    */
   public double getDouble(int parameterIndex) throws SQLException
   {
      throw new SQLException("Not implemented");
   }


   /**
    * Get the value of a FLOAT parameter as a Java float.
    *
    * @param parameterIndex the first parameter is 1, the second is 2, ...
    * @return the parameter value; if the value is SQL NULL, the result is 0
    * @exception SQLException if a database-access error occurs.
    */
   public float getFloat(int parameterIndex) throws SQLException
   {
      throw new SQLException("Not implemented");
   }


   /**
    * Get the value of an INTEGER parameter as a Java int.
    *
    * @param parameterIndex the first parameter is 1, the second is 2, ...
    * @return the parameter value; if the value is SQL NULL, the result is 0
    * @exception SQLException if a database-access error occurs.
    */
   public int getInt(int parameterIndex) throws SQLException
   {
      throw new SQLException("Not implemented");
   }


   /**
    * Get the value of a BIGINT parameter as a Java long.
    *
    * @param parameterIndex the first parameter is 1, the second is 2, ...
    * @return the parameter value; if the value is SQL NULL, the result is 0
    * @exception SQLException if a database-access error occurs.
    */
   public long getLong(int parameterIndex) throws SQLException
   {
      throw new SQLException("Not implemented");
   }


   //----------------------------------------------------------------------
   // Advanced features:


   /**
    * Get the value of a parameter as a Java object.
    *
    * <p>This method returns a Java object whose type coresponds to the SQL
    * type that was registered for this parameter using registerOutParameter.
    *
    * <p>Note that this method may be used to read
    * datatabase-specific, abstract data types. This is done by
    * specifying a targetSqlType of java.sql.types.OTHER, which
    * allows the driver to return a database-specific Java type.
    *
    * @param parameterIndex The first parameter is 1, the second is 2, ...
    * @return A java.lang.Object holding the OUT parameter value.
    * @exception SQLException if a database-access error occurs.
    * @see Types
    */
   public Object getObject(int parameterIndex) throws SQLException
   {
      throw new SQLException("Not implemented");
   }


   /**
    * Get the value of a SMALLINT parameter as a Java short.
    *
    * @param parameterIndex the first parameter is 1, the second is 2, ...
    * @return the parameter value; if the value is SQL NULL, the result is 0
    * @exception SQLException if a database-access error occurs.
    */
   public short getShort(int parameterIndex) throws SQLException
   {
      throw new SQLException("Not implemented");
   }


   /**
    * Get the value of a CHAR, VARCHAR, or LONGVARCHAR parameter as a Java String.
    *
    * @param parameterIndex the first parameter is 1, the second is 2, ...
    * @return the parameter value; if the value is SQL NULL, the result is null
    * @exception SQLException if a database-access error occurs.
    */
   public String getString(int parameterIndex) throws SQLException
   {
      throw new SQLException("Not implemented");
   }


   /**
    * Get the value of a SQL TIME parameter as a java.sql.Time object.
    *
    * @param parameterIndex the first parameter is 1, the second is 2, ...
    * @return the parameter value; if the value is SQL NULL, the result is null
    * @exception SQLException if a database-access error occurs.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -