You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

114 lines
3.7 KiB

  1. /*****************************************************************************
  2. Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved.
  3. This program is free software; you can redistribute it and/or modify it under
  4. the terms of the GNU General Public License as published by the Free Software
  5. Foundation; version 2 of the License.
  6. This program is distributed in the hope that it will be useful, but WITHOUT
  7. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  8. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  9. You should have received a copy of the GNU General Public License along with
  10. this program; if not, write to the Free Software Foundation, Inc., 59 Temple
  11. Place, Suite 330, Boston, MA 02111-1307 USA
  12. *****************************************************************************/
  13. /**************************************************//**
  14. @file include/eval0eval.h
  15. SQL evaluator: evaluates simple data structures, like expressions, in
  16. a query graph
  17. Created 12/29/1997 Heikki Tuuri
  18. *******************************************************/
  19. #ifndef eval0eval_h
  20. #define eval0eval_h
  21. #include "univ.i"
  22. #include "que0types.h"
  23. #include "pars0sym.h"
  24. #include "pars0pars.h"
  25. /*****************************************************************//**
  26. Free the buffer from global dynamic memory for a value of a que_node,
  27. if it has been allocated in the above function. The freeing for pushed
  28. column values is done in sel_col_prefetch_buf_free. */
  29. UNIV_INTERN
  30. void
  31. eval_node_free_val_buf(
  32. /*===================*/
  33. que_node_t* node); /*!< in: query graph node */
  34. /*****************************************************************//**
  35. Evaluates a symbol table symbol. */
  36. UNIV_INLINE
  37. void
  38. eval_sym(
  39. /*=====*/
  40. sym_node_t* sym_node); /*!< in: symbol table node */
  41. /*****************************************************************//**
  42. Evaluates an expression. */
  43. UNIV_INLINE
  44. void
  45. eval_exp(
  46. /*=====*/
  47. que_node_t* exp_node); /*!< in: expression */
  48. /*****************************************************************//**
  49. Sets an integer value as the value of an expression node. */
  50. UNIV_INLINE
  51. void
  52. eval_node_set_int_val(
  53. /*==================*/
  54. que_node_t* node, /*!< in: expression node */
  55. lint val); /*!< in: value to set */
  56. /*****************************************************************//**
  57. Gets an integer value from an expression node.
  58. @return integer value */
  59. UNIV_INLINE
  60. lint
  61. eval_node_get_int_val(
  62. /*==================*/
  63. que_node_t* node); /*!< in: expression node */
  64. /*****************************************************************//**
  65. Copies a binary string value as the value of a query graph node. Allocates a
  66. new buffer if necessary. */
  67. UNIV_INLINE
  68. void
  69. eval_node_copy_and_alloc_val(
  70. /*=========================*/
  71. que_node_t* node, /*!< in: query graph node */
  72. const byte* str, /*!< in: binary string */
  73. ulint len); /*!< in: string length or UNIV_SQL_NULL */
  74. /*****************************************************************//**
  75. Copies a query node value to another node. */
  76. UNIV_INLINE
  77. void
  78. eval_node_copy_val(
  79. /*===============*/
  80. que_node_t* node1, /*!< in: node to copy to */
  81. que_node_t* node2); /*!< in: node to copy from */
  82. /*****************************************************************//**
  83. Gets a iboolean value from a query node.
  84. @return iboolean value */
  85. UNIV_INLINE
  86. ibool
  87. eval_node_get_ibool_val(
  88. /*====================*/
  89. que_node_t* node); /*!< in: query graph node */
  90. /*****************************************************************//**
  91. Evaluates a comparison node.
  92. @return the result of the comparison */
  93. UNIV_INTERN
  94. ibool
  95. eval_cmp(
  96. /*=====*/
  97. func_node_t* cmp_node); /*!< in: comparison node */
  98. #ifndef UNIV_NONINL
  99. #include "eval0eval.ic"
  100. #endif
  101. #endif