MySQL Stored Procedure Programming (Paperback)
暫譯: MySQL 儲存程序程式設計 (平裝本)

Guy Harrison, Steven Feuerstein

  • 出版商: O'Reilly
  • 出版日期: 2006-05-02
  • 售價: $1,740
  • 貴賓價: 9.5$1,653
  • 語言: 英文
  • 頁數: 640
  • 裝訂: Paperback
  • ISBN: 0596100892
  • ISBN-13: 9780596100896
  • 相關分類: MySQLSQL
  • 海外代購書籍(需單獨結帳)

買這商品的人也買了...

商品描述

Description

MySQL Stored Procedure Programming covers a lot of ground. The book starts with a thorough introduction to stored procedures programming and functions, covering the fundamentals of data types, operators, and using SQL in stored procedures. You'll learn how to build and maintain stored programs -- covering transactions, stored functions, and triggers -- and how to call and use MySQL-based stored procedures in a variety of languages, including PHP, Perl, Python, .NET, and Java. This book, destined to be the bible of stored procedure development, is a resource that no real MySQL programmer can afford to do without.

The implementation of stored procedures in MySQL 5.0 a huge
milestone -- one that is expected to lead to widespread enterprise adoption of
the already extremely popular MySQL database. If you are serious about
building the web-based database applications of the future, you need to
get up to speed quickly on how stored procedures work -- and how to
build them the right way. This book, destined to be the bible of stored
procedure development, is a resource that no real MySQL programmer can
afford to do without.


In the decade since MySQL burst on the scene, it has become the
dominant open source database, with capabilities and performance
rivaling those of commercial RDBMS offerings like Oracle and SQL
Server. Along with Linux and PHP, MySQL is at the heart of millions of
applications. And now, with support for stored procedures, functions,
and triggers in MySQL 5.0, MySQL offers the programming power needed
for true enterprise use.



MySQL's new procedural language has a straightforward syntax, making it
easy to write simple programs. But it's not so easy to write secure,
easily maintained, high-performance, and bug-free programs. Few in the
MySQL world have substantial experience yet with stored procedures, but
Guy Harrison and Steven Feuerstein have decades of combined expertise.


