<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Trigger on FromDual GmbH</title><link>https://www.fromdual.com/tags/trigger/</link><description>Recent content in Trigger on FromDual GmbH</description><generator>Hugo</generator><language>en-GB</language><managingEditor>oli.sennhauser@fromdual.com (Oli Sennhauser)</managingEditor><webMaster>oli.sennhauser@fromdual.com (Oli Sennhauser)</webMaster><copyright>© FromDual GmbH</copyright><lastBuildDate>Thu, 14 Mar 2024 12:06:39 +0000</lastBuildDate><atom:link href="https://www.fromdual.com/tags/trigger/index.xml" rel="self" type="application/rss+xml"/><item><title>MariaDB/MySQL Stored Language Examples</title><link>https://www.fromdual.com/blog/mariadb-mysql-stored-language-examples/</link><pubDate>Thu, 19 Mar 2020 17:53:29 +0000</pubDate><author>oli.sennhauser@fromdual.com (Oli Sennhauser)</author><guid>https://www.fromdual.com/blog/mariadb-mysql-stored-language-examples/</guid><description>&lt;p&gt;MariaDB/MySQL Stored Language is called &lt;a href="https://en.wikipedia.org/wiki/SQL/PSM" target="_blank" title="SQL/PSM"&gt;SQL/PSM&lt;/a&gt;.&lt;br&gt;
There are 4 different types of Stored Language: Stored Procedures, Stored Functions, Triggers and Events.&lt;/p&gt;</description></item><item><title>Example 1</title><link>https://www.fromdual.com/blog/example-01/</link><pubDate>Fri, 09 Dec 2011 10:07:51 +0000</pubDate><author>oli.sennhauser@fromdual.com (Oli Sennhauser)</author><guid>https://www.fromdual.com/blog/example-01/</guid><description>&lt;pre&gt;&lt;code&gt;CREATE TABLE `order` (
 id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY
, name VARCHAR(64) NOT NULL
) ENGINE = InnoDB;

INSERT INTO `order` VALUES
 (NULL, 'Test order 1')
, (NULL, 'Test order 2')
, (NULL, 'Test order 3');


CREATE TABLE pos (
 id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY
, order_id INT UNSIGNED NOT NULL
, name VARCHAR(64) NOT NULL
, amount SMALLINT NOT NULL
, price DECIMAL (6,2) NOT NULL
, status TINYINT NULL
) ENGINE = InnoDB;

INSERT INTO pos VALUES
 (null, 1, 'Schrauben', 50, 0.10, 0)
, (null, 1, 'Muttern', 50, 0.10, 0)
, (null, 2, 'Nägel', 1000, 0.05, 1);


CREATE TABLE pos_shadow LIKE pos;
ALTER TABLE pos_shadow ENGINE = MEMORY;
INSERT INTO pos_shadow SELECT * FROM pos;

delimiter //

CREATE TRIGGER upd BEFORE UPDATE ON pos
FOR EACH ROW
BEGIN
 UPDATE pos_shadow AS p
 JOIN `order` AS o ON o.id = p.order_id and o.id = NEW.order_id
 SET status = 1
 WHERE o.id = 1;
END;
//

delimiter ;

SELECT o.name, p.name, p.amount, p.price, (p.amount*p.price) AS total, p. status
 FROM `order` AS o
 JOIN pos_shadow AS p ON p.order_id = o.id
;

UPDATE pos AS p
 JOIN `order` AS o ON o.id = p.order_id AND o.id = 1
 SET p.status = 1, p.order_id = 1
 where o.id = 1;

SELECT o.name, p.name, p.amount, p.price, (p.amount*p.price) AS total, p. status
 FROM `order` AS o
 JOIN pos AS p on p.order_id = o.id
