You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
2.0 KiB

  1. /* Copyright (C) 2005 MySQL AB
  2. This program is free software; you can redistribute it and/or modify
  3. it under the terms of the GNU General Public License as published by
  4. the Free Software Foundation; version 2 of the License.
  5. This program is distributed in the hope that it will be useful,
  6. but WITHOUT ANY WARRANTY; without even the implied warranty of
  7. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  8. GNU General Public License for more details.
  9. You should have received a copy of the GNU General Public License
  10. along with this program; if not, write to the Free Software
  11. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
  12. #ifndef _sql_cursor_h_
  13. #define _sql_cursor_h_
  14. #ifdef USE_PRAGMA_INTERFACE
  15. #pragma interface /* gcc class interface */
  16. #endif
  17. /**
  18. @file
  19. Declarations for implementation of server side cursors. Only
  20. read-only non-scrollable cursors are currently implemented.
  21. */
  22. /**
  23. Server_side_cursor -- an interface for materialized and
  24. sensitive (non-materialized) implementation of cursors. All
  25. cursors are self-contained (created in their own memory root).
  26. For that reason they must be deleted only using a pointer to
  27. Server_side_cursor, not to its base class.
  28. */
  29. class Server_side_cursor: protected Query_arena, public Sql_alloc
  30. {
  31. protected:
  32. /** Row destination used for fetch */
  33. select_result *result;
  34. public:
  35. Server_side_cursor(MEM_ROOT *mem_root_arg, select_result *result_arg)
  36. :Query_arena(mem_root_arg, INITIALIZED), result(result_arg)
  37. {}
  38. virtual bool is_open() const= 0;
  39. virtual int open(JOIN *top_level_join)= 0;
  40. virtual void fetch(ulong num_rows)= 0;
  41. virtual void close()= 0;
  42. virtual ~Server_side_cursor();
  43. static void operator delete(void *ptr, size_t size);
  44. };
  45. int mysql_open_cursor(THD *thd, uint flags,
  46. select_result *result,
  47. Server_side_cursor **res);
  48. /** Possible values for flags */
  49. enum { ANY_CURSOR= 1, ALWAYS_MATERIALIZED_CURSOR= 2 };
  50. #endif /* _sql_cusor_h_ */