/**************************************************//**
@file eval/eval0eval.cc
SQL evaluator: evaluates simple data structures, like expressions, in
a query graph
Created 12/29/1997 Heikki Tuuri
*******************************************************/
/** Dummy adress used when we should allocate a buffer of size 0 in
eval_node_alloc_val_buf */
static byte eval_dummy;
/*************************************************************************
Gets the like node from the node */
UNIV_INLINE
que_node_t*
que_node_get_like_node( /*===================*/ /* out: next node in a list of nodes */
que_node_t* node) /* in: node in a list */
{ return(((sym_node_t*) node)->like_node);
}
/*****************************************************************//**
Allocate a buffer from global dynamic memory for a value of a que_node.
NOTE that this memory must be explicitly freed when the query graph is
freed. If the node already has an allocated buffer, that buffer is freed
here. NOTE that this is the only function where dynamic memory should be
allocated for a query node val field.
@return pointer to allocated buffer */
byte*
eval_node_alloc_val_buf( /*====================*/
que_node_t* node, /*!< in: query graph node; sets the val field datafieldtopointtothenewbuffer,and
len field equal to size */
ulint size) /*!< in: buffer size */
{
dfield_t* dfield;
byte* data;
data = static_cast<byte*>(dfield_get_data(dfield));
if (data != &eval_dummy) {
ut_free(data);
}
if (size == 0) {
data = &eval_dummy;
} else {
data = static_cast<byte*>(ut_malloc_nokey(size));
}
que_node_set_val_buf_size(node, size);
dfield_set_data(dfield, data, size);
return(data);
}
/*****************************************************************//**
Free the buffer from global dynamic memory for a value of a que_node, if it has been allocated in the above function. The freeing for pushed
column values is done in sel_col_prefetch_buf_free. */ void
eval_node_free_val_buf( /*===================*/
que_node_t* node) /*!< in: query graph node */
{
dfield_t* dfield;
byte* data;
switch (cmp_node->func) { case'<': case'=': case'>': case PARS_LE_TOKEN: case PARS_NE_TOKEN: case PARS_GE_TOKEN:
res = cmp_dfield_dfield(
que_node_get_val(arg1), que_node_get_val(arg2));
switch (cmp_node->func) { case'<':
val = (res < 0); break; case'=':
val = (res == 0); break; case'>':
val = (res > 0); break; case PARS_LE_TOKEN:
val = (res <= 0); break; case PARS_NE_TOKEN:
val = (res != 0); break; case PARS_GE_TOKEN:
val = (res >= 0); break;
} break; default:
val = eval_cmp_like(arg1, arg2); break;
}
/*****************************************************************//**
Evaluates a predefined function node. If the first argument is an integer, this function looks at the second argument which is the integer length in
bytes, and converts the integer to a VARCHAR. If the first argument is of some other type, this function converts it to
BINARY. */
UNIV_INLINE void
eval_to_binary( /*===========*/
func_node_t* func_node) /*!< in: function node */
{
que_node_t* arg1;
que_node_t* arg2;
dfield_t* dfield;
byte* str1;
ulint len;
ulint len1;
switch (fclass) { case PARS_FUNC_CMP:
eval_cmp(func_node); return; case PARS_FUNC_ARITH:
eval_arith(func_node); return; case PARS_FUNC_AGGREGATE:
eval_aggregate(func_node); return; case PARS_FUNC_PREDEFINED: switch (func) { case PARS_NOTFOUND_TOKEN:
eval_notfound(func_node); return; case PARS_SUBSTR_TOKEN:
eval_substr(func_node); return; case PARS_INSTR_TOKEN:
eval_instr(func_node); return; case PARS_CONCAT_TOKEN:
eval_concat(func_node); return; case PARS_TO_BINARY_TOKEN:
eval_to_binary(func_node); return; case PARS_LENGTH_TOKEN:
eval_length(func_node); return; default:
ut_error;
} case PARS_FUNC_LOGICAL:
eval_logical(func_node); return;
}
ut_error;
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.19 Sekunden
(vorverarbeitet am 2026-10-08)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.