SlideShare ist ein Scribd-Unternehmen logo
1 von 42
Downloaden Sie, um offline zu lesen
Amsterdam, June 16 2007
      ● MySQL: Quick Introduction
      ● MySQL Stored Routines for PHP developers
      ● Questions and Discussion




Copyright 2007 MySQL AB                The World’s Most Popular Open Source Database   1
Roland Bouman (rpbouman.blogspot.com)
      Certification Developer
      MySQL AB, Leiden

      ● MySQL Community Contributor since 2005
      ● Joined MySQL AB in July 2006
             ● Certification Developer:
                   ● MySQL 5.1 Cluster DBA exam (CMCDBA)
                   ● MySQL Associate exam (CMA)
             ● Attained:
                   ● CMDEV
                   ● CMDBA
      ● Formerly: Consultant & Application Developer
        (mostly Oracle, some MS SQL)


Copyright 2007 MySQL AB                             The World’s Most Popular Open Source Database   2
Amsterdam, June 16 2007
      ● MySQL: Quick Introduction
      ● MySQL Stored Routines for PHP developers
      ● Questions and Discussion




Copyright 2007 MySQL AB                The World’s Most Popular Open Source Database   3
MySQL: Quick Introduction


      ● MySQL Software Products
             ●   RDBMS (Database)
             ●   Monitoring and Advisory Service
             ●   Drivers and APIs
             ●   Client (GUI) Tools & Utilities
      ● MySQL Professional Services
             ●   Technical Support
             ●   Consulting
             ●   Training
             ●   Certification
             ●   Indemnification



Copyright 2007 MySQL AB                            The World’s Most Popular Open Source Database   4
MySQL Open Source RDBMS Products

      ● Generally Available, Stable Releases
             ● MySQL 5.0 Server Community Edition
                   ● Patches from community
             ● MySQL 5.0 Server Enterprise Edition
                   ● Stablility and Robustness, Early Bugfixes
                   ● Monitoring and Advisory Service
                   ● Binaries
      ● Development Releases:
             ● MySQL 5.1 (New: Events, Partitioning)
             ● MySQL 6.0 (New: Falcon)
      ● Other RDBMS Products:
             ● MySQL Cluster / Carrier Grade Edition
             ● Embedded
             ● MaxDB (SAP Certified)
Copyright 2007 MySQL AB                                    The World’s Most Popular Open Source Database   5
MySQL Monitoring and Advisory Service




Copyright 2007 MySQL AB          The World’s Most Popular Open Source Database   6
MySQL Drivers and APIs

      ● For PHP
             ● ext/mysql: “MySQL Functions”
             ● ext/mysqli: “MySQL Improved Extension”
             ● mysqlnd: “MySQL native driver for PHP”
                   ● Beta 5.
                   ● Built Into PHP 5; PHP 6
                   ● Replaces libmysql
      ● Other:
             ● ODBC: Connector/ODBC
             ● JDBC: Connector/J
             ● ADO.NET: Connector/.NET




Copyright 2007 MySQL AB                           The World’s Most Popular Open Source Database   7
Amsterdam, June 16 2007
      ● MySQL: Quick Introduction
      ● MySQL Stored Routines for PHP developers
      ● Questions and Discussion




Copyright 2007 MySQL AB                The World’s Most Popular Open Source Database   8
MySQL Stored Routines


      ●    Overview of MySQL Stored Routines
      ●    MySQL Stored Routine Language
      ●    PHP Techniques
      ●    Use cases
      ●    Best Practices




Copyright 2007 MySQL AB                  The World’s Most Popular Open Source Database   9
MySQL Stored Routines
      ● Overview of MySQL Stored Routines:
             ● Terminology, Purpose, Application
      ● MySQL Stored Routine Language
             ● Block Structure, Parameters and Variables, Flow Control
               Constructs, SQL inside stored routines.
      ● PHP Techniques
             ● Creating and Calling Stored Procedures, Processing
               Result set, Handling Multiple Result sets.
      ● Use cases
      ● Best Practices
             ● What to do on the client, and what on the server
             ● What to do in PHP, and what in Stored Routines.
             ● Performance: how MySQL Stored Routines can help or
               hurt performance.

Copyright 2007 MySQL AB                            The World’s Most Popular Open Source Database   10
MySQL Stored Routines: Overview
      ● Programs as Database Schema Objects
             ● Executed in-process with the Database
      ● Types of Stored Routines:
             ●   Procedures
             ●   Functions
             ●   Triggers
             ●   Events (Temporal triggers; new in MySQL 5.1)
      ● Language:
             ● Subset of Standard SQL:2003 SQL/PSM
             ● Procedural, Block structured
             ● Do not confuse with User Defined Functions (UDF)!
      ● Available as of MySQL 5.0 (October 2005)



Copyright 2007 MySQL AB                             The World’s Most Popular Open Source Database   11
MySQL Stored Routine Types: Overview
      ● Stored Procedures & Functions
             ●   Encapsulate tasks or Calculations for reuse
             ●   Single point of definition for Business Logic
             ●   Source Safely stored and backed up
             ●   Added layer of Security
      ● Triggers
             ●   Data-Driven
             ●   Enforce Data quality through Basic validation
             ●   Enforce complex Business Rules
             ●   Automatically Update Aggregate tables
      ● Events (MySQL Server 5.1 beta)
             ● Schedule Code Execution in time.
             ● Use instead of cron or windows event scheduler
             ● Automatically Update Aggregate tables

Copyright 2007 MySQL AB                                 The World’s Most Popular Open Source Database   12
MySQL Stored Routines: Purpose / Advantages
      ● Performance
             ● Save network roundtrips, lower latency
      ● Portability and Reuse
             ● Single point of definition
             ● Reusable from many application contexts
      ● Security
             ● DEFINER versus INVOKER
             ● Grant only Execution Privilege
      ● Ease of Maintenance
             ● Code stored in the database
             ● Browse using information_schema database
      ● 'Headless' administrative tasks
             ● No additional runtime environment required


Copyright 2007 MySQL AB                             The World’s Most Popular Open Source Database   13
MySQL Stored Routines: Caveat / Disadvantages
      ● Performance
             ● Overhead may result in higher latency
             ● Increased usage of database server computing power may
               negatively affect throughput
      ● Portability and Reuse
             ● Which point of view?
                   ● Database portability ?
                   ● Or Application portability?




Copyright 2007 MySQL AB                            The World’s Most Popular Open Source Database   14
MySQL Stored Routines
      ● Overview of MySQL Stored Routines:
             ● Terminology, Purpose, Application
      ● MySQL Stored Routine Language
             ● Block Structure, Parameters and Variables, Flow Control
               Constructs, SQL inside stored routines.
      ● PHP Techniques
             ● Creating and Calling Stored Procedures, Processing
               Result set, Handling Multiple Result sets.
      ● Use cases
      ● Best Practices
             ● What to do on the client, and what on the server
             ● What to do in PHP, and what in Stored Routines.
             ● How MySQL Stored Routines can help or hurt
               performance.

Copyright 2007 MySQL AB                             The World’s Most Popular Open Source Database   15
MySQL Stored Routine Language
      ● Subset of Standard SQL “Persistent Stored
        Modules” (SQL/PSM)
      ● Procedural constructs with embedded SQL
             ● Parameters and (Local) variables
                   ● Manipulate values
             ● Statement Sequence
                   ● execute statements in order
             ● Choice
                   ● conditionally execute a particular sequence
             ● Repetition
                   ● execute a particular sequence multiple times
      ● A bit like Pascal with embedded SQL statements
      ● Valid inside all stored routine types
      ● Can be mixed with most SQL statements

Copyright 2007 MySQL AB                                    The World’s Most Popular Open Source Database   16
Creating a MySQL Stored Procedure
      • Prerequisite: CREATE ROUTINE and ALTER ROUTINE
        privileges
              CREATE PROCEDURE sp_hello(
                p_who VARCHAR(32)
              )
              SELECT CONCAT('Hello, ',v_what,'!!');


                              DDL statement
      •    CREATE PROCEDURE
      •    Created in the current schema (= database)
           Name (sp_hello) must be unique with in the
      •
           schema, may be qualified (my_db.sp_hello)
           Parameter (p_who): IN parameter by default
      •
      •    Procedure body is one single statement, in this
           case, an ordinary SQL SELECT statement.
