Ingeniero Informática

Páginas: 7 (1583 palabras) Publicado: 29 de septiembre de 2012
MySQL 5.0 Triggers
MySQL 5.0 New Features Series – Part 2

A MySQL® Technical White Paper
Peter Gulutzan
March, 2005

Copyright © 2005, MySQL AB

Table of Contents
Introduction ....................................................................................................3 Conventions and Styles.............................................................................3 WhyTriggers ..................................................................................................3 1. 2. 3. 4. 5. 6. Syntax: Name.....................................................................................4 Syntax: Time.......................................................................................5 Syntax: Event.....................................................................................5 Syntax: Table......................................................................................5 Syntax: Granularity.............................................................................5 Syntax: Statement..............................................................................6

Privileges........................................................................................................6 Referring to OLD and NEW columns ........................................................6 Example of CREATE and INSERT............................................................7 Example of a “check” constraint ................................................................7Conclusion......................................................................................................9 About MySQL .................................................................................................9

Copyright © 2005, MySQL AB

Page 2

Introduction
This book is for long-time MySQL users who want to know "what's new" in version 5. The short answer is "stored procedures, triggers, views, information_schema". The long answer is the “MySQL 5.0 NewFeatures” series, and this book is the second in the series. What I'm hoping to do is make this look like a hands-on session where you, as if you're working it out yourself on your keyboard, can walk through sample problems. To do this, I'll go through each little item, building up slowly. By the end, I'll be showing larger routines that do something useful, something that you might have thoughtwas tough.

Conventions and Styles
Whenever I want to show actual code, such as something that comes directly from the screen of my mysql client program, I switch to a Courier font, which looks different from the regular text font. For example: mysql> DROP FUNCTION f; Query OK, 0 rows affected (0.00 sec) When the example is large and I want to draw attention to a particular line or phrase, Ihighlight it with a double underline and a small arrow on the right of the page. For example: mysql> CREATE PROCEDURE p () -> BEGIN -> /* This procedure does nothing */ -> END;// Query OK, 0 rows affected (0.00 sec)

” and “->” prompts so that you can cut the examples and paste them into your copy of the mysql client program. (If you aren't reading the text of this book in a machine-readable form,try looking for the script on the mysql.com web site.) I tested all the examples with the publicly-available alpha version of MySQL 5.0.3 on Linux, SUSE 9.2. By the time you read this, the version number will be higher and the available operating systems will include Windows, Sparc, and HP-UX. So I'm confident that you'll be able to run every example on your computer. But if not, well, as anexperienced MySQL user you know that help and support is always available.

Why Triggers
We are including support for triggers in MySQL 5.0 for these reasons: • Users of earlier MySQL versions kept on telling us they wanted triggers. • We have a commitment to support all ANSI-standard features. • You can use them to check for, and prevent, bad data entering the database. • You can change or...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Ingeniero en informatica
  • ingeniero informatico
  • ingeniero informatico
  • Ingeniero en Informatica , ingeniero en Electrònica
  • Ingeniero Informatico
  • Ingeniero Informatico
  • Ingeniero informatico
  • Ingeniero De Informatica

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS