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

📄 tinysqlconnection.java

📁 TinySQL是一个轻量级的纯java数据库引擎
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
  public boolean isReadOnly() throws SQLException {
    return false;
  }

  /**
   *
   * Sets the current catalog within the database. This is not 
   * supported by tinySQL, but we'll set the catalog String anyway.
   * @see java.sql.Connection#setCatalog
   * @param str the catalog
   *
   */
  public void setCatalog(String str) throws SQLException {
    catalog = str;
  }

  /**
   *
   * Returns the current catalog. This has no significance in tinySQL
   * @see java.sql.Connection#getCatalog
   * @return the catalog name
   *
   */
  public String getCatalog() throws SQLException {
    return catalog;
  }

  /**
   *
   * Sets the transaction isolation level, which has no meaning in tinySQL.
   * We'll set the isolation level value anyhow, just to keep it happy.
   * @see java.sql.Connection#setTransactionIsolation
   * @param x the isolation level
   *
   */
  public void setTransactionIsolation(int x)
       throws SQLException {
    isolation = x;
  }

  /**
   *
   * Returns the isolation level. This is not significant for tinySQL
   * @see java.sql.Connection#getTransactionIsolation
   * @return the transaction isolation level
   *
   */
  public int getTransactionIsolation() throws SQLException {
    return isolation;
  }

  /**
   *
   * Disables autoclosing of connections and result sets. This is 
   * not supported by tinySQL.
   * @see java.sql.Connection#disableAutoClose
   *
   */
  public void disableAutoClose() throws SQLException {
  }

  /**
   *
   * Returns a chain of warnings for the current connection; this
   * is not supported by tinySQL.
   * @see java.sql.Connection#getWarnings
   * @return the chain of warnings for this connection
   *
   */
  public SQLWarning getWarnings() throws SQLException {
    return null;
  }

  /**
   *
   * Clears the non-existant warning chain.
   * @see java.sql.Connection#clearWarnings
   *
   */
  public void clearWarnings() throws SQLException {
  }

  /**
   *
   * Execute a tinySQL Statement
   * @param sql the statement to be executed
   * @return tsResultSet containing the results of the SQL statement
   *
   */
   public tsResultSet executetinySQL(tinySQLStatement sql) throws SQLException 
   {
    tsResultSet result;

    // try to execute the SQL
    //
    try {
      result = tsql.sqlexec(sql);
    } catch( tinySQLException e ) {
      if ( debug ) e.printStackTrace();
      throw new SQLException("Exception: " + e.getMessage());
    }
    return result;
  }
   public tsResultSet executetinySQL(tinySQLPreparedStatement psql) throws SQLException 
   {
    tsResultSet result;

    // try to execute the SQL
    //
    try {
      result = tsql.sqlexec(psql);
    } catch( tinySQLException e ) {
      if ( debug ) e.printStackTrace();
      throw new SQLException("Exception: " + e.getMessage());
    }
    return result;
  }

  /**
   *
   * Execute a tinySQL Statement
   * @param sql the statement to be executed
   * @return either the row count for INSERT, UPDATE or DELETE or 0 for SQL statements that return nothing
   *
   */
   public int executetinyUpdate(tinySQLStatement sql) throws SQLException {

    // the result set
    //
    tsResultSet result;

    // try to execute the SQL
    //
    try {
      result = tsql.sqlexec(sql);
    } catch( tinySQLException e ) {
      if ( debug ) e.printStackTrace();
      throw new SQLException("Exception: " + e.getMessage());
    }
    return 0;
  }
   public int executetinyUpdate(tinySQLPreparedStatement psql) throws SQLException {

    // the result set
    //
    tsResultSet result;

    // try to execute the SQL
    //
    try {
      result = tsql.sqlexec(psql);
    } catch( tinySQLException e ) {
      if ( debug ) e.printStackTrace();
      throw new SQLException("Exception: " + e.getMessage());
    }
    return 0;
  }

  public boolean getAutoCommit() {
    return true;
  }

  public void setAutoClose(boolean l) {
  }

  public boolean getAutoClose() {
    return false;
  }


  /**
   *
   * creates a new tinySQL object and returns it. Well, not really,
   * since tinySQL is an abstract class. When you subclass tinySQLConnection,
   * you will need to include this method, and return some subclass
   * of tinySQL.
   *
   */
  public abstract tinySQL get_tinySQL();

    //--------------------------JDBC 2.0-----------------------------

    /**
     * JDBC 2.0
     *
         * Creates a <code>Statement</code> object that will generate
         * <code>ResultSet</code> objects with the given type and concurrency.
     * This method is the same as the <code>createStatement</code> method
         * above, but it allows the default result set
     * type and result set concurrency type to be overridden.
     *
     * @param resultSetType a result set type; see ResultSet.TYPE_XXX
     * @param resultSetConcurrency a concurrency type; see ResultSet.CONCUR_XXX
     * @return a new Statement object 
     * @exception SQLException if a database access error occurs
     */
    public Statement createStatement(int resultSetType, int resultSetConcurrency) 
      throws SQLException {
          throw new SQLException("tinySQL does not support createStatement with concurrency.");
      }

    /**
     * JDBC 2.0
     *
         * Creates a <code>PreparedStatement</code> object that will generate
         * <code>ResultSet</code> objects with the given type and concurrency.
     * This method is the same as the <code>prepareStatement</code> method
         * above, but it allows the default result set
     * type and result set concurrency type to be overridden.
     *
     * @param resultSetType a result set type; see ResultSet.TYPE_XXX
     * @param resultSetConcurrency a concurrency type; see ResultSet.CONCUR_XXX
     * @return a new PreparedStatement object containing the
     * pre-compiled SQL statement 
     * @exception SQLException if a database access error occurs
     */
     public PreparedStatement prepareStatement(String sql, int resultSetType, 
                                        int resultSetConcurrency)
       throws SQLException {
       throw new SQLException("tinySQL does not support preparedStatement with concurrency.");
     }

    /**
     * JDBC 2.0
     *
         * Creates a <code>CallableStatement</code> object that will generate
         * <code>ResultSet</code> objects with the given type and concurrency.
     * This method is the same as the <code>prepareCall</code> method
         * above, but it allows the default result set
     * type and result set concurrency type to be overridden.
     *
     * @param resultSetType a result set type; see ResultSet.TYPE_XXX
     * @param resultSetConcurrency a concurrency type; see ResultSet.CONCUR_XXX
     * @return a new CallableStatement object containing the
     * pre-compiled SQL statement 
     * @exception SQLException if a database access error occurs
     */
    public CallableStatement prepareCall(String sql, int resultSetType, 
                                 int resultSetConcurrency) throws SQLException {
       throw new SQLException("tinySQL does not support prepareCall with concurrency.");
    }

    /**
     * JDBC 2.0
     *
     * Gets the type map object associated with this connection.
     * Unless the application has added an entry to the type map,
         * the map returned will be empty.
         *
         * @return the <code>java.util.Map</code> object associated 
         *         with this <code>Connection</code> object
     */
    public java.util.Map getTypeMap() throws SQLException {
      throw new SQLException("tinySQL does not support getTypeMap.");
    }

    /**
     * JDBC 2.0
     *
     * Installs the given type map as the type map for
     * this connection.  The type map will be used for the
         * custom mapping of SQL structured types and distinct types.
         *
         * @param the <code>java.util.Map</code> object to install
         *        as the replacement for this <code>Connection</code>
         *        object's default type map
     */
    public void setTypeMap(java.util.Map map) throws SQLException {
      throw new SQLException("tinySQL does not support setTypeMap.");
    }

}

⌨️ 快捷键说明

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