Copyright 2007 MySQL AB                      The World’s Most Popular Open Source Database   17
Calling a MySQL Stored Procedure

      • Prerequisite: EXECUTE ROUTINE privilege
              CALL sp_hello('PHP');


            statement
      • CALL
      • Name identifies the procedure within the
        schema, and maybe qualified:
           CALL my_schema.sp_hello('PHP')
      • Must pass a parameter value

      Result:
         Hello, PHP!
      • Result set returned to the client

Copyright 2007 MySQL AB                     The World’s Most Popular Open Source Database   18
Generic Statement Sequence: BEGIN...END
              CREATE PROCEDURE sp_greating(
                p_who  VARCHAR(32)
              , p_what VARCHAR(32)
              )
              BEGIN
                SELECT CONCAT('Hello ', p_who);
                SELECT CONCAT(p_what,'!');
              END


                     is a compound statement; it may
      • BEGIN...END
        contain multiple other statements.
      • Contained statements executed Sequentially (in
        order of appearance)
      • (Sidenote: 2 result sets are returned to the client)

Copyright 2007 MySQL AB                     The World’s Most Popular Open Source Database   19
Variables and Parameters
             CREATE PROCEDURE sp_fibonacci(
               INOUT p_m INT, INOUT p_n INT, OUT p_s DOUBLE) 
             BEGIN
               DECLARE v_m INT DEFAULT COALESCE(p_m,0);
               DECLARE v_n INT DEFAULT COALESCE(p_n,1);

               SET p_m := v_n;      ­­ single assignment
               SET p_n := v_m + v_n ­­ multiple
               ,   p_s := p_m/p_n;  ­­ assignments

               SELECT p_m, p_n, p_s;
             END;
               and INOUT parameters
      • IN, OUT
      • DECLARE local variables, optionally assign a default value
      • Use SET to assign values to one or more variables
Copyright 2007 MySQL AB                    The World’s Most Popular Open Source Database   20
Variables and Parameters
             call sp_fibonacci(@m,@n,@s);
             +­­­­­­+­­­­­­+­­­­­­+
             | p_m  | p_n  | p_s  |
             +­­­­­­+­­­­­­+­­­­­­+
             |    1 |    1 |    1 |
             +­­­­­­+­­­­­­+­­­­­­+
             call sp_fibonacci(@m,@n,@s);
             +­­­­­­+­­­­­­+­­­­­­+
             | p_m  | p_n  | p_s  |
             +­­­­­­+­­­­­­+­­­­­­+
             |    1 |    2 |  0.5 |
             +­­­­­­+­­­­­­+­­­­­­+
             call sp_fibonacci(@m,@n,@s);
             +­­­­­­+­­­­­­+­­­­­­­­­­­­­+
             | p_m  | p_n  | p_s         |
             +­­­­­­+­­­­­­+­­­­­­­­­­­­­+
             |    2 |    3 | 0.666666666 |
             +­­­­­­+­­­­­­+­­­­­­­­­­­­­+




Copyright 2007 MySQL AB                      The World’s Most Popular Open Source Database   21
Variable Scope / Visibility
             BEGIN
               DECLARE v_script, v_http VARCHAR(32);
               SET v_script := 'PHP', v_http := 'Apache';
               SELECT v_script, v_http;
               BEGIN
                 DECLARE v_http VARCHAR(32);
                 SET v_http := 'lighttpd';
                 SELECT v_script, v_http;
               END; 
               SELECT v_script, v_http;
             END;



      • Variables are visible only inside the declaring block
      • Nearest Scope: inner declarations mask outer ones
Copyright 2007 MySQL AB                     The World’s Most Popular Open Source Database   22
Choice Constructs

      ● Compound statements
      ● IF...END IF statement
             ●   Simple test of a single condition
             ●   Conditionally start a sequence of statements (branch)
             ●   Optionally, chooses between two branches
                 Don't confuse with the IF() function!
             ●
      ● CASE...END CASE statement
         ● Conditionally starts one out of multiple branches
         ● Simple CASE statement
            ● Just like switch in PHP
         ● Searched CASE statement
            ● Just like nested if...elseif...else in PHP
         ● Don't confuse with the CASE..END expression!

Copyright 2007 MySQL AB                               The World’s Most Popular Open Source Database   23
Syntax: IF...END IF
      ● Tests condition, branches when TRUE
      ● Conditional branch can contain a sequence
             //main, unconditional branch
             IF <condition> THEN
               <statements>  ­­ “true” branch
             END IF;

      ● Optionally, include a branch for the other case:
             IF <condition> THEN
               <statements>  ­­ ”true” branch
             ELSE
               <statements>  ­­ ”false” branch
             END IF;



Copyright 2007 MySQL AB                    The World’s Most Popular Open Source Database   24
IF statement vs IF function
      ● An IF statement chooses between sequences of
        statements
              IF CURRENT_TIME < '12:00:00' THEN
                SELECT 'Good Morning';
              ELSE
                SELECT 'Good Afternoon';
              END IF;

               function chooses between expressions
     ● IF
              SELECT IF(CURRENT_TIME < '12:00:00'
                     , 'Good Morning'
                     , 'Good Afternoon'
                     );




Copyright 2007 MySQL AB                      The World’s Most Popular Open Source Database   25
Syntax: Simple CASE..END CASE
      ● Evaluate expression and compare
      ● Conditional branch can contain a sequence
      ● Optional ELSE branch
      ● Just like switch...case in PHP
             CASE <expression> 
               WHEN <expression1> THEN 
                 <statements>  
               WHEN <expression2> THEN
                 <statements>  
               ELSE 
                 <statements>  
             END CASE;




Copyright 2007 MySQL AB                   The World’s Most Popular Open Source Database   26
Syntax: Searched CASE..END CASE
      ● Search first TRUE condition, then branch
      ● Conditional branch can contain a sequence
      ● Optional ELSE branch
      ● Just like if...elsif...else in PHP
             CASE
               WHEN <condition>
                 THEN <statements>  
               WHEN <expression>
                 THEN <statements>  
               ELSE 
                 <statements>  
             END CASE;




Copyright 2007 MySQL AB                 The World’s Most Popular Open Source Database   27
Repetition
      ● Unstructured Loop
             ● No explicit logic to end the loop
             LOOP
               <statement>  
             END LOOP;

      ● Structured
             ● Logic to end the loop is part of the construct
                                          REPEAT
              WHILE
                                            <statement>
                <condition>
                                          UNTIL
              DO
                                            <condition>
                <statement>
                                          END REPEAT;
              END WHILE;


      ● Iterate:
      ● Leave: exit the current block
Copyright 2007 MySQL AB                               The World’s Most Popular Open Source Database   28
Triggers
              CREATE
                [DEFINER = { <user­name> | CURRENT_USER }]
              TRIGGER <trigger­name> 
                {BEFORE | AFTER}
                {INSERT | UPDATE | DELETE}
              ON <table­name>
              FOR EACH ROW 
                <single­statement>
      ● Automatically executed in response to row-
        level events occurring on table
      ● Can refer to OLD and NEW pseudo-records
             ● INSERT: NEW
             ● DELETE: OLD
                  both OLD and NEW
             ● UPDATE:
      ● Executed as part of transaction
Copyright 2007 MySQL AB                    The World’s Most Popular Open Source Database   29
Event Scheduler (Temporal Triggers)
      ● New in MySQL 5.1
      ● Automatically executed according to time
        schedule
             ● Can be recurring
             ● Can be scheduled to start in the future
             ● Can be instructed to clean itself up




Copyright 2007 MySQL AB                              The World’s Most Popular Open Source Database   30
MySQL Stored Routines
      ● Overview of MySQL Stored Routines:
             ● Terminology, Purpose, Application
      ● MySQL Stored Routine Language
             ● Block Structure, Parameters and Variables, Flow Control
               Constructs, SQL inside stored routines.
      ● PHP Techniques
             ● Creating and Calling Stored Procedures, Processing
               Result Set, Handling Multiple Result Sets.
      ● Use cases
      ● Best Practices
             ● What to do on the client, and what on the server
             ● What to do in PHP, and what in Stored Routines.
             ● How MySQL Stored Routines can help or hurt
               performance.

