MySQL Cookbook recipes Distribution Paul DuBois, paul@kitebird.com This is the recipes distribution that accompanies MySQL Cookbook (O'Reilly & Associates, 2002). The latest version of the distribution and the errata list for the book are available at: http://www.kitebird.com/mysql-cookbook/ If you find that files appear to be missing from this distribution, please let me know. If you are using a database name other than "cookbook", substitute that name wherever you see cookbook in the distribution files. Java programs in this distribution use the MySQL Connector/J JDBC driver, which is the successor to the MM.MySQL driver. if you already have MM.MySQL installed, you can use it instead of MySQL Connector/J by making a simple change. Whenever you see this in Java code: com.mysql.jdbc Replace it with this: org.gjt.mm.mysql Important directories: tables SQL scripts for creating tables used in the book mysql Using the mysql client program (chapter 1) api MySQL programming; API basics (chapter 2) lib Library files use by lots of programs select Record selection techniques (chapter 3) strings Using strings (chapter 4) dates Date and time manipulation (chapter 5) sorting Sorting operations (chapter 6) summary Summary operations (chapter 7) alter ALTER TABLE examples (chapter 8) metadata Using metadata (chapter 9) transfer Data import/export (chapter 10) sequences Using sequences (chapter 11) joins Multi-table joins (chapter 12) union UNION operations (chapter 12) stats Statistical techniques (chapter 13) dups Duplicate processing (chapter 14) transactions Performing transactions (chapter 15) apache Web programming using Apache (Perl, PHP, Python, chapters 16-18) tomcat Web programming using Tomcat (Java/JSP, chapters 16-18) baseball1 Scripts for loading the baseball1.com baseball database into MySQL misc Miscellaneous stuff Other files: setCLASSPATH Example tcsh/csh script for setting CLASSPATH (to use it, execute this command: source setCLASSPATH) To install a script or program for general use, put it in a directory that is listed in your PATH setting. (PATH settings are discussed in chapter 1.) For example, under Unix, you might put a script in /usr/local/bin, or in the bin directory under your home directory. Web scripts should be installed according to the instructions given in the book. Files often contain lines with "#@ _IDENTIFIER_" sequences. These are just placemarkers, used to block out sections that are used for examples in the book, and may be ignored. You'll note that many of the Perl scripts include lines that look like this: { # begin scope } # end scope Their purpose is to allow similar examples within the same file that use the same variables all to declare the variables with "my". By introducing a new scope for each example, the declarations don't trigger warnings from Perl.