PNG  IHDR* pHYs+ IDATx]n#; cdLb Ǚ[at¤_:uP}>!Usă cag޿ ֵNu`ݼTâabO7uL&y^wFٝA"l[|ŲHLN밪4*sG3|Dv}?+y߉{OuOAt4Jj.u]Gz*҉sP'VQKbA1u\`& Af;HWj hsO;ogTu uj7S3/QzUr&wS`M$X_L7r2;aE+ώ%vikDA:dR+%KzƉo>eOth$z%: :{WwaQ:wz%4foɹE[9<]#ERINƻv溂E%P1i01 |Jvҗ&{b?9g=^wζXn/lK::90KwrюO\!ջ3uzuGv^;騢wq<Iatv09:tt~hEG`v;3@MNZD.1]L:{ծI3`L(÷ba")Y.iljCɄae#I"1 `3*Bdz>j<fU40⨬%O$3cGt]j%Fߠ_twJ;ABU8vP3uEԑwQ V:h%))LfraqX-ۿX]v-\9I gl8tzX ]ecm)-cgʒ#Uw=Wlێn(0hPP/ӨtQ“&J35 $=]r1{tLuǮ*i0_;NƝ8;-vݏr8+U-kruȕYr0RnC]*ެ(M:]gE;{]tg(#ZJ9y>utRDRMdr9㪩̞zֹb<ģ&wzJM"iI( .ꮅX)Qw:9,i좜\Ԛi7&N0:asϓc];=ΗOӣ APqz93 y $)A*kVHZwBƺnWNaby>XMN*45~ղM6Nvm;A=jֲ.~1}(9`KJ/V F9[=`~[;sRuk]rєT!)iQO)Y$V ی ۤmzWz5IM Zb )ˆC`6 rRa}qNmUfDsWuˤV{ Pݝ'=Kֳbg,UҘVz2ﴻnjNgBb{? ߮tcsͻQuxVCIY۠:(V뺕 ٥2;t`@Fo{Z9`;]wMzU~%UA蛚dI vGq\r82iu +St`cR.6U/M9IENDB`/* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ #ifndef _sql_cursor_h_ #define _sql_cursor_h_ #ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class interface */ #endif #include "sql_class.h" /* Query_arena */ class JOIN; /** @file Declarations for implementation of server side cursors. Only read-only non-scrollable cursors are currently implemented. */ /** Server_side_cursor -- an interface for materialized implementation of cursors. All cursors are self-contained (created in their own memory root). For that reason they must be deleted only using a pointer to Server_side_cursor, not to its base class. */ class Server_side_cursor: protected Query_arena { protected: /** Row destination used for fetch */ select_result *result; public: Server_side_cursor(MEM_ROOT *mem_root_arg, select_result *result_arg) :Query_arena(mem_root_arg, STMT_INITIALIZED), result(result_arg) {} virtual bool is_open() const= 0; virtual int open(JOIN *top_level_join)= 0; virtual void fetch(ulong num_rows)= 0; virtual void close()= 0; virtual bool export_structure(THD *thd, Row_definition_list *defs) { DBUG_ASSERT(0); return true; } virtual ~Server_side_cursor(); static void *operator new(size_t size, MEM_ROOT *mem_root) { return alloc_root(mem_root, size); } static void operator delete(void *ptr, size_t size); static void operator delete(void *, MEM_ROOT *){} }; /** Materialized_cursor -- an insensitive materialized server-side cursor. The result set of this cursor is saved in a temporary table at open. The cursor itself is simply an interface for the handler of the temporary table. */ class Materialized_cursor: public Server_side_cursor { MEM_ROOT main_mem_root; /* A fake unit to supply to select_send when fetching */ SELECT_LEX_UNIT fake_unit; TABLE *table; List item_list; ulong fetch_limit; ulong fetch_count; bool is_rnd_inited; public: Materialized_cursor(select_result *result, TABLE *table); int send_result_set_metadata(THD *thd, List &send_result_set_metadata); bool is_open() const override { return table != 0; } int open(JOIN *join __attribute__((unused))) override; void fetch(ulong num_rows) override; void close() override; bool export_structure(THD *thd, Row_definition_list *defs) override { return table->export_structure(thd, defs); } ~Materialized_cursor() override; void on_table_fill_finished(); }; /** Select_materialize -- a mediator between a cursor query and the protocol. In case we were not able to open a non-materialzed cursor, it creates an internal temporary HEAP table, and insert all rows into it. When the table reaches max_heap_table_size, it's converted to a MyISAM table. Later this table is used to create a Materialized_cursor. */ class Select_materialize: public select_unit { select_result *result; /**< the result object of the caller (PS or SP) */ public: Materialized_cursor *materialized_cursor; Select_materialize(THD *thd_arg, select_result *result_arg): select_unit(thd_arg), result(result_arg), materialized_cursor(0) {} bool send_result_set_metadata(List &list, uint flags) override; bool send_eof() override { return false; } bool view_structure_only() const override { return result->view_structure_only(); } }; int mysql_open_cursor(THD *thd, select_result *result, Server_side_cursor **res); #endif /* _sql_cusor_h_ */