Copyright 2007 MySQL AB                             The World’s Most Popular Open Source Database   31
PHP and MySQL Stored Routines
      ● Two relevant PHP extensions
      ● MySQL Functions (ext/mysql)
             ● CREATE PROCEDURE and CALL work fine
             ● Just use the PHP function mysql_query()
             ● However, obtaining a result set is impossible
      ● MySQL Improved extension (ext/mysqli)
             ● use mysqli_query() for one result set
             ● For multiple resultsets, use
                       mysqli_multi_query()
                   ●
                       mysqli_use_result()
                   ●
                       mysqli_store_result()
                   ●
                       mysqli_next_result()
                   ●
                       mysqli_more_results()
                   ●



Copyright 2007 MySQL AB                              The World’s Most Popular Open Source Database   32
mysql_query() and Stored Routines
             <?php
               $db = mysql_connect($host,$usr,$pwd);
               mysql_select_db('test',$db);
               $result = mysql_query(
                 quot;CALL sp_hello('PHP')quot;,$db
               );
               $num_rows = mysql_affected_rows($db);
               echo '<br/>num: ', $num_rows;
               echo '<br/>msg: ', mysql_error($db);
               echo '<br/>no: ', mysql_errno($db);
             ?>

             num: ­1
             msg: PROCEDURE test.sp_hello can't return 
               a result set in the given context
             no: 1312

Copyright 2007 MySQL AB                   The World’s Most Popular Open Source Database   33
mysqli_query() and Stored Routines
             <?php
               $db = mysqli_connect($host,$usr,$pwd);
               $db­>select_db('test');
               $result = mysqli_query(
                 $db,quot;CALL sp_hello('PHP')quot;
               );
               $row = mysqli_fetch_row($result);
               echo $row[0];
             ?>


             Hello, PHP!




Copyright 2007 MySQL AB                   The World’s Most Popular Open Source Database   34
Handling Multiple result sets
          <?php
            $db = mysqli_connect($host,$usr,$pwd);
            $db­>select_db('test');
            $db­>multi_query(
              quot;CALL sp_greating('PHP','Good Morning')quot;
            );
            while($result = $db­>store_result()) {
              while ($row = $result­>fetch_row()) {
                echo $row[0];
              }
              $result­>close();
              $db­>next_result();
            }
          ?>

           Hello PHP, Good Morning!


Copyright 2007 MySQL AB                 The World’s Most Popular Open Source Database   35
MySQL Stored Routines
      ● Overview of MySQL Stored Routines:
             ● Terminology, Purpose, Application
      ● MySQL Stored Routine Language
             ● Block Structure, Parameters and Variables, Flow Control
               Constructs, SQL inside stored routines.
      ● PHP Techniques
             ● Creating and Calling Stored Procedures, Processing
               Result set, Handling Multiple Result sets.
      ● Use Cases
      ● Best Practices
             ● What to do on the client, and what on the server
             ● What to do in PHP, and what in Stored Routines.
             ● How MySQL Stored Routines can help or hurt
               performance.

Copyright 2007 MySQL AB                             The World’s Most Popular Open Source Database   36
MySQL Stored Routine Use Cases
      ● Stored Procedures
             ● subtypes and vertical partitioning
             ● data intensive transformation
      ● Stored Functions
             ● domain specific calculations
             ● data transformation
      ● Triggers
             ● Auditing
             ● Automatically Aggregate tables
      ● Events
             ● Logging status
             ● Updating aggregate tables “Materialized views”
             ● ETL processes


Copyright 2007 MySQL AB                             The World’s Most Popular Open Source Database   37
MySQL Stored Routines
      ● Overview of MySQL Stored Routines:
             ● Terminology, Purpose, Application
      ● MySQL Stored Routine Language
             ● Block Structure, Parameters and Variables, Flow Control
               Constructs, SQL inside stored routines.
      ● PHP Techniques
             ● Creating and Calling Stored Procedures, Processing
               Result set, Handling Multiple Result sets.
      ● Use Cases
      ● Best Practices
             ● What to do on the client, and what on the server
             ● What to do in PHP, and what in Stored Routines.
             ● How MySQL Stored Routines can help or hurt
               performance.

Copyright 2007 MySQL AB                             The World’s Most Popular Open Source Database   38
MySQL Stored Procedures: Best Practices
      ● Use pure SQL when you can
      ● Use stored procedures for data-intensive
        operations
      ● Don't use stored procedures for complex
        computation
      ● Don't use stored procedures for single layer
        encapsulation
             ● Simple CRUD layers don't scale
             ● Stored Procedure should add significant functionality
      ● Return multiple result sets from stored procedures
        to reduce network roundtrips




Copyright 2007 MySQL AB                              The World’s Most Popular Open Source Database   39
MySQL Triggers: Best Practices
      ● Use triggers to enforce integrity of data
      ● Using triggers does not mean the application can
        forget about validation




Copyright 2007 MySQL AB                   The World’s Most Popular Open Source Database   40
Amsterdam, June 16 2007

      ● MySQL: Quick Introduction
      ● MySQL Stored Routines for PHP developers
      ● Questions and Discussion




Copyright 2007 MySQL AB                The World’s Most Popular Open Source Database   41
Copyright 2007 MySQL AB   The World’s Most Popular Open Source Database   42

Weitere ähnliche Inhalte

Was ist angesagt?

MySQL Best Practices - OTN LAD Tour
MySQL Best Practices - OTN LAD TourMySQL Best Practices - OTN LAD Tour
MySQL Best Practices - OTN LAD TourRonald Bradford
 
REST in Piece - Administration of an Oracle Cluster/Database using REST
REST in Piece - Administration of an Oracle Cluster/Database using RESTREST in Piece - Administration of an Oracle Cluster/Database using REST
REST in Piece - Administration of an Oracle Cluster/Database using RESTChristian Gohmann
 
MySQL Webinar 2/4 Performance tuning, hardware, optimisation
MySQL Webinar 2/4 Performance tuning, hardware, optimisationMySQL Webinar 2/4 Performance tuning, hardware, optimisation
MySQL Webinar 2/4 Performance tuning, hardware, optimisationMark Swarbrick
 
Redis memcached pdf
Redis memcached pdfRedis memcached pdf
Redis memcached pdfErin O'Neill
 
Tx lf propercareandfeedmysql
Tx lf propercareandfeedmysqlTx lf propercareandfeedmysql
Tx lf propercareandfeedmysqlDave Stokes
 
Parallel Replication in MySQL and MariaDB
Parallel Replication in MySQL and MariaDBParallel Replication in MySQL and MariaDB
Parallel Replication in MySQL and MariaDBMydbops
 
Oracle OpenWorld 2013 - HOL9737 MySQL Replication Best Practices
Oracle OpenWorld 2013 - HOL9737 MySQL Replication Best PracticesOracle OpenWorld 2013 - HOL9737 MySQL Replication Best Practices
Oracle OpenWorld 2013 - HOL9737 MySQL Replication Best PracticesSven Sandberg
 
Php &amp; my sql - how do pdo, mysq-li, and x devapi do what they do
Php &amp; my sql  - how do pdo, mysq-li, and x devapi do what they doPhp &amp; my sql  - how do pdo, mysq-li, and x devapi do what they do
Php &amp; my sql - how do pdo, mysq-li, and x devapi do what they doDave Stokes
 
MySQL 5.7 NEW FEATURES, BETTER PERFORMANCE, AND THINGS THAT WILL BREAK -- Mid...
MySQL 5.7 NEW FEATURES, BETTER PERFORMANCE, AND THINGS THAT WILL BREAK -- Mid...MySQL 5.7 NEW FEATURES, BETTER PERFORMANCE, AND THINGS THAT WILL BREAK -- Mid...
MySQL 5.7 NEW FEATURES, BETTER PERFORMANCE, AND THINGS THAT WILL BREAK -- Mid...Dave Stokes
 
Best Practices - PHP and the Oracle Database
Best Practices - PHP and the Oracle DatabaseBest Practices - PHP and the Oracle Database
Best Practices - PHP and the Oracle DatabaseChristopher Jones
 
MariaDB 10.5 binary install (바이너리 설치)
MariaDB 10.5 binary install (바이너리 설치)MariaDB 10.5 binary install (바이너리 설치)
MariaDB 10.5 binary install (바이너리 설치)NeoClova
 
MySql's NoSQL -- best of both worlds on the same disks
MySql's NoSQL -- best of both worlds on the same disksMySql's NoSQL -- best of both worlds on the same disks
MySql's NoSQL -- best of both worlds on the same disksDave Stokes
 
