• unknown's avatar
    Port of cursors to be pushed into 5.0 tree: · eaf34dd8
    unknown authored
    - client side part is simple and may be considered stable
    - server side part now just joggles with THD state to save execution
      state and has no additional locking wisdom.
      Lot's of it are to be rewritten.
    
    
    include/mysql.h:
      Cursor patch to push into the main tree, client library part (considered 
      stable):
      - new statement attribute STMT_ATTR_CURSOR_TYPE
      - MYSQL_STMT::flags to store statement cursor type
      - MYSQL_STMT::server_status to store server status (i. e. if the server
      was able to open a cursor for this query).
    include/mysql_com.h:
      Cursor patch to push into the main tree, client library part (considered 
      stable):
      - new COMmand, COM_FETCH, to fetch K rows from read-only cursor.
        By design should support scrollable cursors as well.
      - a few new server statuses:
        SERVER_STATUS_CURSOR_EXISTS is sent by server in reply to COM_EXECUTE,
        when cursor was successfully opened for this query
        SERVER_STATUS_LAST_ROW_SENT is sent along with the last row to prevent one
        more round trip just for finding out that all rows were fetched from 
        this cursor (this is server mem savier also).
      - and finally, all possible values of STMT_ATTR_CURSOR_TYPE, 
        while now we support only CURSORT_TYPE_NO_CURSOR and 
        CURSOR_TYPE_READ_ONLY
    libmysql/libmysql.c:
      Cursor patch to push into the main tree, client library part (considered 
      stable):
      - simple additions to mysql_stmt_fetch implementation to read data 
        from an opened cursor: we can read up to iteration count rows per
        one request; read rows are buffered in the same way as rows of
        mysql_stmt_store_result.
      - now send stmt->flags to server to let him now if we wish to have 
        a cursor for this statement.
      - support for setting/getting statement cursor type.
    libmysqld/examples/Makefile.am:
      Testing cursors was originally implemented in C++. Now when these tests
      go into client_test, it's time to convert it to C++ as well.
    libmysqld/lib_sql.cc:
      - cleanup: send_fields flags are now named.
    sql/ha_innodb.cc:
      - cleanup: send_fields flags are now named.
    sql/mysql_priv.h:
      - cursors support: declaration for server-side handler of COM_FETCH
    sql/protocol.cc:
      - cleanup: send_fields flags are now named.
      - we can't anymore assert that field_types[field_pos] is sensible:
        if we have COM_EXCUTE(stmt1), COM_EXECUTE(stmt2), COM_FETCH(stmt1)
        field_types[field_pos] will point to fields of stmt2.
    sql/protocol.h:
      - cleanup: send_fields flag_s_ are now named.
    sql/protocol_cursor.cc:
      - cleanup: send_fields flags are now named.
    sql/repl_failsafe.cc:
      - cleanup: send_fields flags are now named.
    sql/slave.cc:
      - cleanup: send_fields flags are now named.
    sql/sp.cc:
      - cleanup: send_fields flags are now named.
    sql/sp_head.cc:
      - cleanup: send_fields flags are now named.
    sql/sql_acl.cc:
      - cleanup: send_fields flags are now named.
    sql/sql_class.cc:
      - cleanup: send_fields flags are now named.
    sql/sql_class.h:
      - cleanup: send_fields flags are now named.
    sql/sql_error.cc:
      - cleanup: send_fields flags are now named.
    sql/sql_handler.cc:
      - cleanup: send_fields flags are now named.
    sql/sql_help.cc:
      - cleanup: send_fields flags are now named.
    sql/sql_parse.cc:
      Server side support for cursors:
      - handle COM_FETCH
      - enforce assumption that whenever we free thd->free_list, 
        we reset it to zero. This way it's much easier to handle free_list
        in prepared statements implementation.
    sql/sql_prepare.cc:
      Server side support for cursors:
      - implementation of mysql_stmt_fetch (fetch some rows from open cursor).
      - management of cursors memory is quite tricky now.
      - execute_stmt can't be reused anymore in mysql_stmt_execute and 
        mysql_sql_stmt_execute
    sql/sql_repl.cc:
      - cleanup: send_fields flags are now named.
    sql/sql_select.cc:
      Server side support for cursors:
      - implementation of Cursor::open, Cursor::fetch (buggy when it comes to
        non-equi joins), cursor cleanups.
      - -4 -3 -0 constants indicating return value of sub_select and end_send are
        to be renamed to something more readable:
        it turned out to be not so simple, so it should come with the other patch.
    sql/sql_select.h:
      Server side support for cursors:
      - declaration of Cursor class.
      - JOIN::fetch_limit contains runtime value of rows fetched via cursor.
    sql/sql_show.cc:
      - cleanup: send_fields flags are now named.
    sql/sql_table.cc:
      - cleanup: send_fields flags are now named.
    sql/sql_union.cc:
      - if there was a cursor, don't cleanup unit: we'll need it to fetch
        the rest of the rows.
    tests/Makefile.am:
      Now client_test is in C++.
    tests/client_test.cc:
      A few elementary tests for cursors.
    BitKeeper/etc/ignore:
      Added libmysqld/examples/client_test.cc to the ignore list
    eaf34dd8
protocol.h 6.14 KB