InnoDB Plugin  1.0
Data Structures | Enumerations | Functions
row0sel.h File Reference
#include "univ.i"
#include "data0data.h"
#include "que0types.h"
#include "dict0types.h"
#include "trx0types.h"
#include "row0types.h"
#include "pars0sym.h"
#include "btr0pcur.h"
#include "read0read.h"
#include "row0mysql.h"
#include "row0sel.ic"
Include dependency graph for row0sel.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  sel_buf_t
struct  plan_t
struct  sel_node_t
struct  fetch_node_t
struct  open_node_t
struct  row_printf_node_t

Enumerations

enum  sel_node_state { SEL_NODE_CLOSED, SEL_NODE_OPEN, SEL_NODE_FETCH, SEL_NODE_NO_MORE_ROWS }
enum  open_node_op { ROW_SEL_OPEN_CURSOR, ROW_SEL_CLOSE_CURSOR }
enum  row_sel_direction { ROW_SEL_NEXT = 1, ROW_SEL_PREV = 2 }
enum  row_sel_match_mode { ROW_SEL_EXACT = 1, ROW_SEL_EXACT_PREFIX }

Functions

UNIV_INTERN sel_node_tsel_node_create (mem_heap_t *heap)
UNIV_INTERN void sel_node_free_private (sel_node_t *node)
UNIV_INTERN void sel_col_prefetch_buf_free (sel_buf_t *prefetch_buf)
UNIV_INLINE plan_tsel_node_get_nth_plan (sel_node_t *node, ulint i)
UNIV_INTERN que_thr_trow_sel_step (que_thr_t *thr)
UNIV_INLINE que_thr_topen_step (que_thr_t *thr)
UNIV_INTERN que_thr_tfetch_step (que_thr_t *thr)
UNIV_INTERN void * row_fetch_print (void *row, void *user_arg)
UNIV_INTERN que_thr_trow_printf_step (que_thr_t *thr)
UNIV_INTERN void row_sel_convert_mysql_key_to_innobase (dtuple_t *tuple, byte *buf, ulint buf_len, dict_index_t *index, const byte *key_ptr, ulint key_len, trx_t *trx)
UNIV_INTERN dberr_t row_search_for_mysql (byte *buf, ulint mode, row_prebuilt_t *prebuilt, ulint match_mode, ulint direction))
UNIV_INTERN ibool row_search_check_if_query_cache_permitted (trx_t *trx, const char *norm_name)
UNIV_INTERN dberr_t row_search_max_autoinc (dict_index_t *index, const char *col_name, ib_uint64_t *value))

Detailed Description

Select

Created 12/19/1997 Heikki Tuuri

Enumeration Type Documentation

Open or close cursor operation type

Enumerator:
ROW_SEL_OPEN_CURSOR 

open cursor

ROW_SEL_CLOSE_CURSOR 

close cursor

Search direction for the MySQL interface

Enumerator:
ROW_SEL_NEXT 

ascending direction

ROW_SEL_PREV 

descending direction

Match mode for the MySQL interface

Enumerator:
ROW_SEL_EXACT 

search using a complete key value

ROW_SEL_EXACT_PREFIX 

search using a key prefix which must match rows: the prefix may contain an incomplete field (the last field in prefix may be just a prefix of a fixed length column)

Select node states

Enumerator:
SEL_NODE_CLOSED 

it is a declared cursor which is not currently open

SEL_NODE_OPEN 

intention locks not yet set on tables

SEL_NODE_FETCH 

intention locks have been set

SEL_NODE_NO_MORE_ROWS 

cursor has reached the result set end

Function Documentation

UNIV_INTERN que_thr_t* fetch_step ( que_thr_t thr)

Performs a fetch for a cursor.

Returns
query thread to run next or NULL in: query thread
UNIV_INLINE que_thr_t* open_step ( que_thr_t thr)

Performs an execution step of an open or close cursor statement node.

Returns
query thread to run next or NULL in: query thread

Performs an execution step of an open or close cursor statement node.

Returns
query thread to run next or NULL
Parameters
thrin: query thread
UNIV_INTERN void* row_fetch_print ( void *  row,
void *  user_arg 
)

Sample callback function for fetch that prints each row.