MySQL Backup and Recovery Essentials
MySQL Backup and Recovery EssentialsMySQL Backup and Recovery Essentials
MySQL Backup and Recovery EssentialsRonald Bradford
 
A26 MariaDB : The New&Implemented MySQL Branch by Colin Charles
A26 MariaDB : The New&Implemented MySQL Branch by Colin CharlesA26 MariaDB : The New&Implemented MySQL Branch by Colin Charles
A26 MariaDB : The New&Implemented MySQL Branch by Colin CharlesInsight Technology, Inc.
 
Performance Tuning Best Practices
Performance Tuning Best PracticesPerformance Tuning Best Practices
Performance Tuning Best Practiceswebhostingguy
 

Was ist angesagt? (20)

MySQL Monitoring 101
MySQL Monitoring 101MySQL Monitoring 101
MySQL Monitoring 101
 
MySQL Best Practices - OTN LAD Tour
MySQL Best Practices - OTN LAD TourMySQL Best Practices - OTN LAD Tour
MySQL Best Practices - OTN LAD Tour
 
REST in Piece - Administration of an Oracle Cluster/Database using REST
REST in Piece - Administration of an Oracle Cluster/Database using RESTREST in Piece - Administration of an Oracle Cluster/Database using REST
REST in Piece - Administration of an Oracle Cluster/Database using REST
 
MySQL Webinar 2/4 Performance tuning, hardware, optimisation
MySQL Webinar 2/4 Performance tuning, hardware, optimisationMySQL Webinar 2/4 Performance tuning, hardware, optimisation
MySQL Webinar 2/4 Performance tuning, hardware, optimisation
 
MySQL Tuning
MySQL TuningMySQL Tuning
MySQL Tuning
 
Redis memcached pdf
Redis memcached pdfRedis memcached pdf
Redis memcached pdf
 
Tx lf propercareandfeedmysql
Tx lf propercareandfeedmysqlTx lf propercareandfeedmysql
Tx lf propercareandfeedmysql
 
Parallel Replication in MySQL and MariaDB
Parallel Replication in MySQL and MariaDBParallel Replication in MySQL and MariaDB
Parallel Replication in MySQL and MariaDB
 
Oracle OpenWorld 2013 - HOL9737 MySQL Replication Best Practices
Oracle OpenWorld 2013 - HOL9737 MySQL Replication Best PracticesOracle OpenWorld 2013 - HOL9737 MySQL Replication Best Practices
Oracle OpenWorld 2013 - HOL9737 MySQL Replication Best Practices
 
Php &amp; my sql - how do pdo, mysq-li, and x devapi do what they do
Php &amp; my sql  - how do pdo, mysq-li, and x devapi do what they doPhp &amp; my sql  - how do pdo, mysq-li, and x devapi do what they do
Php &amp; my sql - how do pdo, mysq-li, and x devapi do what they do
 
Oracle Essentials Oracle Database 11g
Oracle Essentials   Oracle Database 11gOracle Essentials   Oracle Database 11g
Oracle Essentials Oracle Database 11g
 
MySQL 5.7 NEW FEATURES, BETTER PERFORMANCE, AND THINGS THAT WILL BREAK -- Mid...
MySQL 5.7 NEW FEATURES, BETTER PERFORMANCE, AND THINGS THAT WILL BREAK -- Mid...MySQL 5.7 NEW FEATURES, BETTER PERFORMANCE, AND THINGS THAT WILL BREAK -- Mid...
MySQL 5.7 NEW FEATURES, BETTER PERFORMANCE, AND THINGS THAT WILL BREAK -- Mid...
 
Best Practices - PHP and the Oracle Database
Best Practices - PHP and the Oracle DatabaseBest Practices - PHP and the Oracle Database
Best Practices - PHP and the Oracle Database
 
Best Features of Multitenant 12c
Best Features of Multitenant 12cBest Features of Multitenant 12c
Best Features of Multitenant 12c
 
MariaDB 10.5 binary install (바이너리 설치)
MariaDB 10.5 binary install (바이너리 설치)MariaDB 10.5 binary install (바이너리 설치)
MariaDB 10.5 binary install (바이너리 설치)
 
MySql's NoSQL -- best of both worlds on the same disks
MySql's NoSQL -- best of both worlds on the same disksMySql's NoSQL -- best of both worlds on the same disks
MySql's NoSQL -- best of both worlds on the same disks
 
MySQL Backup and Recovery Essentials
MySQL Backup and Recovery EssentialsMySQL Backup and Recovery Essentials
MySQL Backup and Recovery Essentials
 
Oracle Cloud As Services
Oracle Cloud As ServicesOracle Cloud As Services
Oracle Cloud As Services
 
A26 MariaDB : The New&Implemented MySQL Branch by Colin Charles
A26 MariaDB : The New&Implemented MySQL Branch by Colin CharlesA26 MariaDB : The New&Implemented MySQL Branch by Colin Charles
A26 MariaDB : The New&Implemented MySQL Branch by Colin Charles
 
Performance Tuning Best Practices
Performance Tuning Best PracticesPerformance Tuning Best Practices
Performance Tuning Best Practices
 

Andere mochten auch

Alhambra Y Lorca
Alhambra Y LorcaAlhambra Y Lorca
Alhambra Y Lorcarosaclara18
 
Sjede li studenti u predavaonici prema slučajnom rasporedu?
Sjede li studenti u predavaonici prema slučajnom rasporedu?Sjede li studenti u predavaonici prema slučajnom rasporedu?
Sjede li studenti u predavaonici prema slučajnom rasporedu?ilulic
 
Mike Newtown: Energy for Everyone: Intro to Renewables
Mike Newtown: Energy for Everyone: Intro to RenewablesMike Newtown: Energy for Everyone: Intro to Renewables
Mike Newtown: Energy for Everyone: Intro to RenewablesAnn Heidenreich
 
Aristoteles Expo1
Aristoteles Expo1Aristoteles Expo1
Aristoteles Expo1erniux
 
ezComponents - Derick Rethans
ezComponents - Derick RethansezComponents - Derick Rethans
ezComponents - Derick Rethansdpc
 
Presentación OpenLaszlo
Presentación OpenLaszloPresentación OpenLaszlo
Presentación OpenLaszlojoramas
 

Andere mochten auch (6)

Alhambra Y Lorca
Alhambra Y LorcaAlhambra Y Lorca
Alhambra Y Lorca
 
Sjede li studenti u predavaonici prema slučajnom rasporedu?
Sjede li studenti u predavaonici prema slučajnom rasporedu?Sjede li studenti u predavaonici prema slučajnom rasporedu?
Sjede li studenti u predavaonici prema slučajnom rasporedu?
 
Mike Newtown: Energy for Everyone: Intro to Renewables
Mike Newtown: Energy for Everyone: Intro to RenewablesMike Newtown: Energy for Everyone: Intro to Renewables
Mike Newtown: Energy for Everyone: Intro to Renewables
 
Aristoteles Expo1
Aristoteles Expo1Aristoteles Expo1
Aristoteles Expo1
 
ezComponents - Derick Rethans
ezComponents - Derick RethansezComponents - Derick Rethans
ezComponents - Derick Rethans
 
Presentación OpenLaszlo
Presentación OpenLaszloPresentación OpenLaszlo
Presentación OpenLaszlo
 

Ähnlich wie DPC2007 MySQL Stored Routines for PHP Developers (Roland Bouman)

My sql crashcourse_intro_kdl
My sql crashcourse_intro_kdlMy sql crashcourse_intro_kdl
My sql crashcourse_intro_kdlsqlhjalp
 
Mysql User Camp : 20th June - Mysql New Features
Mysql User Camp : 20th June - Mysql New FeaturesMysql User Camp : 20th June - Mysql New Features
Mysql User Camp : 20th June - Mysql New FeaturesTarique Saleem
 
Mysql User Camp : 20-June-14 : Mysql New features and NoSQL Support
 Mysql User Camp : 20-June-14 : Mysql New features and NoSQL Support Mysql User Camp : 20-June-14 : Mysql New features and NoSQL Support
Mysql User Camp : 20-June-14 : Mysql New features and NoSQL SupportMysql User Camp
 
