#include <sp_rcontext.h>
Inheritance diagram for sp_cursor:


Public Member Functions | |
| sp_cursor (sp_lex_keeper *lex_keeper, sp_instr_cpush *i) | |
| virtual | ~sp_cursor () |
| sp_lex_keeper * | get_lex_keeper () |
| int | open (THD *thd) |
| int | close (THD *thd) |
| my_bool | is_open () |
| int | fetch (THD *, List< struct sp_variable > *vars) |
| sp_instr_cpush * | get_instr () |
Private Member Functions | |
| void | destroy () |
Private Attributes | |
| Select_fetch_into_spvars | result |
| sp_lex_keeper * | m_lex_keeper |
| Server_side_cursor * | server_side_cursor |
| sp_instr_cpush * | m_i |
Definition at line 283 of file sp_rcontext.h.
| sp_cursor::sp_cursor | ( | sp_lex_keeper * | lex_keeper, | |
| sp_instr_cpush * | i | |||
| ) |
Definition at line 321 of file sp_rcontext.cc.
References sp_lex_keeper::disable_query_cache().
00322 :m_lex_keeper(lex_keeper), 00323 server_side_cursor(NULL), 00324 m_i(i) 00325 { 00326 /* 00327 currsor can't be stored in QC, so we should prevent opening QC for 00328 try to write results which are absent. 00329 */ 00330 lex_keeper->disable_query_cache(); 00331 }
Here is the call graph for this function:

| virtual sp_cursor::~sp_cursor | ( | ) | [inline, virtual] |
Definition at line 289 of file sp_rcontext.h.
References destroy().
00290 { 00291 destroy(); 00292 }
Here is the call graph for this function:

| int sp_cursor::close | ( | THD * | thd | ) |
Definition at line 363 of file sp_rcontext.cc.
References destroy(), ER, ER_SP_CURSOR_NOT_OPEN, my_message(), MYF, and server_side_cursor.
Referenced by sp_instr_cclose::execute().
00364 { 00365 if (! server_side_cursor) 00366 { 00367 my_message(ER_SP_CURSOR_NOT_OPEN, ER(ER_SP_CURSOR_NOT_OPEN), MYF(0)); 00368 return -1; 00369 } 00370 destroy(); 00371 return 0; 00372 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void sp_cursor::destroy | ( | ) | [private] |
Definition at line 376 of file sp_rcontext.cc.
References server_side_cursor.
Referenced by close(), and ~sp_cursor().
00377 { 00378 delete server_side_cursor; 00379 server_side_cursor= 0; 00380 }
Here is the caller graph for this function:

| int sp_cursor::fetch | ( | THD * | , | |
| List< struct sp_variable > * | vars | |||
| ) |
Definition at line 384 of file sp_rcontext.cc.
References base_list::elements, ER, ER_SP_CURSOR_NOT_OPEN, ER_SP_FETCH_NO_DATA, ER_SP_WRONG_NO_OF_FETCH_ARGS, Server_side_cursor::fetch(), Select_fetch_into_spvars::get_field_count(), Server_side_cursor::is_open(), my_message(), MYF, result, server_side_cursor, and Select_fetch_into_spvars::set_spvar_list().
Referenced by sp_instr_cfetch::execute().
00385 { 00386 if (! server_side_cursor) 00387 { 00388 my_message(ER_SP_CURSOR_NOT_OPEN, ER(ER_SP_CURSOR_NOT_OPEN), MYF(0)); 00389 return -1; 00390 } 00391 if (vars->elements != result.get_field_count()) 00392 { 00393 my_message(ER_SP_WRONG_NO_OF_FETCH_ARGS, 00394 ER(ER_SP_WRONG_NO_OF_FETCH_ARGS), MYF(0)); 00395 return -1; 00396 } 00397 00398 result.set_spvar_list(vars); 00399 00400 /* Attempt to fetch one row */ 00401 if (server_side_cursor->is_open()) 00402 server_side_cursor->fetch(1); 00403 00404 /* 00405 If the cursor was pointing after the last row, the fetch will 00406 close it instead of sending any rows. 00407 */ 00408 if (! server_side_cursor->is_open()) 00409 { 00410 my_message(ER_SP_FETCH_NO_DATA, ER(ER_SP_FETCH_NO_DATA), MYF(0)); 00411 return -1; 00412 } 00413 00414 return 0; 00415 }
Here is the call graph for this function:

Here is the caller graph for this function:

| sp_instr_cpush* sp_cursor::get_instr | ( | ) | [inline] |
Definition at line 313 of file sp_rcontext.h.
References m_i.
Referenced by sp_instr_copen::execute().
00314 { 00315 return m_i; 00316 }
Here is the caller graph for this function:

| sp_lex_keeper* sp_cursor::get_lex_keeper | ( | ) | [inline] |
Definition at line 295 of file sp_rcontext.h.
References m_lex_keeper.
Referenced by sp_instr_copen::execute().
00295 { return m_lex_keeper; }
Here is the caller graph for this function:

| my_bool sp_cursor::is_open | ( | ) | [inline] |
Definition at line 304 of file sp_rcontext.h.
References server_side_cursor, and test.
00305 { 00306 return test(server_side_cursor); 00307 }
| int sp_cursor::open | ( | THD * | thd | ) |
Definition at line 347 of file sp_rcontext.cc.
References ALWAYS_MATERIALIZED_CURSOR, ER, ER_SP_CURSOR_ALREADY_OPEN, my_message(), MYF, mysql_open_cursor(), result, and server_side_cursor.
Referenced by sp_instr_copen::exec_core().
00348 { 00349 if (server_side_cursor) 00350 { 00351 my_message(ER_SP_CURSOR_ALREADY_OPEN, ER(ER_SP_CURSOR_ALREADY_OPEN), 00352 MYF(0)); 00353 return -1; 00354 } 00355 if (mysql_open_cursor(thd, (uint) ALWAYS_MATERIALIZED_CURSOR, &result, 00356 &server_side_cursor)) 00357 return -1; 00358 return 0; 00359 }
Here is the call graph for this function:

Here is the caller graph for this function:

sp_instr_cpush* sp_cursor::m_i [private] |
sp_lex_keeper* sp_cursor::m_lex_keeper [private] |
Select_fetch_into_spvars sp_cursor::result [private] |
Server_side_cursor* sp_cursor::server_side_cursor [private] |
1.4.7