Returns
always returns non-NULL in: not used
Parameters
rowin: sel_node_t*
UNIV_INTERN que_thr_t* row_printf_step ( que_thr_t thr)

Prints a row in a select result.

Returns
query thread to run next or NULL in: query thread
UNIV_INTERN ibool row_search_check_if_query_cache_permitted ( trx_t trx,
const char *  norm_name 
)

Checks if MySQL at the moment is allowed for this table to retrieve a consistent read result, or store it to the query cache.

Returns
TRUE if storing or retrieving from the query cache is permitted in: concatenation of database name, '/' char, table name
Parameters
trxin: transaction object
UNIV_INTERN dberr_t row_search_for_mysql ( byte *  buf,
ulint  mode,
row_prebuilt_t prebuilt,
ulint  match_mode,
ulint  direction 
)

Searches for rows in the database. This is used in the interface to MySQL. This function opens a cursor, and also implements fetch next and fetch prev. NOTE that if we do a search with a full key value from a unique index (ROW_SEL_EXACT), then we will not store the cursor position and fetch next or fetch prev must not be tried to the cursor!

Returns
DB_SUCCESS, DB_RECORD_NOT_FOUND, DB_END_OF_INDEX, DB_DEADLOCK, DB_LOCK_TABLE_FULL, or DB_TOO_BIG_RECORD
Parameters
bufin/out: buffer for the fetched row in the MySQL format
modein: search mode PAGE_CUR_L, ...
prebuiltin: prebuilt struct for the table handle; this contains the info of search_tuple, index; if search tuple contains 0 fields then we position the cursor at the start or the end of the index, depending on 'mode'
match_modein: 0 or ROW_SEL_EXACT or ROW_SEL_EXACT_PREFIX
directionin: 0 or ROW_SEL_NEXT or ROW_SEL_PREV; NOTE: if this is != 0, then prebuilt must have a pcur with stored position! In opening of a cursor 'direction' should be 0.
UNIV_INTERN dberr_t row_search_max_autoinc ( dict_index_t index,
const char *  col_name,
ib_uint64_t *  value 
)

Read the max AUTOINC value from an index.

Returns
DB_SUCCESS if all OK else error code
Parameters
indexin: index to search
col_namein: autoinc column name
valueout: AUTOINC value read
UNIV_INTERN void row_sel_convert_mysql_key_to_innobase ( dtuple_t tuple,
byte *  buf,
ulint  buf_len,
dict_index_t index,
const byte *  key_ptr,
ulint  key_len,
trx_t trx 
)

Converts a key value stored in MySQL format to an Innobase dtuple. The last field of the key value may be just a prefix of a fixed length field: hence the parameter key_len. But currently we do not allow search keys where the last field is only a prefix of the full key field len and print a warning if such appears. in: transaction

Parameters
tuplein/out: tuple where to build; NOTE: we assume that the type info in the tuple is already according to index!
bufin: buffer to use in field conversions; NOTE that dtuple->data may end up pointing inside buf so do not discard that buffer while the tuple is being used. See row_mysql_store_col_in_innobase_format() in the case of DATA_INT
buf_lenin: buffer length
indexin: index of the key value
key_ptrin: MySQL key value
key_lenin: MySQL key value length
UNIV_INTERN que_thr_t* row_sel_step ( que_thr_t thr)

Performs a select step. This is a high-level function used in SQL execution graphs.

Returns
query thread to run next or NULL in: query thread
UNIV_INTERN void sel_col_prefetch_buf_free ( sel_buf_t prefetch_buf)

Frees a prefetch buffer for a column, including the dynamically allocated memory for data stored there. in, own: prefetch buffer

UNIV_INTERN sel_node_t* sel_node_create ( mem_heap_t heap)

Creates a select node struct.

Returns
own: select node struct in: memory heap where created
UNIV_INTERN void sel_node_free_private ( sel_node_t node)

Frees the memory private to a select node when a query graph is freed, does not free the heap where the node was originally created. in: select node struct

UNIV_INLINE plan_t* sel_node_get_nth_plan ( sel_node_t node,
ulint  i 
)

Gets the plan node for the nth table in a join.

Returns
plan node in: get ith plan node

Gets the plan node for the nth table in a join.

Returns
plan node
Parameters
nodein: select node
iin: get ith plan node