Megha_Osi my sql productroadmap
Megha_Osi my sql productroadmapMegha_Osi my sql productroadmap
Megha_Osi my sql productroadmapOpenSourceIndia
 
MySQL 5.7: What's New, Nov. 2015
MySQL 5.7: What's New, Nov. 2015MySQL 5.7: What's New, Nov. 2015
MySQL 5.7: What's New, Nov. 2015Mario Beck
 
20140722 Taiwan MySQL User Group Meeting Tech Updates
20140722 Taiwan MySQL User Group Meeting Tech Updates20140722 Taiwan MySQL User Group Meeting Tech Updates
20140722 Taiwan MySQL User Group Meeting Tech UpdatesRyusuke Kajiyama
 
MySQL High Availability Solutions - Avoid loss of service by reducing the r...
MySQL High Availability Solutions  -  Avoid loss of service by reducing the r...MySQL High Availability Solutions  -  Avoid loss of service by reducing the r...
MySQL High Availability Solutions - Avoid loss of service by reducing the r...Olivier DASINI
 
Tutorial MySQL com Java
Tutorial MySQL com JavaTutorial MySQL com Java
Tutorial MySQL com JavaMySQL Brasil
 
MySQL Document Store
MySQL Document StoreMySQL Document Store
MySQL Document StoreMario Beck
 
My sqlstrategyroadmap
My sqlstrategyroadmapMy sqlstrategyroadmap
My sqlstrategyroadmapslidethanks
 
MySQL Strategy&Roadmap
MySQL Strategy&RoadmapMySQL Strategy&Roadmap
MySQL Strategy&Roadmapslidethanks
 
Oracle MySQL Tutorial -- MySQL NoSQL Cloud Buenos Aires Nov, 13 2014
Oracle MySQL Tutorial -- MySQL NoSQL Cloud Buenos Aires Nov, 13 2014Oracle MySQL Tutorial -- MySQL NoSQL Cloud Buenos Aires Nov, 13 2014
Oracle MySQL Tutorial -- MySQL NoSQL Cloud Buenos Aires Nov, 13 2014Manuel Contreras
 
01 upgrade to my sql8
01 upgrade to my sql8 01 upgrade to my sql8
01 upgrade to my sql8 Ted Wennmark
 
Upgrade to MySQL 8.0!
Upgrade to MySQL 8.0!Upgrade to MySQL 8.0!
Upgrade to MySQL 8.0!Ted Wennmark
 
Open Source Software – Open Day Oracle 2013
Open Source Software  – Open Day Oracle 2013Open Source Software  – Open Day Oracle 2013
Open Source Software – Open Day Oracle 2013Erik Gur
 
MySQL InnoDB Cluster and NDB Cluster
MySQL InnoDB Cluster and NDB ClusterMySQL InnoDB Cluster and NDB Cluster
MySQL InnoDB Cluster and NDB ClusterMario Beck
 
My sql performance tuning course
My sql performance tuning courseMy sql performance tuning course
My sql performance tuning courseAlberto Centanni
 
MySQL Community and Commercial Edition
MySQL Community and Commercial EditionMySQL Community and Commercial Edition
MySQL Community and Commercial EditionMario Beck
 

Ähnlich wie DPC2007 MySQL Stored Routines for PHP Developers (Roland Bouman) (20)

MySQL Aquarium Paris
MySQL Aquarium ParisMySQL Aquarium Paris
MySQL Aquarium Paris
 
My sql crashcourse_intro_kdl
My sql crashcourse_intro_kdlMy sql crashcourse_intro_kdl
My sql crashcourse_intro_kdl
 
Mysql User Camp : 20th June - Mysql New Features
Mysql User Camp : 20th June - Mysql New FeaturesMysql User Camp : 20th June - Mysql New Features
Mysql User Camp : 20th June - Mysql New Features
 
Mysql User Camp : 20-June-14 : Mysql New features and NoSQL Support
 Mysql User Camp : 20-June-14 : Mysql New features and NoSQL Support Mysql User Camp : 20-June-14 : Mysql New features and NoSQL Support
Mysql User Camp : 20-June-14 : Mysql New features and NoSQL Support
 
Megha_Osi my sql productroadmap
Megha_Osi my sql productroadmapMegha_Osi my sql productroadmap
Megha_Osi my sql productroadmap
 
MySQL 5.7: What's New, Nov. 2015
MySQL 5.7: What's New, Nov. 2015MySQL 5.7: What's New, Nov. 2015
MySQL 5.7: What's New, Nov. 2015
 
20140722 Taiwan MySQL User Group Meeting Tech Updates
20140722 Taiwan MySQL User Group Meeting Tech Updates20140722 Taiwan MySQL User Group Meeting Tech Updates
20140722 Taiwan MySQL User Group Meeting Tech Updates
 
MySQL High Availability Solutions - Avoid loss of service by reducing the r...
MySQL High Availability Solutions  -  Avoid loss of service by reducing the r...MySQL High Availability Solutions  -  Avoid loss of service by reducing the r...
MySQL High Availability Solutions - Avoid loss of service by reducing the r...
 
Tutorial MySQL com Java
Tutorial MySQL com JavaTutorial MySQL com Java
Tutorial MySQL com Java
 
MySQL Document Store
MySQL Document StoreMySQL Document Store
MySQL Document Store
 
My sqlstrategyroadmap
My sqlstrategyroadmapMy sqlstrategyroadmap
My sqlstrategyroadmap
 
MySQL Strategy&Roadmap
MySQL Strategy&RoadmapMySQL Strategy&Roadmap
MySQL Strategy&Roadmap
 
Oracle MySQL Tutorial -- MySQL NoSQL Cloud Buenos Aires Nov, 13 2014
Oracle MySQL Tutorial -- MySQL NoSQL Cloud Buenos Aires Nov, 13 2014Oracle MySQL Tutorial -- MySQL NoSQL Cloud Buenos Aires Nov, 13 2014
Oracle MySQL Tutorial -- MySQL NoSQL Cloud Buenos Aires Nov, 13 2014
 
01 upgrade to my sql8
01 upgrade to my sql8 01 upgrade to my sql8
01 upgrade to my sql8
 
Upgrade to MySQL 8.0!
Upgrade to MySQL 8.0!Upgrade to MySQL 8.0!
Upgrade to MySQL 8.0!
 
Open Source Software – Open Day Oracle 2013
Open Source Software  – Open Day Oracle 2013Open Source Software  – Open Day Oracle 2013
Open Source Software – Open Day Oracle 2013
 
MySQL InnoDB Cluster and NDB Cluster
MySQL InnoDB Cluster and NDB ClusterMySQL InnoDB Cluster and NDB Cluster
MySQL InnoDB Cluster and NDB Cluster
 
My sql performance tuning course
My sql performance tuning courseMy sql performance tuning course
My sql performance tuning course
 
Ipc mysql php
Ipc mysql php Ipc mysql php
Ipc mysql php
 
MySQL Community and Commercial Edition
MySQL Community and Commercial EditionMySQL Community and Commercial Edition
MySQL Community and Commercial Edition
 

Mehr von dpc

Software And The Taste Of Mayo - Marco Tabini
Software And The Taste Of Mayo - Marco TabiniSoftware And The Taste Of Mayo - Marco Tabini
Software And The Taste Of Mayo - Marco Tabinidpc
 
Deployment With Subversion - Lorna Mitchell
Deployment With Subversion - Lorna MitchellDeployment With Subversion - Lorna Mitchell
Deployment With Subversion - Lorna Mitchelldpc
 
Best Practices with Zend Framework - Matthew Weier O'Phinney
Best Practices with Zend Framework - Matthew Weier O'PhinneyBest Practices with Zend Framework - Matthew Weier O'Phinney
Best Practices with Zend Framework - Matthew Weier O'Phinneydpc
 
State Of PHP - Zeev Suraski
State Of PHP - Zeev SuraskiState Of PHP - Zeev Suraski
State Of PHP - Zeev Suraskidpc
 
Symfony 1.1 - Fabien Potencier
Symfony 1.1 - Fabien PotencierSymfony 1.1 - Fabien Potencier
Symfony 1.1 - Fabien Potencierdpc
 
Advanced PHP: Design Patterns - Dennis-Jan Broerse
Advanced PHP: Design Patterns - Dennis-Jan BroerseAdvanced PHP: Design Patterns - Dennis-Jan Broerse
Advanced PHP: Design Patterns - Dennis-Jan Broersedpc
 
