summaryrefslogtreecommitdiff
path: root/sql/item.h
diff options
context:
space:
mode:
Diffstat (limited to 'sql/item.h')
-rw-r--r--sql/item.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/sql/item.h b/sql/item.h
index 1b5fafc180f..8009439b708 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -123,6 +123,8 @@ public:
bool set_charset(CHARSET_INFO *cs1, enum coercion co1,
CHARSET_INFO *cs2, enum coercion co2);
virtual void set_outer_resolving() {}
+ virtual Item *this_item() { return this; } /* For SPs mostly. */
+ virtual Item *this_const_item() const { return const_cast<Item*>(this); } /* For SPs mostly. */
// Row emulation
virtual uint cols() { return 1; }
@@ -136,6 +138,57 @@ public:
};
+// A local SP variable (incl. parameters), used in runtime
+class Item_splocal : public Item
+{
+private:
+
+ uint m_offset;
+
+public:
+
+ Item_splocal(uint offset)
+ : m_offset(offset)
+ {}
+
+ Item *this_item();
+ Item *this_const_item() const;
+
+ inline uint get_offset()
+ {
+ return m_offset;
+ }
+
+ // Abstract methods inherited from Item. Just defer the call to
+ // the item in the frame
+ inline enum Type type() const
+ {
+ return this_const_item()->type();
+ }
+
+ inline double val()
+ {
+ return this_item()->val();
+ }
+
+ inline longlong val_int()
+ {
+ return this_item()->val_int();
+ }
+
+ inline String *val_str(String *sp)
+ {
+ return this_item()->val_str(sp);
+ }
+
+ inline void make_field(Send_field *field)
+ {
+ this_item()->make_field(field);
+ }
+
+};
+
+
class st_select_lex;
class Item_ident :public Item
{