;
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>How good is MySQL INSERT TRIGGER performance</title><link>https://www.fromdual.com/blog/how-good-is-mysql-insert-trigger-performance/</link><pubDate>Wed, 03 Aug 2011 17:08:36 +0000</pubDate><author>oli.sennhauser@fromdual.com (Oli Sennhauser)</author><guid>https://www.fromdual.com/blog/how-good-is-mysql-insert-trigger-performance/</guid><description>&lt;p&gt;&lt;strong&gt;Abstract:&lt;/strong&gt; In this article we discuss how big is the performance impact of MySQL &lt;code&gt;TRIGGER&lt;/code&gt;s compared to application side logging (with &lt;code&gt;INSERT&lt;/code&gt;) into a MySQL table.&lt;/p&gt;</description></item><item><title>MySQL logon and logoff trigger for auditing</title><link>https://www.fromdual.com/blog/mysql-logon-and-logoff-trigger-for-auditing/</link><pubDate>Fri, 10 Dec 2010 23:23:51 +0000</pubDate><author>oli.sennhauser@fromdual.com (Oli Sennhauser)</author><guid>https://www.fromdual.com/blog/mysql-logon-and-logoff-trigger-for-auditing/</guid><description>&lt;p&gt;&lt;a href="https://www.fromdual.com/mysql-logon-trigger"&gt;A while ago&lt;/a&gt; I did some research about MySQL audit functionality and logon a and logoff triggers. MySQL and MariaDB provide a logon trigger in the form of the init_connect variable but no logoff trigger where most of the work for auditing would be done. When we would have a logoff trigger we could track the login and possibility some activity of a user and implement auditing functionality.&lt;/p&gt;</description></item><item><title>MySQL Server Error Codes and Messages 1450 - 1499</title><link>https://www.fromdual.com/blog/mysql-error-codes-and-messages-1450-1499/</link><pubDate>Mon, 06 Dec 2010 11:51:27 +0000</pubDate><author>oli.sennhauser@fromdual.com (Oli Sennhauser)</author><guid>https://www.fromdual.com/blog/mysql-error-codes-and-messages-1450-1499/</guid><description>&lt;p&gt;&lt;a href="https://www.fromdual.com/mysql-error-codes-and-messages-1400-1449"&gt;1400 - 1449&lt;/a&gt; &lt;a href="https://www.fromdual.com/mysql-error-codes-and-messages-1500-1549"&gt;1500 - 1549&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;span id="error_er_forbid_schema_change"&gt;&lt;/span&gt; Error: 1450 SQLSTATE: HY000 (&lt;a href="https://www.fromdual.com/blog/mysql-error-codes-and-messages-1450-1499/#error_er_forbid_schema_change"&gt;ER_FORBID_SCHEMA_CHANGE&lt;/a&gt;)&lt;/p&gt;</description></item><item><title>MySQL Server Error Codes and Messages 1400 - 1449</title><link>https://www.fromdual.com/blog/mysql-error-codes-and-messages-1400-1449/</link><pubDate>Mon, 06 Dec 2010 11:50:26 +0000</pubDate><author>oli.sennhauser@fromdual.com (Oli Sennhauser)</author><guid>https://www.fromdual.com/blog/mysql-error-codes-and-messages-1400-1449/</guid><description>&lt;p&gt;&lt;a href="https://www.fromdual.com/mysql-error-codes-and-messages-1350-1399"&gt;1350 - 1399&lt;/a&gt; &lt;a href="https://www.fromdual.com/mysql-error-codes-and-messages-1450-1499"&gt;1450 - 1499&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;span id="error_er_xaer_outside"&gt;&lt;/span&gt; Error: 1400 SQLSTATE: XAE09 (&lt;a href="https://www.fromdual.com/blog/mysql-error-codes-and-messages-1400-1449/#error_er_xaer_outside"&gt;ER_XAER_OUTSIDE&lt;/a&gt;)&lt;/p&gt;</description></item><item><title>MySQL Server Error Codes and Messages 1350 - 1399</title><link>https://www.fromdual.com/blog/mysql-error-codes-and-messages-1350-1399/</link><pubDate>Mon, 06 Dec 2010 11:49:09 +0000</pubDate><author>oli.sennhauser@fromdual.com (Oli Sennhauser)</author><guid>https://www.fromdual.com/blog/mysql-error-codes-and-messages-1350-1399/</guid><description>&lt;p&gt;&lt;a href="https://www.fromdual.com/mysql-error-codes-and-messages-1300-1349"&gt;1300 - 1349&lt;/a&gt; &lt;a href="https://www.fromdual.com/mysql-error-codes-and-messages-1400-1449"&gt;1400 - 1449&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;span id="error_er_view_select_clause"&gt;&lt;/span&gt; Error: 1350 SQLSTATE: HY000 (&lt;a href="https://www.fromdual.com/blog/mysql-error-codes-and-messages-1350-1399/#error_er_view_select_clause"&gt;ER_VIEW_SELECT_CLAUSE&lt;/a&gt;)&lt;/p&gt;</description></item><item><title>Materialized Views with MySQL</title><link>https://www.fromdual.com/blog/mysql-materialized-views/</link><pubDate>Sat, 13 Mar 2010 13:55:05 +0000</pubDate><author>oli.sennhauser@fromdual.com (Oli Sennhauser)</author><guid>https://www.fromdual.com/blog/mysql-materialized-views/</guid><description>&lt;h2 id="table-of-contents"&gt;Table of Contents&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.fromdual.com/blog/mysql-materialized-views/#what_is"&gt;What is a Materialized View?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.fromdual.com/blog/mysql-materialized-views/#implement"&gt;Implement your own Materialized Views&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.fromdual.com/blog/mysql-materialized-views/#refreshing"&gt;Refreshing materialized views&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.fromdual.com/blog/mysql-materialized-views/#hands_on"&gt;Hands on&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.fromdual.com/blog/mysql-materialized-views/#create_your_own"&gt;Create your own Materialized View:&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.fromdual.com/blog/mysql-materialized-views/#refresh_on_demand"&gt;Refresh Materialized View on demand&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.fromdual.com/blog/mysql-materialized-views/#refresh_immediate"&gt;Refresh Materialized View immediate&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.fromdual.com/blog/mysql-materialized-views/#snapshotting"&gt;Materialized Views with snapshotting functionality&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.fromdual.com/blog/mysql-materialized-views/#benchmarks"&gt;Some performance benchmarks for our Materialized Views:&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.fromdual.com/blog/mysql-materialized-views/#outlook"&gt;Outlook&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.fromdual.com/blog/mysql-materialized-views/#conclusion"&gt;Conclusion&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.fromdual.com/blog/mysql-materialized-views/#literature"&gt;Literature&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span id="what_is"&gt;&lt;/span&gt;&lt;/p&gt;</description></item><item><title>MySQL logon trigger</title><link>https://www.fromdual.com/blog/mysql-logon-trigger/</link><pubDate>Fri, 25 May 2007 17:06:00 +0000</pubDate><author>oli.sennhauser@fromdual.com (Oli Sennhauser)</author><guid>https://www.fromdual.com/blog/mysql-logon-trigger/</guid><description>&lt;p&gt;With MySQL 5.0 the database provides trigger functionality on &lt;code&gt;INSERT&lt;/code&gt;, &lt;code&gt;REPLACE&lt;/code&gt;, &lt;code&gt;UPDATE&lt;/code&gt; and &lt;code&gt;DELETE&lt;/code&gt;.&lt;/p&gt;</description></item></channel></rss>