New Features PHPUnit 3.3 - Sebastian Bergmann
New Features PHPUnit 3.3 - Sebastian BergmannNew Features PHPUnit 3.3 - Sebastian Bergmann
New Features PHPUnit 3.3 - Sebastian Bergmanndpc
 
PHP 5.3 and PHP 6; a look ahead - Stefan Priebsch
PHP 5.3 and PHP 6; a look ahead - Stefan PriebschPHP 5.3 and PHP 6; a look ahead - Stefan Priebsch
PHP 5.3 and PHP 6; a look ahead - Stefan Priebschdpc
 
Quality Assurance in PHP projects - Sebastian Bergmann
Quality Assurance in PHP projects - Sebastian BergmannQuality Assurance in PHP projects - Sebastian Bergmann
Quality Assurance in PHP projects - Sebastian Bergmanndpc
 
An Infrastructure for Team Development - Gaylord Aulke
An Infrastructure for Team Development - Gaylord AulkeAn Infrastructure for Team Development - Gaylord Aulke
An Infrastructure for Team Development - Gaylord Aulkedpc
 
Enterprise PHP Development - Ivo Jansch
Enterprise PHP Development - Ivo JanschEnterprise PHP Development - Ivo Jansch
Enterprise PHP Development - Ivo Janschdpc
 
DPC2008 Intro - Ivo Jansch
DPC2008 Intro - Ivo JanschDPC2008 Intro - Ivo Jansch
DPC2008 Intro - Ivo Janschdpc
 
DPC 2007 My First Mashup (Cal Evans)
DPC 2007 My First Mashup (Cal Evans)DPC 2007 My First Mashup (Cal Evans)
DPC 2007 My First Mashup (Cal Evans)dpc
 
DPC2007 CodeGear, Delphi For PHP (Pawel Glowacki)
DPC2007 CodeGear, Delphi For PHP (Pawel Glowacki)DPC2007 CodeGear, Delphi For PHP (Pawel Glowacki)
DPC2007 CodeGear, Delphi For PHP (Pawel Glowacki)dpc
 
DPC2007 Zend Framework (Gaylord Aulke)
DPC2007 Zend Framework (Gaylord Aulke)DPC2007 Zend Framework (Gaylord Aulke)
DPC2007 Zend Framework (Gaylord Aulke)dpc
 
DPC2007 Objects Of Desire (Kevlin Henney)
DPC2007 Objects Of Desire (Kevlin Henney)DPC2007 Objects Of Desire (Kevlin Henney)
DPC2007 Objects Of Desire (Kevlin Henney)dpc
 
DPC2007 Symfony (Stefan Koopmanschap)
DPC2007 Symfony (Stefan Koopmanschap)DPC2007 Symfony (Stefan Koopmanschap)
DPC2007 Symfony (Stefan Koopmanschap)dpc
 
DPC2007 Case Study Surfnet (Herman Van Dompseler)
DPC2007 Case Study Surfnet (Herman Van Dompseler)DPC2007 Case Study Surfnet (Herman Van Dompseler)
DPC2007 Case Study Surfnet (Herman Van Dompseler)dpc
 
DPC2007 Case Study Zoom & Webwereld (Sander vd Graaf)
DPC2007 Case Study Zoom & Webwereld (Sander vd Graaf)DPC2007 Case Study Zoom & Webwereld (Sander vd Graaf)
DPC2007 Case Study Zoom & Webwereld (Sander vd Graaf)dpc
 

Mehr von dpc (19)

Software And The Taste Of Mayo - Marco Tabini
Software And The Taste Of Mayo - Marco TabiniSoftware And The Taste Of Mayo - Marco Tabini
Software And The Taste Of Mayo - Marco Tabini
 
Deployment With Subversion - Lorna Mitchell
Deployment With Subversion - Lorna MitchellDeployment With Subversion - Lorna Mitchell
Deployment With Subversion - Lorna Mitchell
 
Best Practices with Zend Framework - Matthew Weier O'Phinney
Best Practices with Zend Framework - Matthew Weier O'PhinneyBest Practices with Zend Framework - Matthew Weier O'Phinney
Best Practices with Zend Framework - Matthew Weier O'Phinney
 
State Of PHP - Zeev Suraski
State Of PHP - Zeev SuraskiState Of PHP - Zeev Suraski
State Of PHP - Zeev Suraski
 
Symfony 1.1 - Fabien Potencier
Symfony 1.1 - Fabien PotencierSymfony 1.1 - Fabien Potencier
Symfony 1.1 - Fabien Potencier
 
Advanced PHP: Design Patterns - Dennis-Jan Broerse
Advanced PHP: Design Patterns - Dennis-Jan BroerseAdvanced PHP: Design Patterns - Dennis-Jan Broerse
Advanced PHP: Design Patterns - Dennis-Jan Broerse
 
New Features PHPUnit 3.3 - Sebastian Bergmann
New Features PHPUnit 3.3 - Sebastian BergmannNew Features PHPUnit 3.3 - Sebastian Bergmann
New Features PHPUnit 3.3 - Sebastian Bergmann
 
PHP 5.3 and PHP 6; a look ahead - Stefan Priebsch
PHP 5.3 and PHP 6; a look ahead - Stefan PriebschPHP 5.3 and PHP 6; a look ahead - Stefan Priebsch
PHP 5.3 and PHP 6; a look ahead - Stefan Priebsch
 
Quality Assurance in PHP projects - Sebastian Bergmann
Quality Assurance in PHP projects - Sebastian BergmannQuality Assurance in PHP projects - Sebastian Bergmann
Quality Assurance in PHP projects - Sebastian Bergmann
 
An Infrastructure for Team Development - Gaylord Aulke
An Infrastructure for Team Development - Gaylord AulkeAn Infrastructure for Team Development - Gaylord Aulke
An Infrastructure for Team Development - Gaylord Aulke
 
Enterprise PHP Development - Ivo Jansch
Enterprise PHP Development - Ivo JanschEnterprise PHP Development - Ivo Jansch
Enterprise PHP Development - Ivo Jansch
 
DPC2008 Intro - Ivo Jansch
DPC2008 Intro - Ivo JanschDPC2008 Intro - Ivo Jansch
DPC2008 Intro - Ivo Jansch
 
DPC 2007 My First Mashup (Cal Evans)
DPC 2007 My First Mashup (Cal Evans)DPC 2007 My First Mashup (Cal Evans)
DPC 2007 My First Mashup (Cal Evans)
 
DPC2007 CodeGear, Delphi For PHP (Pawel Glowacki)
DPC2007 CodeGear, Delphi For PHP (Pawel Glowacki)DPC2007 CodeGear, Delphi For PHP (Pawel Glowacki)
DPC2007 CodeGear, Delphi For PHP (Pawel Glowacki)
 
DPC2007 Zend Framework (Gaylord Aulke)
DPC2007 Zend Framework (Gaylord Aulke)DPC2007 Zend Framework (Gaylord Aulke)
DPC2007 Zend Framework (Gaylord Aulke)
 
DPC2007 Objects Of Desire (Kevlin Henney)
DPC2007 Objects Of Desire (Kevlin Henney)DPC2007 Objects Of Desire (Kevlin Henney)
DPC2007 Objects Of Desire (Kevlin Henney)
 
DPC2007 Symfony (Stefan Koopmanschap)
DPC2007 Symfony (Stefan Koopmanschap)DPC2007 Symfony (Stefan Koopmanschap)
DPC2007 Symfony (Stefan Koopmanschap)
 
DPC2007 Case Study Surfnet (Herman Van Dompseler)
DPC2007 Case Study Surfnet (Herman Van Dompseler)DPC2007 Case Study Surfnet (Herman Van Dompseler)
DPC2007 Case Study Surfnet (Herman Van Dompseler)
 
DPC2007 Case Study Zoom & Webwereld (Sander vd Graaf)
DPC2007 Case Study Zoom & Webwereld (Sander vd Graaf)DPC2007 Case Study Zoom & Webwereld (Sander vd Graaf)
DPC2007 Case Study Zoom & Webwereld (Sander vd Graaf)
 

Kürzlich hochgeladen

Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 

Kürzlich hochgeladen (20)

Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 

