00001 #ifndef _sql_cursor_h_ 00002 #define _sql_cursor_h_ 00003 /* Copyright (C) 2005 MySQL AB & MySQL Finland AB & TCX DataKonsult AB 00004 00005 This program is free software; you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation; either version 2 of the License, or 00008 (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License 00016 along with this program; if not, write to the Free Software 00017 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ 00018 00019 #ifdef USE_PRAGMA_INTERFACE 00020 #pragma interface /* gcc class interface */ 00021 #endif 00022 00023 /* 00024 Declarations for implementation of server side cursors. Only 00025 read-only non-scrollable cursors are currently implemented. 00026 */ 00027 00028 /* 00029 Server_side_cursor -- an interface for materialized and 00030 sensitive (non-materialized) implementation of cursors. All 00031 cursors are self-contained (created in their own memory root). 00032 For that reason they must be deleted only using a pointer to 00033 Server_side_cursor, not to its base class. 00034 */ 00035 00036 class Server_side_cursor: protected Query_arena, public Sql_alloc 00037 { 00038 protected: 00039 /* Row destination used for fetch */ 00040 select_result *result; 00041 public: 00042 Server_side_cursor(MEM_ROOT *mem_root_arg, select_result *result_arg) 00043 :Query_arena(mem_root_arg, INITIALIZED), result(result_arg) 00044 {} 00045 00046 virtual bool is_open() const= 0; 00047 00048 virtual int open(JOIN *top_level_join)= 0; 00049 virtual void fetch(ulong num_rows)= 0; 00050 virtual void close()= 0; 00051 virtual ~Server_side_cursor(); 00052 00053 static void operator delete(void *ptr, size_t size); 00054 }; 00055 00056 00057 int mysql_open_cursor(THD *thd, uint flags, 00058 select_result *result, 00059 Server_side_cursor **res); 00060 00061 /* Possible values for flags */ 00062 00063 enum { ANY_CURSOR= 1, ALWAYS_MATERIALIZED_CURSOR= 2 }; 00064 00065 #endif /* _sql_cusor_h_ */
1.4.7

