Esempio n. 1
0
  /**
   * Set the maximum number of rows
   *
   * @param max the new max rows limit; zero means unlimited
   * @exception java.sql.SQLException if a database access error occurs
   * @see getMaxRows
   */
  public void setMaxRows(int max) throws java.sql.SQLException {
    if (Driver.trace) {
      Object[] Args = {new Integer(max)};
      Debug.methodCall(this, "setMaxRows", Args);
    }

    if (max > MysqlDefs.MAX_ROWS) {
      throw new java.sql.SQLException(
          "setMaxRows() out of range. " + max + " > " + MysqlDefs.MAX_ROWS + ".", "S1009");
    }

    if (max == 0) {
      max = -1;
    }

    _max_rows = max;

    // Most people don't use setMaxRows()
    // so don't penalize them
    // with the extra query it takes
    // to do it efficiently unless we need
    // to.

    _Conn.maxRowsChanged();
  }