DPC2007 MySQL Stored Routines for PHP Developers (Roland Bouman)

  • 1. Amsterdam, June 16 2007 ● MySQL: Quick Introduction ● MySQL Stored Routines for PHP developers ● Questions and Discussion Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 1
  • 2. Roland Bouman (rpbouman.blogspot.com) Certification Developer MySQL AB, Leiden ● MySQL Community Contributor since 2005 ● Joined MySQL AB in July 2006 ● Certification Developer: ● MySQL 5.1 Cluster DBA exam (CMCDBA) ● MySQL Associate exam (CMA) ● Attained: ● CMDEV ● CMDBA ● Formerly: Consultant & Application Developer (mostly Oracle, some MS SQL) Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 2
  • 3. Amsterdam, June 16 2007 ● MySQL: Quick Introduction ● MySQL Stored Routines for PHP developers ● Questions and Discussion Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 3
  • 4. MySQL: Quick Introduction ● MySQL Software Products ● RDBMS (Database) ● Monitoring and Advisory Service ● Drivers and APIs ● Client (GUI) Tools & Utilities ● MySQL Professional Services ● Technical Support ● Consulting ● Training ● Certification ● Indemnification Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 4
  • 5. MySQL Open Source RDBMS Products ● Generally Available, Stable Releases ● MySQL 5.0 Server Community Edition ● Patches from community ● MySQL 5.0 Server Enterprise Edition ● Stablility and Robustness, Early Bugfixes ● Monitoring and Advisory Service ● Binaries ● Development Releases: ● MySQL 5.1 (New: Events, Partitioning) ● MySQL 6.0 (New: Falcon) ● Other RDBMS Products: ● MySQL Cluster / Carrier Grade Edition ● Embedded ● MaxDB (SAP Certified) Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 5
  • 6. MySQL Monitoring and Advisory Service Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 6
  • 7. MySQL Drivers and APIs ● For PHP ● ext/mysql: “MySQL Functions” ● ext/mysqli: “MySQL Improved Extension” ● mysqlnd: “MySQL native driver for PHP” ● Beta 5. ● Built Into PHP 5; PHP 6 ● Replaces libmysql ● Other: ● ODBC: Connector/ODBC ● JDBC: Connector/J ● ADO.NET: Connector/.NET Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 7
  • 8. Amsterdam, June 16 2007 ● MySQL: Quick Introduction ● MySQL Stored Routines for PHP developers ● Questions and Discussion Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 8
  • 9. MySQL Stored Routines ● Overview of MySQL Stored Routines ● MySQL Stored Routine Language ● PHP Techniques ● Use cases ● Best Practices Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 9
  • 10. MySQL Stored Routines ● Overview of MySQL Stored Routines: ● Terminology, Purpose, Application ● MySQL Stored Routine Language ● Block Structure, Parameters and Variables, Flow Control Constructs, SQL inside stored routines. ● PHP Techniques ● Creating and Calling Stored Procedures, Processing Result set, Handling Multiple Result sets. ● Use cases ● Best Practices ● What to do on the client, and what on the server ● What to do in PHP, and what in Stored Routines. ● Performance: how MySQL Stored Routines can help or hurt performance. Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 10
  • 11. MySQL Stored Routines: Overview ● Programs as Database Schema Objects ● Executed in-process with the Database ● Types of Stored Routines: ● Procedures ● Functions ● Triggers ● Events (Temporal triggers; new in MySQL 5.1) ● Language: ● Subset of Standard SQL:2003 SQL/PSM ● Procedural, Block structured ● Do not confuse with User Defined Functions (UDF)! ● Available as of MySQL 5.0 (October 2005) Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 11
  • 12. MySQL Stored Routine Types: Overview ● Stored Procedures & Functions ● Encapsulate tasks or Calculations for reuse ● Single point of definition for Business Logic ● Source Safely stored and backed up ● Added layer of Security ● Triggers ● Data-Driven ● Enforce Data quality through Basic validation ● Enforce complex Business Rules ● Automatically Update Aggregate tables ● Events (MySQL Server 5.1 beta) ● Schedule Code Execution in time. ● Use instead of cron or windows event scheduler ● Automatically Update Aggregate tables Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 12
  • 13. MySQL Stored Routines: Purpose / Advantages ● Performance ● Save network roundtrips, lower latency ● Portability and Reuse ● Single point of definition ● Reusable from many application contexts ● Security ● DEFINER versus INVOKER ● Grant only Execution Privilege ● Ease of Maintenance ● Code stored in the database ● Browse using information_schema database ● 'Headless' administrative tasks ● No additional runtime environment required Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 13
  • 14. MySQL Stored Routines: Caveat / Disadvantages ● Performance ● Overhead may result in higher latency ● Increased usage of database server computing power may negatively affect throughput ● Portability and Reuse ● Which point of view? ● Database portability ? ● Or Application portability? Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 14
  • 15. MySQL Stored Routines ● Overview of MySQL Stored Routines: ● Terminology, Purpose, Application ● MySQL Stored Routine Language ● Block Structure, Parameters and Variables, Flow Control Constructs, SQL inside stored routines. ● PHP Techniques ● Creating and Calling Stored Procedures, Processing Result set, Handling Multiple Result sets. ● Use cases ● Best Practices ● What to do on the client, and what on the server ● What to do in PHP, and what in Stored Routines. ● How MySQL Stored Routines can help or hurt performance. Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 15
  • 16. MySQL Stored Routine Language ● Subset of Standard SQL “Persistent Stored Modules” (SQL/PSM) ● Procedural constructs with embedded SQL ● Parameters and (Local) variables ● Manipulate values ● Statement Sequence ● execute statements in order ● Choice ● conditionally execute a particular sequence ● Repetition ● execute a particular sequence multiple times ● A bit like Pascal with embedded SQL statements ● Valid inside all stored routine types ● Can be mixed with most SQL statements Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 16
  • 17. Creating a MySQL Stored Procedure • Prerequisite: CREATE ROUTINE and ALTER ROUTINE privileges CREATE PROCEDURE sp_hello(   p_who VARCHAR(32) ) SELECT CONCAT('Hello, ',v_what,'!!'); DDL statement • CREATE PROCEDURE • Created in the current schema (= database) Name (sp_hello) must be unique with in the • schema, may be qualified (my_db.sp_hello) Parameter (p_who): IN parameter by default • • Procedure body is one single statement, in this case, an ordinary SQL SELECT statement. Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 17
  • 18. Calling a MySQL Stored Procedure • Prerequisite: EXECUTE ROUTINE privilege CALL sp_hello('PHP'); statement • CALL • Name identifies the procedure within the schema, and maybe qualified: CALL my_schema.sp_hello('PHP') • Must pass a parameter value Result: Hello, PHP! • Result set returned to the client Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 18
  • 19. Generic Statement Sequence: BEGIN...END CREATE PROCEDURE sp_greating(   p_who  VARCHAR(32) , p_what VARCHAR(32) ) BEGIN   SELECT CONCAT('Hello ', p_who);   SELECT CONCAT(p_what,'!'); END is a compound statement; it may • BEGIN...END contain multiple other statements. • Contained statements executed Sequentially (in order of appearance) • (Sidenote: 2 result sets are returned to the client) Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 19
  • 20. Variables and Parameters CREATE PROCEDURE sp_fibonacci(   INOUT p_m INT, INOUT p_n INT, OUT p_s DOUBLE)  BEGIN   DECLARE v_m INT DEFAULT COALESCE(p_m,0);   DECLARE v_n INT DEFAULT COALESCE(p_n,1);   SET p_m := v_n;      ­­ single assignment   SET p_n := v_m + v_n ­­ multiple   ,   p_s := p_m/p_n;  ­­ assignments   SELECT p_m, p_n, p_s; END; and INOUT parameters • IN, OUT • DECLARE local variables, optionally assign a default value • Use SET to assign values to one or more variables Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 20
  • 21. Variables and Parameters call sp_fibonacci(@m,@n,@s); +­­­­­­+­­­­­­+­­­­­­+ | p_m  | p_n  | p_s  | +­­­­­­+­­­­­­+­­­­­­+ |    1 |    1 |    1 | +­­­­­­+­­­­­­+­­­­­­+ call sp_fibonacci(@m,@n,@s); +­­­­­­+­­­­­­+­­­­­­+ | p_m  | p_n  | p_s  | +­­­­­­+­­­­­­+­­­­­­+ |    1 |    2 |  0.5 | +­­­­­­+­­­­­­+­­­­­­+ call sp_fibonacci(@m,@n,@s); +­­­­­­+­­­­­­+­­­­­­­­­­­­­+ | p_m  | p_n  | p_s         | +­­­­­­+­­­­­­+­­­­­­­­­­­­­+ |    2 |    3 | 0.666666666 | +­­­­­­+­­­­­­+­­­­­­­­­­­­­+ Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 21
  • 22. Variable Scope / Visibility BEGIN   DECLARE v_script, v_http VARCHAR(32);   SET v_script := 'PHP', v_http := 'Apache';   SELECT v_script, v_http;   BEGIN     DECLARE v_http VARCHAR(32);     SET v_http := 'lighttpd';     SELECT v_script, v_http;   END;    SELECT v_script, v_http; END; • Variables are visible only inside the declaring block • Nearest Scope: inner declarations mask outer ones Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 22
  • 23. Choice Constructs ● Compound statements ● IF...END IF statement ● Simple test of a single condition ● Conditionally start a sequence of statements (branch) ● Optionally, chooses between two branches Don't confuse with the IF() function! ● ● CASE...END CASE statement ● Conditionally starts one out of multiple branches ● Simple CASE statement ● Just like switch in PHP ● Searched CASE statement ● Just like nested if...elseif...else in PHP ● Don't confuse with the CASE..END expression! Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 23
  • 24. Syntax: IF...END IF ● Tests condition, branches when TRUE ● Conditional branch can contain a sequence //main, unconditional branch IF <condition> THEN   <statements>  ­­ “true” branch END IF; ● Optionally, include a branch for the other case: IF <condition> THEN   <statements>  ­­ ”true” branch ELSE   <statements>  ­­ ”false” branch END IF; Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 24
  • 25. IF statement vs IF function ● An IF statement chooses between sequences of statements IF CURRENT_TIME < '12:00:00' THEN   SELECT 'Good Morning'; ELSE   SELECT 'Good Afternoon'; END IF; function chooses between expressions ● IF SELECT IF(CURRENT_TIME < '12:00:00'        , 'Good Morning'        , 'Good Afternoon'        ); Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 25
  • 26. Syntax: Simple CASE..END CASE ● Evaluate expression and compare ● Conditional branch can contain a sequence ● Optional ELSE branch ● Just like switch...case in PHP CASE <expression>    WHEN <expression1> THEN      <statements>     WHEN <expression2> THEN     <statements>     ELSE      <statements>   END CASE; Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 26
  • 27. Syntax: Searched CASE..END CASE ● Search first TRUE condition, then branch ● Conditional branch can contain a sequence ● Optional ELSE branch ● Just like if...elsif...else in PHP CASE   WHEN <condition>     THEN <statements>     WHEN <expression>     THEN <statements>     ELSE      <statements>   END CASE; Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 27
  • 28. Repetition ● Unstructured Loop ● No explicit logic to end the loop LOOP   <statement>   END LOOP; ● Structured ● Logic to end the loop is part of the construct REPEAT WHILE   <statement>   <condition> UNTIL DO   <condition>   <statement> END REPEAT; END WHILE; ● Iterate: ● Leave: exit the current block Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 28
  • 29. Triggers CREATE   [DEFINER = { <user­name> | CURRENT_USER }] TRIGGER <trigger­name>    {BEFORE | AFTER}   {INSERT | UPDATE | DELETE} ON <table­name> FOR EACH ROW    <single­statement> ● Automatically executed in response to row- level events occurring on table ● Can refer to OLD and NEW pseudo-records ● INSERT: NEW ● DELETE: OLD both OLD and NEW ● UPDATE: ● Executed as part of transaction Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 29
  • 30. Event Scheduler (Temporal Triggers) ● New in MySQL 5.1 ● Automatically executed according to time schedule ● Can be recurring ● Can be scheduled to start in the future ● Can be instructed to clean itself up Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 30
  • 31. MySQL Stored Routines ● Overview of MySQL Stored Routines: ● Terminology, Purpose, Application ● MySQL Stored Routine Language ● Block Structure, Parameters and Variables, Flow Control Constructs, SQL inside stored routines. ● PHP Techniques ● Creating and Calling Stored Procedures, Processing Result Set, Handling Multiple Result Sets. ● Use cases ● Best Practices ● What to do on the client, and what on the server ● What to do in PHP, and what in Stored Routines. ● How MySQL Stored Routines can help or hurt performance. Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 31
  • 32. PHP and MySQL Stored Routines ● Two relevant PHP extensions ● MySQL Functions (ext/mysql) ● CREATE PROCEDURE and CALL work fine ● Just use the PHP function mysql_query() ● However, obtaining a result set is impossible ● MySQL Improved extension (ext/mysqli) ● use mysqli_query() for one result set ● For multiple resultsets, use mysqli_multi_query() ● mysqli_use_result() ● mysqli_store_result() ● mysqli_next_result() ● mysqli_more_results() ● Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 32
  • 33. mysql_query() and Stored Routines <?php   $db = mysql_connect($host,$usr,$pwd);   mysql_select_db('test',$db);   $result = mysql_query(     quot;CALL sp_hello('PHP')quot;,$db   );   $num_rows = mysql_affected_rows($db);   echo '<br/>num: ', $num_rows;   echo '<br/>msg: ', mysql_error($db);   echo '<br/>no: ', mysql_errno($db); ?> num: ­1 msg: PROCEDURE test.sp_hello can't return  a result set in the given context no: 1312 Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 33
  • 34. mysqli_query() and Stored Routines <?php   $db = mysqli_connect($host,$usr,$pwd);   $db­>select_db('test');   $result = mysqli_query(     $db,quot;CALL sp_hello('PHP')quot;   );   $row = mysqli_fetch_row($result);   echo $row[0]; ?> Hello, PHP! Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 34
  • 35. Handling Multiple result sets <?php   $db = mysqli_connect($host,$usr,$pwd);   $db­>select_db('test');   $db­>multi_query(     quot;CALL sp_greating('PHP','Good Morning')quot;   );   while($result = $db­>store_result()) {     while ($row = $result­>fetch_row()) {       echo $row[0];     }     $result­>close();     $db­>next_result();   } ?> Hello PHP, Good Morning! Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 35
  • 36. MySQL Stored Routines ● Overview of MySQL Stored Routines: ● Terminology, Purpose, Application ● MySQL Stored Routine Language ● Block Structure, Parameters and Variables, Flow Control Constructs, SQL inside stored routines. ● PHP Techniques ● Creating and Calling Stored Procedures, Processing Result set, Handling Multiple Result sets. ● Use Cases ● Best Practices ● What to do on the client, and what on the server ● What to do in PHP, and what in Stored Routines. ● How MySQL Stored Routines can help or hurt performance. Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 36
  • 37. MySQL Stored Routine Use Cases ● Stored Procedures ● subtypes and vertical partitioning ● data intensive transformation ● Stored Functions ● domain specific calculations ● data transformation ● Triggers ● Auditing ● Automatically Aggregate tables ● Events ● Logging status ● Updating aggregate tables “Materialized views” ● ETL processes Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 37
  • 38. MySQL Stored Routines ● Overview of MySQL Stored Routines: ● Terminology, Purpose, Application ● MySQL Stored Routine Language ● Block Structure, Parameters and Variables, Flow Control Constructs, SQL inside stored routines. ● PHP Techniques ● Creating and Calling Stored Procedures, Processing Result set, Handling Multiple Result sets. ● Use Cases ● Best Practices ● What to do on the client, and what on the server ● What to do in PHP, and what in Stored Routines. ● How MySQL Stored Routines can help or hurt performance. Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 38
  • 39. MySQL Stored Procedures: Best Practices ● Use pure SQL when you can ● Use stored procedures for data-intensive operations ● Don't use stored procedures for complex computation ● Don't use stored procedures for single layer encapsulation ● Simple CRUD layers don't scale ● Stored Procedure should add significant functionality ● Return multiple result sets from stored procedures to reduce network roundtrips Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 39
  • 40. MySQL Triggers: Best Practices ● Use triggers to enforce integrity of data ● Using triggers does not mean the application can forget about validation Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 40
  • 41. Amsterdam, June 16 2007 ● MySQL: Quick Introduction ● MySQL Stored Routines for PHP developers ● Questions and Discussion Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 41
  • 42. Copyright 2007 MySQL AB The World’s Most Popular Open Source Database 42