summaryrefslogtreecommitdiff
path: root/sql/sp_head.h
diff options
context:
space:
mode:
authorunknown <dlenev@mysql.com>2004-09-08 13:29:21 +0400
committerunknown <dlenev@mysql.com>2004-09-08 13:29:21 +0400
commitc7fdd6795da0506d588e08f6992a37ebba282f7a (patch)
treea103ef36c1230a085165269c481e5e135b27550d /sql/sp_head.h
parent913c09a140ac099b8da7925d26a65754b0dcfda8 (diff)
parent960c429daa80f59b694036539b2d89b7c836cc6e (diff)
downloadmariadb-git-c7fdd6795da0506d588e08f6992a37ebba282f7a.tar.gz
Merge of changes from the main tree to tree for WL#1218 "Triggers".
sql/item.cc: Auto merged sql/item.h: Auto merged sql/item_func.cc: Auto merged sql/lex.h: Auto merged sql/parse_file.cc: Auto merged sql/sp_head.h: Auto merged sql/sql_base.cc: Auto merged sql/sql_delete.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_lex.h: Auto merged sql/sql_parse.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_update.cc: Auto merged sql/sql_yacc.yy: Auto merged sql/table.h: Auto merged include/mysqld_error.h: Manual merge. sql/mysql_priv.h: Manual merge. sql/share/czech/errmsg.txt: Manual merge. sql/share/danish/errmsg.txt: Manual merge. sql/share/dutch/errmsg.txt: Manual merge. sql/share/english/errmsg.txt: Manual merge. sql/share/estonian/errmsg.txt: Manual merge. sql/share/french/errmsg.txt: Manual merge. sql/share/german/errmsg.txt: Manual merge. sql/share/greek/errmsg.txt: Manual merge. sql/share/hungarian/errmsg.txt: Manual merge. sql/share/italian/errmsg.txt: Manual merge. sql/share/japanese/errmsg.txt: Manual merge. sql/share/korean/errmsg.txt: Manual merge. sql/share/norwegian-ny/errmsg.txt: Manual merge. sql/share/norwegian/errmsg.txt: Manual merge. sql/share/polish/errmsg.txt: Manual merge. sql/share/portuguese/errmsg.txt: Manual merge. sql/share/romanian/errmsg.txt: Manual merge. sql/share/russian/errmsg.txt: Manual merge. sql/share/serbian/errmsg.txt: Manual merge. sql/share/slovak/errmsg.txt: Manual merge. sql/share/spanish/errmsg.txt: Manual merge. sql/share/swedish/errmsg.txt: Manual merge. sql/share/ukrainian/errmsg.txt: Manual merge. sql/sp_head.cc: Manual merge.
Diffstat (limited to 'sql/sp_head.h')
-rw-r--r--sql/sp_head.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/sql/sp_head.h b/sql/sp_head.h
index c0881661ad1..a253d9edcbe 100644
--- a/sql/sp_head.h
+++ b/sql/sp_head.h
@@ -28,6 +28,7 @@
// in the CREATE TABLE command.
#define TYPE_ENUM_FUNCTION 1
#define TYPE_ENUM_PROCEDURE 2
+#define TYPE_ENUM_TRIGGER 3
Item_result
sp_map_result_type(enum enum_field_types type);
@@ -377,6 +378,71 @@ private:
}; // class sp_instr_set : public sp_instr
+/*
+ Set user variable instruction.
+ Used in functions and triggers to set user variables because we don't
+ want use sp_instr_stmt + "SET @a:=..." statement in this case since
+ latter will close all tables and thus will ruin execution of statement
+ calling/invoking this function/trigger.
+*/
+class sp_instr_set_user_var : public sp_instr
+{
+ sp_instr_set_user_var(const sp_instr_set_user_var &);
+ void operator=(sp_instr_set_user_var &);
+
+public:
+
+ sp_instr_set_user_var(uint ip, LEX_STRING var, Item *val)
+ : sp_instr(ip), m_set_var_item(var, val)
+ {}
+
+ virtual ~sp_instr_set_user_var()
+ {}
+
+ virtual int execute(THD *thd, uint *nextp);
+
+ virtual void print(String *str);
+
+private:
+
+ Item_func_set_user_var m_set_var_item;
+}; // class sp_instr_set_user_var : public sp_instr
+
+
+/*
+ Set NEW/OLD row field value instruction. Used in triggers.
+*/
+class sp_instr_set_trigger_field : public sp_instr
+{
+ sp_instr_set_trigger_field(const sp_instr_set_trigger_field &);
+ void operator=(sp_instr_set_trigger_field &);
+
+public:
+
+ sp_instr_set_trigger_field(uint ip, LEX_STRING field_name, Item *val)
+ : sp_instr(ip),
+ trigger_field(Item_trigger_field::NEW_ROW, field_name.str),
+ value(val)
+ {}
+
+ virtual ~sp_instr_set_trigger_field()
+ {}
+
+ virtual int execute(THD *thd, uint *nextp);
+
+ virtual void print(String *str);
+
+ bool setup_field(THD *thd, TABLE *table, enum trg_event_type event)
+ {
+ return trigger_field.setup_field(thd, table, event);
+ }
+private:
+
+ Item_trigger_field trigger_field;
+ Item *value;
+}; // class sp_instr_trigger_field : public sp_instr
+
+
class sp_instr_jump : public sp_instr
{
sp_instr_jump(const sp_instr_jump &); /* Prevent use of these */