MySQL APIs Used in This Book
MySQL programming interfaces exist for many languages, including C, C++, Eiffel, Java, Pascal, Perl, PHP, Python, Ruby, Smalltalk, and Tcl. Given this fact, writing a MySQL cookbook presents an author with something of a challenge. Clearly, the book should provide recipes for doing many interesting and useful things with MySQL, but which API or APIs should the book use? Showing an implementation of every recipe in every language would result either in covering very few recipes or in a very, very large book! It would also result in a lot of redundancy when implementations in different languages bear a strong resemblance to each other. On the other hand, it’s worthwhile taking advantage of multiple languages, because one language often will be more suitable than another for solving a particular type of problem.
To resolve this dilemma, I’ve picked a small number of APIs from among those that are available and used them to write the recipes in this book. This limits its scope to a manageable number of APIs while allowing some latitude to choose from among them:
The Perl and Ruby DBI modules
PHP, using the PEAR DB module
Python, using the DB-API module
Java, using the JDBC interface
Why these languages? Perl and PHP were easy to pick. Perl is arguably the most widely used language on the Web, and it became so based on certain strengths such as its text-processing capabilities. In particular, it’s very popular for writing MySQL programs. PHP also is widely deployed. ...