mariadb/innobase/include/row0sel.ic

89 lines
1.9 KiB
Text
Raw Normal View History

/******************************************************
Select
(c) 1997 Innobase Oy
Created 12/19/1997 Heikki Tuuri
*******************************************************/
#include "que0que.h"
/*************************************************************************
Gets the plan node for the nth table in a join. */
UNIV_INLINE
plan_t*
sel_node_get_nth_plan(
/*==================*/
/* out: plan node */
sel_node_t* node, /* in: select node */
ulint i) /* in: get ith plan node */
{
ut_ad(i < node->n_tables);
return(node->plans + i);
}
/*************************************************************************
Resets the cursor defined by sel_node to the SEL_NODE_OPEN state, which means
that it will start fetching from the start of the result set again, regardless
of where it was before, and it will set intention locks on the tables. */
UNIV_INLINE
void
sel_node_reset_cursor(
/*==================*/
sel_node_t* node) /* in: select node */
{
node->state = SEL_NODE_OPEN;
}
/**************************************************************************
Performs an execution step of an open or close cursor statement node. */
UNIV_INLINE
que_thr_t*
open_step(
/*======*/
/* out: query thread to run next or NULL */
que_thr_t* thr) /* in: query thread */
{
sel_node_t* sel_node;
open_node_t* node;
ulint err;
ut_ad(thr);
node = thr->run_node;
ut_ad(que_node_get_type(node) == QUE_NODE_OPEN);
sel_node = node->cursor_def;
err = DB_SUCCESS;
if (node->op_type == ROW_SEL_OPEN_CURSOR) {
/* if (sel_node->state == SEL_NODE_CLOSED) { */
sel_node_reset_cursor(sel_node);
/* } else {
err = DB_ERROR;
} */
} else {
if (sel_node->state != SEL_NODE_CLOSED) {
sel_node->state = SEL_NODE_CLOSED;
} else {
err = DB_ERROR;
}
}
if (err != DB_SUCCESS) {
/* SQL error detected */
Merge with 4.0 innobase/dict/dict0boot.c: Auto merged innobase/dict/dict0load.c: Auto merged innobase/dict/dict0mem.c: Auto merged innobase/fut/fut0lst.c: Auto merged innobase/include/buf0lru.h: Auto merged innobase/include/dict0mem.h: Auto merged innobase/include/fsp0fsp.h: Auto merged innobase/include/ha0ha.h: Auto merged innobase/include/ibuf0ibuf.h: Auto merged innobase/include/lock0lock.h: Auto merged innobase/include/log0log.h: Auto merged innobase/include/mem0pool.h: Auto merged innobase/include/mtr0mtr.h: Auto merged innobase/include/os0file.h: Auto merged innobase/include/rem0rec.h: Auto merged innobase/include/rem0rec.ic: Auto merged innobase/include/srv0srv.h: Auto merged innobase/include/sync0sync.h: Auto merged innobase/include/trx0sys.h: Auto merged innobase/include/ut0byte.h: Auto merged innobase/include/ut0ut.h: Auto merged innobase/mem/mem0pool.c: Auto merged innobase/mtr/mtr0mtr.c: Auto merged innobase/os/os0proc.c: Auto merged innobase/pars/lexyy.c: Auto merged innobase/pars/pars0opt.c: Auto merged innobase/row/row0ins.c: Auto merged innobase/row/row0purge.c: Auto merged innobase/row/row0uins.c: Auto merged innobase/row/row0umod.c: Auto merged innobase/row/row0undo.c: Auto merged innobase/row/row0upd.c: Auto merged innobase/trx/trx0purge.c: Auto merged innobase/trx/trx0roll.c: Auto merged innobase/trx/trx0sys.c: Auto merged innobase/trx/trx0undo.c: Auto merged innobase/ut/ut0byte.c: Auto merged pstack/bucomm.h: Auto merged pstack/budbg.h: Auto merged sql/item_sum.h: Auto merged sql/slave.cc: Auto merged sql/sql_db.cc: Auto merged support-files/mysql.spec.sh: Auto merged tests/insert_test.c: Auto merged mysql-test/t/func_group.test: Merge with 4.0 Put 4.1 tests lasts sql/ha_innodb.cc: Merge with 4.0 Added checking of results from my_malloc() BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
2004-04-26 14:53:31 +02:00
fprintf(stderr, "SQL error %lu\n", (ulong) err);
ut_error;
}
thr->run_node = que_node_get_parent(node);
return(thr);
}