In MySQL Stored Procedure Programming, they put
that hard-won experience to good use. Packed with code examples and covering
everything from language basics to application building to advanced
tuning and best practices, this highly readable book is the one-stop
guide to MySQL development. It consists of four major sections:


  • MySQL stored programming fundamentals -- tutorial, basic
    statements, SQL in stored programs, and error handling
  • Building MySQL stored programs -- transaction handling,
    built-in functions, stored functions, and triggers
  • MySQL stored programs in applications -- using stored
    programs with PHP, Java, Perl, Python, and .NET (C# and VB.NET)
  • Optimizing MySQL stored programs -- security, basic and
    advanced SQL tuning, optimizing stored program code, and programming
    best practices


A companion web site contains many thousands of lines of code, that you
can put to use immediately.


 

Table of Contents

Preface

Part I. Stored Programming Fundamentals

1. Introduction to MySQL Stored Programs

     What Is a Stored Program?

     A Quick Tour

     Resources for Developers Using Stored Programs

     Some Words of Advice for Developers

     Conclusion

2. MySQL Stored Programming Tutorial

     What You Will Need

     Our First Stored Procedure

     Variables

     Parameters

     Conditional Execution

     Loops

     Dealing with Errors

     Interacting with the Database

     Calling Stored Programs from Stored Programs

     Putting It All Together

     Stored Functions

     Triggers

     Calling a Stored Procedure from PHP

     Conclusion

3. Language Fundamentals

     Variables, Literals, Parameters, and Comments

     Operators

     Expressions

     Built-in Functions

     Data Types

     MySQL 5 "Strict" Mode

     Conclusion

4. Blocks, Conditional Statements, and Iterative Programming

     Block Structure of Stored Programs

     Conditional Control

     Iterative Processing with Loops

     Conclusion

5. Using SQL in Stored Programming

     Using Non-SELECT SQL in Stored Programs

     Using SELECT Statements with an INTO Clause

     Creating and Using Cursors

     Using Unbounded SELECT Statements

     Performing Dynamic SQL with Prepared Statements

     Handling SQL Errors:  A Preview

     Conclusion

6. Error Handling

     Introduction to Error Handling

     Condition Handlers

     Named Conditions

     Missing SQL:2003 Features

     Putting It All Together

     Handling Stored Program Errors in the Calling Application

     Conclusion

Part II. Stored Program Construction

7. Creating and Maintaining Stored Programs

     Creating Stored Programs

     Editing an Existing Stored Program

     SQL Statements for Managing Stored Programs

     Getting Information About Stored Programs

     Conclusion

8. Transaction Management

     Transactional Support in MySQL

     Defining a Transaction

     Working with Savepoints

     Transactions and Locks

     Transaction Design Guidelines

     Conclusion

9. MySQL Built-in Functions

     String Functions

     Numeric Functions

     Date and Time Functions

     Other Functions

     Conclusion

10. Stored Functions

     Creating Stored Functions

     SQL Statements in Stored Functions

     Calling Stored Functions

     Using Stored Functions in SQL

     Conclusion

11. Triggers

     Creating Triggers

     Using Triggers

     Trigger Overhead

     Conclusion

Part III. Using MySQL Stored Programs in Applications

12. Using MySQL Stored Programs in Applications

     The Pros and Cons of Stored Programs in Modern Applications

     Advantages of Stored Programs

     Disadvantages of Stored Programs

     Calling Stored Programs from Application Code

     Conclusion

13. Using MySQL Stored Programs with PHP

     Options for Using MySQL with PHP

     Using PHP with the mysqli Extension

     Using MySQL with PHP Data Objects

     Conclusion

14. Using MySQL Stored Programs with Java

     Review of JDBC Basics

     Using Stored Programs in JDBC

     Stored Programs and J2EE Applications

     Using Stored Procedures with Hibernate

     Using Stored Procedures with Spring

     Conclusion

15. Using MySQL Stored Programs with Perl

     Review of Perl DBD::mysql Basics

     Executing Stored Programs with DBD::mysql

     Conclusion

16. Using MySQL Stored Programs with Python

     Installing the MySQLdb Extension

     MySQLdb Basics

     Using Stored Programs with MySQLdb

     A Complete Example

     Conclusion

17. Using MySQL Stored Programs with .NET

     Review of ADO.NET Basics

     Using Stored Programs in ADO.NET

     Using Stored Programs in ASP.NET

     Conclusion

Part IV. Optimizing Stored Programs

18. Stored Program Security

     Permissions Required for Stored Programs

     Execution Mode Options for Stored Programs

     Stored Programs and Code Injection

     Conclusion

19. Tuning Stored Programs and Their SQL

     Why SQL Tuning Is So Important

     How MySQL Processes SQL

     SQL Tuning Statements and Practices

     About the Upcoming Examples

     Conclusion

20. Basic SQL Tuning

     Tuning Table Access

     Tuning Joins

     Conclusion

21. Advanced SQL Tuning

     Tuning Subqueries

      Tuning "Anti-Joins" Using Subqueries

     Tuning Subqueries in the FROM Clause

     Tuning ORDER and GROUP BY

     Tuning DML (INSERT, UPDATE, DELETE)

     Conclusion

22. Optimizing Stored Program Code

     Performance Characteristics of Stored Programs

     How Fast Is the Stored Program Language?

     Reducing Network Traffic with Stored Programs

     Stored Programs as an Alternative to Expensive SQL

     Optimizing Loops

     IF and CASE Statements

     Recursion

     Cursors

     Trigger Overhead

     Conclusion

23. Best Practices in MySQL Stored Program Development

     The Development Process

     Coding Style and Conventions

     Variables

     Conditional Logic

     Loop Processing

     Exception Handling

     SQL in Stored Programs

     Dynamic SQL

     Program Construction

     Performance

     Conclusion

Index

商品描述(中文翻譯)

描述
《MySQL 儲存程序程式設計》涵蓋了許多內容。本書首先徹底介紹了儲存程序的程式設計和函數,涵蓋了資料類型、運算子以及在儲存程序中使用 SQL 的基本知識。您將學習如何建立和維護儲存程序,涵蓋交易、儲存函數和觸發器,以及如何在多種語言中調用和使用基於 MySQL 的儲存程序,包括 PHP、Perl、Python、.NET 和 Java。本書注定成為儲存程序開發的聖經,是每位真正的 MySQL 程式設計師無法缺少的資源。

在 MySQL 5.0 中實現儲存程序是一個巨大的里程碑——這預計將導致企業廣泛採用已經非常受歡迎的 MySQL 資料庫。如果您認真對待未來的基於網路的資料庫應用程式,您需要迅速了解儲存程序的運作方式,以及如何正確地構建它們。本書注定成為儲存程序開發的聖經,是每位真正的 MySQL 程式設計師無法缺少的資源。

自從 MySQL 闖入市場的十年來,它已成為主導的開源資料庫,其能力和性能可與商業 RDBMS 產品如 Oracle 和 SQL Server 相媲美。與 Linux 和 PHP 一起,MySQL 是數百萬個應用程式的核心。現在,隨著 MySQL 5.0 支援儲存程序、函數和觸發器,MySQL 提供了企業使用所需的程式設計能力。

MySQL 的新程序語言具有簡單明瞭的語法,使得編寫簡單的程式變得容易。但編寫安全、易於維護、高效能且無錯誤的程式並不容易。在 MySQL 界中,對於儲存程序的實際經驗仍然不多,但 Guy Harrison 和 Steven Feuerstein 擁有數十年的豐富經驗。

在《MySQL 儲存程序程式設計》中,他們充分利用了這些來之不易的經驗。本書充滿了程式碼範例,涵蓋了從語言基礎到應用程式構建,再到高級調整和最佳實踐的所有內容,是 MySQL 開發的一站式指南。它由四個主要部分組成:

- MySQL 儲存程序基礎知識——教程、基本語句、儲存程序中的 SQL 和錯誤處理
- 建立 MySQL 儲存程序——交易處理、內建函數、儲存函數和觸發器
- MySQL 儲存程序在應用程式中的使用——在 PHP、Java、Perl、Python 和 .NET (C# 和 VB.NET) 中使用儲存程序
- 優化 MySQL 儲存程序——安全性、基本和高級 SQL 調整、優化儲存程序代碼和程式設計最佳實踐

一個伴隨的網站包含了數千行代碼,您可以立即使用。

目錄
前言
第一部分:儲存程序基礎
1. MySQL 儲存程序介紹
- 什麼是儲存程序?
- 快速導覽
- 使用儲存程序的開發者資源
- 給開發者的一些建議
- 結論
2. MySQL 儲存程序教程
- 您需要什麼
- 我們的第一個儲存程序
- 變數
- 參數
- 條件執行
- 迴圈
- 處理錯誤
- 與資料庫互動
- 從儲存程序調用儲存程序
- 整合所有內容
- 儲存函數
- 觸發器
- 從 PHP 調用儲存程序
- 結論
3. 語言基礎
- 變數、字面量、參數和註解
- 運算子
- 表達式
- 內建函數
- 資料類型
- MySQL 5 的「嚴格」模式
- 結論
4. 區塊、條件語句和迭代程式設計
- 儲存程序的區塊結構
- 條件控制
- 使用迴圈進行迭代處理
- 結論
5. 在儲存程序中使用 SQL
- 在儲存程序中使用非 SELECT SQL
- 使用帶有 INTO 子句的 SELECT 語句
- 創建和使用游標
- 使用無界 SELECT 語句
- 使用預備語句執行動態 SQL
- 處理 SQL 錯誤:預覽
- 結論
6. 錯誤處理
- 錯誤處理介紹
- 條件處理器
- 命名條件
- 缺失的 SQL:2003 特性
- 整合所有內容
- 在調用應用程式中處理儲存程序錯誤
- 結論
第二部分:儲存程序構建
7. 創建和維護儲存程序
- 創建儲存程序
- 編輯現有的儲存程序
- 管理儲存程序的 SQL 語句
- 獲取有關儲存程序的信息
- 結論
8. 交易管理
- MySQL 中的交易支援
- 定義交易
- 使用保存點
- 交易和鎖定
- 交易設計指南
- 結論
9. MySQL 內建函數
- 字串函數
- 數值函數
- 日期和時間函數
- 其他函數
- 結論
10. 儲存函數
- 創建儲存函數
- 儲存函數中的 SQL 語句
- 調用儲存函數
- 在 SQL 中使用儲存函數
- 結論
11. 觸發器
- 創建觸發器
- 使用觸發器
- 觸發器開銷
- 結論
第三部分:在應用程式中使用 MySQL 儲存程序
12. 在應用程式中使用 MySQL 儲存程序
- 現代應用程式中儲存程序的優缺點
- 儲存程序的優勢
- 儲存程序的劣勢
- 從應用程式代碼調用儲存程序
- 結論
13. 使用 PHP 的 MySQL 儲存程序
- 使用 MySQL 與 PHP 的選項
- 使用 mysqli 擴展的 PHP
- 使用 PHP 資料物件的 MySQL
- 結論
14. 使用 Java 的 MySQL 儲存程序
- JDBC 基礎回顧
- 在 JDBC 中使用儲存程序
- 儲存程序和 J2EE 應用程式
- 與 Hibernate 一起使用儲存程序
- 與 Spring 一起使用儲存程序
- 結論
15. 使用 Perl 的 MySQL 儲存程序
- Perl DBD::mysql 基礎回顧
- 使用 DBD::mysql 執行儲存程序
- 結論
16. 使用 Python 的 MySQL 儲存程序
- 安裝 MySQLdb 擴展
- MySQLdb 基礎
- 使用 MySQLdb 的儲存程序
- 完整範例
- 結論
17. 使用 .NET 的 MySQL 儲存程序
- ADO.NET 基礎回顧
- 在 ADO.NET 中使用儲存程序
- 在 ASP.NET 中使用儲存程序
- 結論
第四部分:優化儲存程序
18. 儲存程序安全性
- 儲存程序所需的權限
- 儲存程序的執行模式選項
- 儲存程序和代碼注入
- 結論
19. 儲存程序及其 SQL 的調整
- 為什麼 SQL 調整如此重要
- MySQL 如何處理 SQL
- SQL 調整語句和實踐
- 有關即將到來的範例
- 結論
20. 基本 SQL 調整
- 調整表存取
- 調整聯接
- 結論
21. 高級 SQL 調整
- 調整子查詢
- 使用子查詢調整「反聯接」
- 在 FROM 子句中調整子查詢
- 調整 ORDER 和 GROUP BY

最後瀏覽商品 (20)