0% found this document useful (0 votes)
40 views62 pages

Expert PHP and MySQL 1st Edition Andrew Curioso Instant Download

The document provides information about the book 'Expert PHP and MySQL' by Andrew Curioso and others, which focuses on advanced techniques and best practices for using PHP with MySQL for high-traffic applications. It covers topics such as design patterns, caching, user-defined functions, and PHP extensions, aimed at professional developers. Additionally, it includes links to other related books and resources available for download.

Uploaded by

usluerelcinn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views62 pages

Expert PHP and MySQL 1st Edition Andrew Curioso Instant Download

The document provides information about the book 'Expert PHP and MySQL' by Andrew Curioso and others, which focuses on advanced techniques and best practices for using PHP with MySQL for high-traffic applications. It covers topics such as design patterns, caching, user-defined functions, and PHP extensions, aimed at professional developers. Additionally, it includes links to other related books and resources available for download.

Uploaded by

usluerelcinn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 62

Expert PHP and MySQL 1st Edition Andrew Curioso

pdf download

https://ebookname.com/product/expert-php-and-mysql-1st-edition-
andrew-curioso/

Get Instant Ebook Downloads – Browse at https://ebookname.com


Instant digital products (PDF, ePub, MOBI) available
Download now and explore formats that suit you...

PHP and MySQL Create Modify Reuse 1st Edition Timothy


Boronczyk

https://ebookname.com/product/php-and-mysql-create-modify-
reuse-1st-edition-timothy-boronczyk/

Learning PHP MySQL JavaScript 4th Edition Robin Nixon

https://ebookname.com/product/learning-php-mysql-javascript-4th-
edition-robin-nixon/

PHP and MySQL for Dummies 2nd ed Edition Janet Valade

https://ebookname.com/product/php-and-mysql-for-dummies-2nd-ed-
edition-janet-valade/

Amateur and Proletarian Theatre in Post Revolutionary


Russia Primary Sources 1st Edition Stefan Aquilina

https://ebookname.com/product/amateur-and-proletarian-theatre-in-
post-revolutionary-russia-primary-sources-1st-edition-stefan-
aquilina/
Applied Linguistics Review 1st Edition Li Wei

https://ebookname.com/product/applied-linguistics-review-1st-
edition-li-wei/

Stress Analysis of Fiber Reinforced Composite Materials


Michael W. Hyer

https://ebookname.com/product/stress-analysis-of-fiber-
reinforced-composite-materials-michael-w-hyer/

Learning Unix for OS X Second Edition Taylor

https://ebookname.com/product/learning-unix-for-os-x-second-
edition-taylor/

The Advanced Fixed Income and Derivatives Management


Guide 1st Edition Saied Simozar

https://ebookname.com/product/the-advanced-fixed-income-and-
derivatives-management-guide-1st-edition-saied-simozar/

Technology Supported Environments for Personalized


Learning Methods and Case Studies Premier Reference
Source 1st Edition John O'Donoghue

https://ebookname.com/product/technology-supported-environments-
for-personalized-learning-methods-and-case-studies-premier-
reference-source-1st-edition-john-odonoghue/
Modeling Crop Production Systems Principles and
Application 1st Edition P Singh (Author)

https://ebookname.com/product/modeling-crop-production-systems-
principles-and-application-1st-edition-p-singh-author/
Curioso
Best practices and expert techniques et al. Join the discussion @ p2p.wrox.com Wrox Programmer to Programmer™

for today’s most demanding apps Expert


As the world’s most popular, general purpose, open source scripting
language, PHP is frequently used with MySQL to create high-traffic,
mission-critical applications. This indispensable book shares proven,

PHP and MySQL


author-tested best practices and expert techniques that can be applied
to even the most demanding MySQL-driven PHP apps. You’ll explore
ways to extend MySQL with user-defined functions, write PHP
extensions, and solve problems when PHP and MySQL alone are not
enough and other techniques or third-party tools are necessary.
wrox.com
Expert PHP and MySQL:
Programmer
• Reviews essential techniques, such as design patterns, complex
queries, and advanced regular expression
Forums
Join our Programmer to
• Addresses advanced PHP concepts, such as iterators and closures Programmer forums to ask
and answer programming
• Demonstrates using Gearman for multitasking in your web applications questions about this book,
• Discusses caching using memcached with MySQL and your PHP join discussions on the
hottest topics in the industry,
web applications and connect with fellow
• Discusses ways to create PHP Extensions and MySQL User Defined Functions programmers from around
the world.
• Shows how to use Sphinx for search functionality in your PHP
web applications Code Downloads
Andrew Curioso is a senior software engineer at MyVBO (Virtual Business Office)
creating an innovative and scalable infrastructure for Rich Internet Applications using
PHP and MySQL.
Take advantage of free code
samples from this book, as
well as code samples from
hundreds of other books, all
Expert
PHP and
ready to use.
Ronald Bradford is a technology strategist and advisor specializing in MySQL, Drizzle
and related web technologies. With a primary focus on architecture, design,
performance analysis and scalability of web applications, his consulting portfolio Read More
ranges from Internet startups to Fortune 500 companies. Find articles, ebooks, sample
chapters, and tables of contents
Patrick Galbraith is a principal software engineer at Lycos, adding new PHP and MySQL for hundreds of books, and

MySQL
offerings for Tripod Users, switching remaining apps using Oracle to MySQL as well as more reference resources on ®

®
other interesting projects. programming topics that matter
to you.
Wrox Expert books present the wisdom accumulated by an experienced
author team who is recognized as experts by the programming community.
These experts challenge professional developers to examine their current
practices in pursuit of better results.

Programming Languages / PHP


$44.99 USA
$53.99 CAN Andrew Curioso, Ronald Bradford, Patrick Galbraith
Related Wrox Books
Beginning PHP5, Apache, and MySQL Web Development
ISBN: 978-0-7645-7966-0
™ PHP, Apache, and MySQL are the three key open source technologies that form the basis for most active web servers. This
Programmer to Programmer book guides you through the entire process of setting up your own site and walks you through every step, from the installation
of PHP, Apache, and MySQL to database management, security, and integration with other technologies. The multi-platform
approach addresses installation and usage on both Linux® and Windows®, and two common-themed, reusable web sites are
examined. Upon completion of this book, you’ll be able to create well designed, dynamic web sites using open source tools.

Get more out of Beginning PHP 5.3


ISBN: 978-0-470-41396-8
As one of the most popular open-source web-programming languages in use today, PHP is an ideal server-side scripting language
that connects HTML-based web pages to a backend database for dynamic content. It allows you to create anything from a simple

wrox.com
form-to-email script to a web forum application, a blogging platform, or a content management system. This guide introduces
the PHP language and shows you how to write powerful web applications using PHP.

Professional PHP 5
ISBN: 978-0-7645-7282-1
This book has a pragmatic focus on how to use PHP in the larger scheme of enterprise-class software development. It covers
UML modeling and presents objects and object hierarchies that, when completed, comprise a robust toolkit that developers will
be able to reuse on future projects. This book is designed to arm you with the sort of constructs that are available out of the
box with platforms such as Java and .NET — from simple utility classes like Collection and Iterator, to more complex constructs
like Model/View/Controller architectures and state machines.
Interact Join the Community Professional PHP Design Patterns
Take an active role online by participating in our Sign up for our free monthly newsletter at ISBN: 978-0-470-49670-1
P2P forums @ p2p.wrox.com newsletter.wrox.com This book bridges the gap between the PHP and the older programming language by applying those tried and tested Design
Patterns to native PHP applications. It starts with an introduction to Design Patterns, describes their use and importance, and
details where you’ve seen them already. The book continues through a host of Design Patterns with code examples and explanations.
Finally, an in-depth case study shows you how to plan your next application using Design Patterns, how to program those patterns
Wrox Online Library Browse in PHP, and how to revise and refactor an existing block of code using Design Patterns from the book. The author approaches
the concepts in technical yet usable formats that are familiar to both programmers who are self-taught and those with more
Hundreds of our books are available online Ready for more Wrox? We have books and extensive formal education.
through Books24x7.com e-books available on .NET, SQL Server, Java,
XML, Visual Basic, C#/ C++, and much more!
Wrox Blox
Download short informational pieces and code
to keep you up to date and out of trouble!

Contact Us.
We always like to get feedback from our readers. Have a book idea?
Need community support? Let us know by e-mailing [email protected]
CONTENTS AT A GLANCE

INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxix
CHAPTER 1 Techniques Every Expert Programmer Needs to Know . . . . . . . . . . . . . . . 1
CHAPTER 2 Advanced PHP Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
CHAPTER 3 MySQL Drivers and Storage Engines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
CHAPTER 4 Improving Performance through Caching . . . . . . . . . . . . . . . . . . . . . . . . . 131
CHAPTER 5 memcached and MySQL. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
CHAPTER 6 Advanced MySQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
CHAPTER 7 Extending MySQL with User-Defined Functions . . . . . . . . . . . . . . . . . . 271
CHAPTER 8 Writing PHP Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
CHAPTER 9 Full-Text Searching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
CHAPTER 10 Multi-tasking in PHP and MySQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401
CHAPTER 11 Rewrite Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443
CHAPTER 12 User Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 457
CHAPTER 13 Understanding the INFORMATION_SCHEMA . . . . . . . . . . . . . . . . . . . . 477
CHAPTER 14 Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493
CHAPTER 15 Command-Line and Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .517
CHAPTER 16 Optimization and Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543
INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 567

563120ffirs.indd i 2/18/10 9:07:32 AM


563120ffirs.indd ii 2/18/10 9:07:32 AM
EXPERT

PHP and MySQL®

563120ffirs.indd iii 2/18/10 9:07:32 AM


563120ffirs.indd iv 2/18/10 9:07:32 AM
EXPERT

PHP and MySQL®

Andrew Curioso
Ronald Bradford
Patrick Galbraith

563120ffirs.indd v 2/18/10 9:07:32 AM


Expert PHP and MySQL®
Published by
Wiley Publishing, Inc.
10475 Crosspoint Boulevard
Indianapolis, IN 46256
www.wiley.com
Copyright © 2010 by Wiley Publishing, Inc., Indianapolis, Indiana

Published simultaneously in Canada

ISBN: 978-0-470-56312-0

Manufactured in the United States of America

10 9 8 7 6 5 4 3 2 1

No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means,
electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of
the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through
payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923,
(978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the Permissions
Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or
online at http://www.wiley.com/go/permissions.

Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with
respect to the accuracy or completeness of the contents of this work and specifically disclaim all warranties, including
without limitation warranties of fitness for a particular purpose. No warranty may be created or extended by sales or pro-
motional materials. The advice and strategies contained herein may not be suitable for every situation. This work is sold
with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional services.
If professional assistance is required, the services of a competent professional person should be sought. Neither the pub-
lisher nor the author shall be liable for damages arising herefrom. The fact that an organization or Web site is referred to
in this work as a citation and/or a potential source of further information does not mean that the author or the publisher
endorses the information the organization or Web site may provide or recommendations it may make. Further, readers
should be aware that Internet Web sites listed in this work may have changed or disappeared between when this work was
written and when it is read.

For general information on our other products and services please contact our Customer Care Department within the
United States at (877) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002.

Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available
in electronic books.

Library of Congress Control Number: 2010920658

Trademarks: Wiley, the Wiley logo, Wrox, the Wrox logo, Wrox Programmer to Programmer, and related trade dress are
trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affi liates, in the United States and other coun-
tries, and may not be used without written permission. MySQL is a registered trademark of MySQL AB. All other trade-
marks are the property of their respective owners. Wiley Publishing, Inc., is not associated with any product or vendor
mentioned in this book.

563120ffirs.indd vi 2/18/10 9:07:32 AM


This book is dedicated to my wife, Laura. Without
your support this book wouldn’t be possible. Thank
you for being by my side and planning the wedding
while I was doing my writing!

ÑAndrew Curioso
For MySQL Culture, past, present, and future. To
many in the MySQL community: you are more than
colleagues, you are great friends.

ÑRonald Bradford
This book is dedicated to my son, Kiran Patrick.
“Kiran” means “ray of light” in Sanskrit, and you are
a ray of light in my life!

ÑPatrick Galbraith

563120ffirs.indd vii 2/18/10 9:07:32 AM


563120ffirs.indd viii 2/18/10 9:07:32 AM
ABOUT THE AUTHORS

ANDREW CURIOSO has been coding in PHP and MySQL for a decade. His experience includes develop-
ing professional-grade PHP and MySQL based web applications for MIT Lincoln Laboratory (part of
the Massachusetts Institute of Technology) and being at the ground floor of the state-of-the-art web-
publishing platform Webon at Lycos (currently the page builder technology for Angelfire.com). Aside
from software engineering, Andrew takes interest in software usability, business, the semantic web, and
robotics. He currently works at MyVBO, a virtual business office that provides powerful tools to help
small to medium sized business manage their companies online. Over the years, he’s had the opportu-
nity to work on exciting projects and specializes in data portability, linked data, social media, and Rich
Internet Applications. His home on the web can be found at http://andrewcurioso.com/.
RONALD BRADFORD has more than two decades of professional IT industry experience in a broad
range of disciplines. His core expertise is in relational database management systems (RDBMS)
including MySQL, Oracle and Ingres. His technical software development skills include working
in Java (J2EE), PHP, Perl, Python, Web (HTML/CSS/XML/JSON), and Linux/Unix operating
systems. He is a professional speaker, educational curriculum developer, and writer who special-
izes in technical presentations, workshops, online content publishing, and knowledge transfer.
More information on his related MySQL writings, presentations and useful tools can be found at
http://ronaldbradford.com.

PATRICK GALBRAITH lives up in the sticks of southwestern New Hampshire near Mt. Monadnock
with his wife Ruth and son Kiran. Since 1993, he has been using and developing Open Source soft-
ware. He has worked on various Open Source projects including MySQL, federated storage engine,
memcached Functions for MySQL, Drizzle, Narada Search Engine Slashcode, and is the maintainer
of DBD::mysql. He has worked at a number of companies throughout his career, including MySQL
AB, Classmates.com, OSDN/Slashdot, and Lycos. He currently works at NorthScale, a leading
provider of scale-out infrastructure software for web applications. He is also part owner of a wire-
less broadband company, Radius North, which provides Internet service to underserved rural areas
of New Hampshire. His website, which comes by way of a 5.8GHz Alvarion access unit up in a pine
tree, is http://patg.net.

563120ffirs.indd ix 2/18/10 9:07:32 AM


563120ffirs.indd x 2/18/10 9:07:32 AM
ABOUT THE TECHNICAL EDITORS

ALAN COLLISON is a software engineer with more than a dozen years of experience developing scal-
able PHP applications. His expertise ranges from the design and development of front end GUIs to
the implementation of core server side application business logic.
JAY COSKEY is a software developer and software development manager who lives in Seattle, and
has worked for companies including Cray Inc. and Amazon.com. He has used numerous languages
on Linux, Unix, and Windows platforms, in environments ranging from OS development, to web
and enterprise systems. When not involved in mathematics or software, he can sometimes be found
woodworking.
ERIC DAY has been writing high-performance servers and databases for most of his career and cur-
rently works on open source projects such as Drizzle and Gearman. He has also written a number of
extensions for higher level languages such as PHP. When not hacking on code, he can be found run-
ning, enjoying a good vegan meal, or blogging at http://oddments.org/.
KEN MACKE is a systems architect, developer, and owner of RockIP Networks — a provider of web
hosting and IT consulting services. Ken has over 15 years of experience creating cutting-edge software
with technologies such as PHP, C++, C#, and .NET. You can find Ken online at twitter.com/kmacke.
ELIZABETH NARAMORE has been a web developer since 1997, with a focus in PHP and E-commerce.
In addition to being a web developer, she is an author, editor, speaker, and educator, and active
member of communities such as the PHP Community, PHPWomen, and her local PHP Users Group.
TROND NORBYE is a Senior Software Engineer specializing in databases and distributed caching. He
currently works at NorthScale designing and implementing scale out data systems. Prior to joining
NorthScale, Trond was a key member of Sun Microsystems’ Web Scale Infrastructure group where
he worked on Drizzle, Gearman and Memcached. In his copious free time he is a core contributor
on the Memcached, Libmemcached and OpenGrok Open Source projects.
KARL WILBUR is an enterprise consultant, PHP developer and Linux guru with more than a decade
of LAMP experience and a passion for the bleeding-edge. When not out motorcycling the Midwest
he can be found lurking on the Internet at http://karlwilbur.net/.

563120ffirs.indd xi 2/18/10 9:07:32 AM


563120ffirs.indd xii 2/18/10 9:07:32 AM
CREDITS

EXECUTIVE EDITOR PRODUCTION MANAGER


Robert Elliott Tim Tate

PROJECT EDITOR VICE PRESIDENT AND EXECUTIVE GROUP


Maureen Spears PUBLISHER
Richard Swadley
TECHNICAL EDITORS
Alan Collison VICE PRESIDENT AND EXECUTIVE PUBLISHER
Jay Coskey Barry Pruett
Eric Day
Ken Macke ASSOCIATE PUBLISHER
Elizabeth Naramore Jim Minatel
Trond Norbye
Karl Wilbur PROJECT COORDINATOR, COVER
Lynsey Stanford
PRODUCTION EDITOR
Eric Charbonneau COMPOSITOR
Jeff Lytle, Happenstance Type-o-Rama
COPY EDITOR
Kim Cofer PROOFREADER
Nancy Bell
EDITORIAL DIRECTOR
Robyn B. Siesky INDEXER
Johnna VanHoose Dinse
EDITORIAL MANAGER
Mary Beth Wakefield COVER DESIGNER
Michael E. Trent
MARKETING MANAGER
Ashley Zurcher COVER IMAGE
©Gavin Hellier/Photographer’s Choice RF/
Getty Images

563120ffirs.indd xiii 2/18/10 9:07:32 AM


563120ffirs.indd xiv 2/18/10 9:07:32 AM
ACKNOWLEDGMENTS

IT WAS THANKS TO MY BROTHER RAY CURIOSO JR. that I was really able to get a head start. He
started an embroidery business in the 90s out of my parents’ garage. It has since moved to its own
place but there was that time in-between where, thanks to his company, I was one of the only people
that I knew with Internet access. It was slow and it took days to download software development
kits and it wasn’t as easy to fi nd programming help for a beginner as it is today. But I made do with
what I had. It was also because of him and his business — it needed an ecommerce site — that I put
down the C code and the ASP and got my start with PHP and MySQL.
I’d like to thank my parents too for being a constant source of support for me. It was my father who
taught me the value of hard work. And, of course, thank my wife who put up with me spending
long nights working for a start up and writing a book at the same time. We were married during the
writing and without her hard work planning the wedding, supporting me, and standing by my side
this book would not have been possible.
I’d like to thank my teammates at Lycos. It was truly a pleasure working with each of them. I’d
particularly like to thank my managers. Don Kosak for inspiring me, Neal Shanske for keeping me
on my toes. I’d like to thank Derek Bruneau since everything I learned about good software design
and usability I learned thanks to him. And I’d like to thank my fellow engineers Lisa Wallmark,
Chandra Yadav, and Kevin Harrington. I’d like to also thank my team at MyVBO, in particular
Robert (Bob) Wilkins and Matthew Sheppard for their understanding as I juggled work and writing.
Finally, I would also like to take a minute to thank the team that worked tirelessly to make this book
happen. Bob Elliott who made this book happen, Maureen Spears who edited this whole thing cover to
cover, and my co-authors Patrick and Ronald. Patrick in particular has been a good friend and deserves
credit for putting the team together. He is the one thread that connects us all. Which brings me to the
tech editors. They all did an amazing job and the book is much better because of each of them.
There are countless people who have helped me along the way. I am sure that I forgot someone. To
anyone who has ever encouraged me to follow my dreams or supported me in any way: thank you.

ÑAndrew Curioso

TODAY, I AM A WELL RESPECTED AUTHORITY in the MySQL field. This was not possible without a
lot of hard work and great mentorship. I would fi rst like to thank the late Frank Jarvis from DDIAE
(now USQ) who in 1988 introduced me to the works of C.J. Date, M. Stonebraker and E.F. Codd
during my university studies.
My fi rst relational database experience started with Ingres and led to immediate work with systems
design and software development in the database field. In the early 90’s, as a young, energetic and
knowledgeable database architect with several successful government projects, my work alongside

563120ffirs.indd xv 2/18/10 9:07:32 AM


my now good friend Bruce Turner helped in my understanding and appreciation of more formal
processes in the management and success of large scale deployments. We worked together again for
Oracle Corporation in the late 90s where Bruce still works today. To Bruce, thank you for your sup-
port and mentoring. Those TAFE days with Mike and Laurie still rate as some of my favorites. From
my fi rst use of MySQL over ten years ago until today I still seek input, advice and encouragement
from the MySQL community. Many of you from the MySQL community I consider as great friends.
Finally, to my fiance Cindy who has been supportive throughout the entire process of my fi rst book
in MySQL with compromises that have enabled me to complete this work on schedule.

ÑRonald Bradford

ONE WEEKEND IN 1993, I had the chance to go on a getaway to San Diego. Instead, I opted to stay
home and download, onto 26 floppies, Slackware Linux, which I promptly installed onto my Packard
Bell 386. I could never get the built-in video card to work with X, so I ended up buying a separate video
card and had to edit my XConfig file to get it to work. How much more interesting this was to do than
editing a config.sys and an autoexec.bat! From then on, I was hooked. I worked at Siemens Ultrasound
Group in Issaquah, Washington, at the time. An engineer there named Debra, when asked what was a
good thing to learn, said something I’ll never forget: ‘‘Learn Perl.’’ Debra — you were right! I always
wanted to be a C ++ graphics programmer. That didn’t happen because of this thing called the World
Wide Web. I remember Ray Jones and Randy Bentson of Celestial Software showing me a program
called Mosaic, which allowed you to view text over the Internet. Images would be launched using XV.
Everywhere I worked, I had to write programs that ran on the Web, which required me to write CGI
in Perl. So much for my goal of being a C ++ programmer — but I consider this a great trade for a
great career. (I did eventually get to write C ++ for MySQL!) I would first like to thank my wife, Ruth,
for being patient and supportive of me for numerous lost weekends with this book and my previous
book Developing Web Applications with Perl, memcached, MySQL and Apache, as well as accepting
me working on yet another book so soon after the first! Next in line for thanks, our editor, Maureen
Spears, who is not only a great editor, but also a friend. Not only did she edit this current work, but she
was my editor for my previous book. Next, I would like to thank my co-authors, Andrew and Ronald.
It’s been a whole different experience co-authoring versus being a sole author, having learned a bit
about putting together something — as a team.
A special thanks goes to our tech editors as well as to Trond Norbye (memcached, libmemcached),
Eric Day (Gearman, Drizzle) and Andrew Aksyonoff (Sphinx) for stepping up as tech editors when
we were in a crunch and reviewing the material I wrote about their projects!
Thank you to Bob Elliott, who gave us the opportunity to work as a team to write this book!
Thanks to Monty Widenius for creating MySQL and for being a mentor as well as a good friend
who worked hard to include FederatedX into MariaDB while I was working on this book. Thanks
also to Brian Aker for being another great mentor and friend, as well as being a software-producing
machine with a scrolling page full of open source software projects that he’s created, including
Drizzle and libmemcached.

563120ffirs.indd xvi 2/18/10 9:07:32 AM


I WOULD LIKE TO THANK MY CURRENT COLLEAGUES at Northscale — Steve Yen, Dustin Sallings,
James Phillips, Matt Ingenthron, Rod Ebrahimi, Eric Lambert and Trond Norbye — it’s a real privilege
to work with guys who have so much expertise. Also thanks go to my former colleagues at Lycos who
encouraged me while writing my previous book — Don Kosak, Chandra Yadav, Tristan Escalada, oth-
ers, as well as Andrew Curioso! Also to former colleagues at Grazr and MySQL. Last but not least,
thanks to the team members of MariaDB and Drizzle for integrating projecs I worked on while writing
this book. Thanks also to anyone I forgot to mention. I know I probably forgot someone!

ÑPatrick Galbraith

563120ffirs.indd xvii 2/18/10 9:07:32 AM


563120ffirs.indd xviii 2/18/10 9:07:32 AM
CONTENTS

INTRODUCTION XXIX

CHAPTER 1: TECHNIQUES EVERY EXPERT PROGRAMMER


NEEDS TO KNOW 1

Object-Oriented PHP 2
Instantiation and Polymorphism 2
Interfaces 7
Magic Methods and Constants 8
Design Patterns 11
Using MySQL Joins 20
INNER JOIN 22
OUTER JOIN 24
Other JOIN Syntax 26
Complex Joins 27
MySQL Unions 28
GROUP BY in MySQL Queries 30
WITH ROLLUP 31
HAVING 32
Logical Operations and Flow Control in MySQL 33
Logic Operators 33
Flow Control 34
Maintaining Relational Integrity 35
Constraints 36
NOT NULL 36
UNSIGNED 36
ENUM and SET 37
UNIQUE KEY 37
FOREIGN KEY 38
Using Server SQL Modes 41
Storage Engine Integrity 45
What MySQL Does Not Tell You 45
What’s Missing? 46
Subqueries in MySQL 46
Subquery 46
Correlated Subquery 46
Derived Table 47

563120ftoc.indd xix 2/18/10 9:07:48 AM


CONTENTS

Using Regular Expressions 49


General Patterns 50
Expert Regular Expressions 52
Putting It All Together in PHP 55
Regular Expressions in MySQL 60
Summary 63

CHAPTER 2: ADVANCED PHP CONCEPTS 65

A Problem That Needs Solving 65


Iterators and the SPL 67
A Sample View for the Application 67
The Iterator Interface 69
The Countable Interface 73
The SeekableIterator Interface and Pagination 75
The ArrayAccess Interface 77
Lambda Functions and Closures 78
The Old Way: Lambda-Style Functions 78
Understanding Closures 81
Using the Query Builder for Prototyping 83
Summary 85

CHAPTER 3: MYSQL DRIVERS AND STORAGE ENGINES 87

MySQL Drivers 88
About MySQL Storage Engines 89
Obtaining Storage Engine Information 89
Default Storage Engines 93
MyISAM 93
InnoDB 97
Memory 103
Blackhole 108
Archive 109
Merge 110
CSV 112
Federated 112
Other MySQL Supplied Engines 118
Falcon 118
Maria 120
Pluggable Engines 121
InnoDB Plugin 121
PBXT 122
XtraDB 123

xx

563120ftoc.indd xx 2/18/10 9:07:48 AM


CONTENTS

Engines as Standalone Products 124


InfiniDB 124
TokuDB 124
Infobright 125
Other MySQL Offerings 125
Storage Engine Patch Products 125
MySQL-Related Products 126
Other Engines 127
Integrated Hardware Engines 128
Other Solutions 128
Wafflegrid 129
Summary 129

CHAPTER 4: IMPROVING PERFORMANCE THROUGH CACHING 131

eAccelerator and APC 132


Installing and Configuring APC 132
Installing and Configuring eAccelerator 133
User Cache 134
Checking the Cache Status 135
When to Use APC and eAccelerator 138
memcached 138
What Is memcached? 139
What memcached Does for You 139
How Does memcached Work? 139
How to Use memcached 141
What Is Gearman? 144
Caching Strategies 144
Installing memcached 145
Starting memcached 148
Startup Scripts 149
Testing Your memcached Installation 151
memcached Clients 153
Libmemcached 153
Libmemcached Features 154
Libmemcached Utility Programs 154
Installing libmemcached 155
Libmemcached Utility Programs 155
memcat 155
memflush 156
memcp 156
memstat 157
memrm 157

xxi

563120ftoc.indd xxi 2/18/10 9:07:48 AM


CONTENTS

memslap 157
memerror 158
PECL/Memcached 158
Connecting, Instantiation 160
Setting Client Behavior 162
Putting and Retrieving Data 163
Append and Prepend 166
Delete 168
Increment and Decrement 168
Multi-get 169
Multi-set 170
Cache Locality Using byKey Methods and Multi get/set 171
getDelayed 173
CAS 174
Statistics 176
Server List 178
Error Handling 178
Practical Caching 180
memcached Proxy: moxi 185
Other “memcapable” Key-Value Stores 186
Tokyo Tyrant 187
Summary 188

CHAPTER 5: MEMCACHED AND MYSQL 19 1

The Memcached Functions for MySQL 191


How the Memcached Functions for MySQL Work 192
Installing the Memcached Functions for MySQL 193
Prerequisites 193
Configure the Source 194
Build the Source 194
Install the UDF 195
Checking Installation 196
Using the Memcached Functions for MySQL 196
Establishing a Connection to the memcached Server 197
Data Setting Functions 198
Data Fetching Functions 204
Increment and Decrement 204
Behavioral Functions 206
Statistical Functions 209
Version Functions 211
Fun with Triggers (and UDFs) 212

xxii

563120ftoc.indd xxii 2/18/10 9:07:48 AM


CONTENTS

Read-Through Caching with Simple Select Statements 216


Updates 219
Summary 220

CHAPTER 6: ADVANCED MYSQL 221

Views 221
Access Permissions 223
Additional Information about Views 225
Stored Procedures and Functions 226
General Attributes 226
Stored Routine Logic 228
Using Stored Routines Privileges and Meta Data 230
Extending Stored Routines 231
Stored Routine Disadvantages 231
User Defined Functions 231
Triggers 232
No Triggers 233
Trigger Syntax 233
Insert Triggers 233
Update Triggers 234
Delete Triggers 235
Replace Triggers 236
Trigger Permissions 237
Transactions 237
Atomicity 238
Consistency 240
Isolation 242
Durability 247
Implied Commit 250
Replication 250
Replication Purposes 250
Replication Setup 251
Testing MySQL Replication 254
How Does MySQL Replication Work? 255
Testing MySQL Replication 259
Important Configuration Options 260
Important Replication Commands 261
Breaking Replication 261
Using Replication Selectively 262
The Issues with MySQL Replication 263
The Benefits of MySQL Replication 264

xxiii

563120ftoc.indd xxiii 2/18/10 9:07:48 AM


Exploring the Variety of Random
Documents with Different Content
(Doniol I, 407.)

On the 26th of the same month, M. de Vergennes wrote to his


secret agent, “almost as though he spoke to an ambassador.”
(Doniol.)
“I have the satisfaction of announcing to you that His Majesty
very much approves the noble and frank manner with which you
repelled the attack made upon you by Lord Rochford in relation to
the American vessel destined for Nantes and conducted to Bristol.
You have said nothing which His Majesty would not have prescribed
you to say if he had foreseen that you would be obliged to answer in
regard to a matter so far removed from the business with which you
are charged. Receive my compliments, Monsieur. After having
assured you of the approbation of the king, mine cannot seem very
interesting to you; nevertheless, I cannot refuse myself the
satisfaction of applauding the wisdom and firmness of your conduct
and renewing the assurances of my entire esteem. I have not
neglected your commission for Aix. M. le Garde des Sceaux assured
me that it would remain in suspense till your return.
“I am very perfectly
“de Vergennes.
“Versailles, April 26th, 1776.”
Post Scriptum.
“The king approves, that you do not refuse the overtures the
Lord Rochford may make to you. You are prudent and discreet. I
should be without uneasiness even if you had a more important
commission than that which M. de Sartine has given you. It was
well, however, that you had it, since it served to disperse the
suspicions aroused by your frequent voyages to London. It must be
admitted that the English whom we believe to be men are really far
less than women, if they are so easily frightened.... Nothing equals
the sincere attachment with which I have the honor to be, Monsieur,
your very humble, etc.
“de Vergennes.”

The same day Beaumarchais addressed the count with a letter


from London which runs as follows:

“M. le Comte:
“I profit by this occasion to entertain you with freedom upon the
only really important matter at present, America and all that pertains
to it. I reasoned a long time, day before yesterday, with the man you
thought best to prevent coming to France. (Arthur Lee.) He
incessantly asks if we are going to do absolutely nothing for them.
And without wasting time in repeating to me how very important
their success is to France because he does us the honor of believing
that we agree with him on that point, he tells me simply, ‘We need
arms, powder, and above all engineers: only you can help us, and it
is to your interest to do so.’
“The Americans are as well placed as possible; army, fleet
provisions, courage, everything is excellent, but without powder and
engineers how can they conquer or even defend themselves? Are we
going to let them perish rather than loan them one or two millions?
Are we afraid of losing the money?
“Weakness and fear is all that one sees here....
“It is clear that the ministry is silent because it has nothing to
reply. Fear and anger on one side, weakness and embarrassment on
the other, this is the real condition. You would be still more
convinced of this truth if you will recall the nature of their treaties
with Germany and if you examine the rate of the new loan.... And
when this is well proved, is it really true, M. le Comte, that you will
do nothing for the Americans?
“Will you not have the goodness to show once more to the King
how much he can gain, without striking a blow, in this one
campaign? And will you not attempt to convince His Majesty that this
miserable pittance which they demand, and over which we have
been disputing for more than a year, will bring to us all the fruits of a
great victory without undergoing the dangers of a combat? That this
help can give to us while we sleep, all that the disgraceful treaty of
1763 made us lose? What greater view can occupy the council of the
king and what force your pleading will take on if you show the
reverse of the picture and count what the defeat of the Americans
will cost us. Three hundred millions—our men—our vessels, our
islands, etc. ... because their forces once united against us, their
audacity augmented by their great success, it is only certain that
they will force these same Frenchmen to support a fatal war which
two millions now would avert.
“In spite of the danger which I run in writing these daring
things from London, I feel myself twice as much French in London as
at Paris. The patriotism of this people stirs my own....”
As may be seen from this letter, Arthur Lee still inspired
complete confidence in the agent of the French government, so
much indeed that Beaumarchais gladly disclosed to him the plans
which he had formed for coming to the aid of the Americans.
So certain was he that France would ultimately yield to the
necessity of giving them secret support that he no doubt spoke with
indiscreet assurance on the subject. Exactly what passed between
the two men will never be known, but what is certain is, that during
the spring of 1776, Arthur Lee addressed to the secret committee of
Congress a letter in which he says:
“In consequence of active measures taken with the French
Embassy in London, M. de Vergennes has sent me a secret agent to
inform me that the French court cannot think of making war on
England but that she is ready to send five million worth of arms and
ammunition to Cap Français to be thence sent to the colonies.”
A careful analysis of this important missive will at once make
clear the profound misunderstanding which arose in the mind of the
secret committee of Congress regarding the true state of affairs in
France. So completely was every statement perverted that though
the whole bears a semblance of truth yet in reality nothing could be
further removed from it.
For instead of sending an agent to confer with Arthur Lee, M. de
Vergennes had steadily refused to enter into any relation whatever
with him. Instead of promising munitions of war for which
Beaumarchais had been pleading so long and so ardently, the
government continued to refuse to compromise itself by making any
statement regarding them.
And yet in judging Arthur Lee, whether he intentionally distorted
the truth or only indulged in what he considered a harmless
exaggeration, we must not forget that this letter with its assurances
of help, arriving at the moment which it did, had a profound
influence in shaping men’s minds for independence.
As regards Lee himself, the letter had the effect of greatly
augmenting his credit with Congress. Silas Deane was already on his
way to France, charged with an express commission to secure
munitions of war on credit, so it was determined to join Arthur Lee
to the commission as soon as it could be brought about.
But to return to the French court. The first intimation of
anything like an avowed approval of the plans of Beaumarchais is to
be found in a letter of M. de Vergennes under date of May 2, 1776.
He wrote:
“I have received the first of this month, Monsieur, the letter with
which you honored me, written the 26th of last month.”
Then follows a lengthy preamble in which the count, speaking
as an observer of men and one used to dealing with them,
continues:
“This preface is not destined to refute your foresight, which on
the contrary I praise and approve. But do not suppose that because
your plans are not immediately acted on, that they are rejected.
Although the method which I employ is sure, I am forced to curb the
desire which I feel to express to you all my thoughts, therefore, I
rely upon your sagacity to divine them. Think well and you will find
that I am nearer to you than you imagine.... A thousand thanks,
Monsieur, for the news items which you communicate to me, they
have been seen and relished.... I have delivered the letter which you
recommended to me; if an answer comes I will forward it to you. I
flatter you that you know my friendship and attachment for you.
“de Vergennes.”

In fact the hindrances were gradually disappearing from the


path of the minister. In a résumé, in all probability drawn up by
Vergennes himself, entitled, “Réflexions sur la nécessité de secourir
les Américains et de se préparer à la guerre avec l’Angleterre,”
without date, but placed by Doniol the first of May, 1776, the
following passages occur:
“There is no obstacle, and it is even necessary to aid the
insurgents indirectly by means of munitions or of money....
“We are to make no agreement with them until their
independence is established. The aid must be veiled and hidden, and
appear to come from commerce so that we can always deny it.
“It would be sufficient for an intelligent merchant, faithful and
discreet, to be stationed in each one of the ports, where the
American vessels would come to land their cargoes—he would treat
directly with their captains and would mask the shipments to prevent
the reproach of the court of England.”—Doniol.

This was not at all what Beaumarchais had been planning and
preparing. In the next chapter we shall see him with his usual
flexibility abandon his own ideas and adopt those of the ministry,
since they tended to the same end. In the meantime he was
addressing the following letters to Vergennes:

“Monsieur le Comte:
“There is nothing very important here but the news of the
evacuation of Boston, which arrived three days ago....
“The government assumes an air of approbation, of mystery, of
intelligence even. It wishes to have it considered as a ruse of the
ministry, but that does not take. It is too certain that the
impossibility to hold Boston from lack of provisions has driven the
English away....
“All this confirms what I announced in my last dispatch, that the
Americans are in good condition everywhere, engineers and powder
excepted. I thank you for your obliging goodness in regard to my
affair at Aix. I thank you also for the honorable encouragement
which the approbation of the king and your own gives to my
enterprise.... Say what you will, M. le Comte, a little exaltation in the
heart of an honest man, far from spoiling him for action vivifies
everything he touches, and enables him to do more than he would
have dared to promise from his natural capacity. I feel this
exaltation, it remains for my prudence to direct it in a way that turns
to the good of the affairs of the king. Conserve for me his esteem,
Monsieur le Comte.
“Ah, Monsieur le Comte, as a favor ... some powder and
engineers! It seems to me that I never wanted anything so much....”
(Given by Gaillardet.)

Five days later; London, May 8, 1776.


... “I say then, the time approaches when the Americans will be
masters at home.... If they have the upper hand, as everything
seems to point to that end, will we not have infinitely to regret,
Monsieur le Comte, not to have ceded to their prayers? If, far from
having acquired the right to their gratitude, as we could easily do at
small cost and without risk, we will have alienated them forever? As
they will have conquered without us, they will revenge themselves
for our hardness to them. What are two or three millions advanced
without compromising ourselves? Because I can engage my sacred
faith to make any sum you wish reach them at second hand by way
of Holland, without risk or other authorization than that which exists
between us. A small effort will perhaps suffice, because I know that
the Virginians have now an abundant manufacture of saltpeter, and
that the Congress has decided that powder shall be made in every
place instead of at Philadelphia as formerly. Beside this, Virginia has
seven thousand regular troops, and seventy thousand militia, iron in
abundance, and she makes almost as many arms as all the rest of
America together.
“But engineers, engineers and powder! Or the money to buy
them!”
(Gaillardet.)

Three days later, London, May 11, 1776.... “All the quarrels for
the last eight days are in relation to the quomodo of the evacuation
of Boston. The opposition and the ministry are openly tearing out
each other’s eyes about it. The whole affair consists of the doctors
deciding how the sick man died. Let them dispute over that great
coffin. The couriers arrive at every moment.... To-morrow all the
news of the American papers will be printed in the English ones. The
whole affair begins to clear up. You were certainly very near me as
you said, when I imagined you very very far.”
(Gaillardet.)

“London, May 17, 1776.


“... Eight days ago a pack boat from Virginia sent by Lord
Dunmore brought news to the government, but it was so bad that it
was thought advisable to say that the chest containing the mail was
washed overboard in a storm. Admirable ruse! Effort of superior
genius! Yesterday another vessel arrived from Canada. A man
jumped into a boat and the vessel pushed out again. That man
hurried straight to London without stopping. No one can find out his
errand. From these incidents comes the refrain; the news must be
very black since it is kept such a mystery.”
(Gaillardet.)

Thus ended the first phase of the activity of Beaumarchais in


the cause of the Americans. In a few more days he was back in
France ready to turn the force of his mind, the power of his intellect
and all the energy of his being into the development of that vast
mercantile establishment which was for a time to supply the colonies
with munitions of war and other necessities.
As a proof that no one ever was able to pass from grave to gay
with more facility than Beaumarchais, we will close the present
chapter with a rather lengthy extract from an article which appeared
in the London Morning Chronicle shortly before his return to France:
From the Morning Chronicle, London, May 6, 1776.
“Monsieur, the Editor:
“I am a stranger, full of honor. If it is not to inform you
absolutely who I am, it is at least to tell you in more than one sense
who I am not.
“Day before yesterday, at the Pantheon, after the concert and
during the dance, I found under my feet a lady’s mantle of black
taffeta, lined with the same and bordered with lace. I am ignorant to
whom this mantle belongs, never having seen, even at the
Pantheon, her who wore it and all my investigations since have not
enabled me to learn anything in relation to her.
“I therefore beg you, M. the Editor, to announce in your paper
this lost mantle so that it may be returned faithfully to whomever
shall reclaim it.
“But that there may be no error in relation to it, I have the
honor to announce to you that the person who lost it wore a pink
plume that day in her hair; I think she had diamond pendants in her
ears, but I am not so sure of that as of the rest. She is tall and well
formed, her hair is a silvery blonde; her complexion dazzlingly white;
her neck is fine and gracefully set; her form slender, and the
prettiest little foot in the world. I have even remarked that she is
very young. She is lively and distracted; her step is light and she has
a decided taste for the dance.
“If you ask me, M. the Editor, why, having noted her so well, I
did not at once return her mantle, I shall have the honor to repeat
what I said to you before, that I have never seen this person; that I
do not know either her features, or her eyes, or her costume, or her
carriage, and do not know who she is, or what she is like.
“But if you insist upon knowing how I am able to so well define
her, never having seen her, I in turn will be astonished that so exact
an observer as you do not know that the simple examination of a
lady’s mantle is sufficient to give of her all the notions by which she
could be recognized.
“Now suppose, Monsieur, that on examining this mantle, I found
in the hood some stray hair of a beautiful blonde attached to the
stuff, also some bits of down escaped from the feathers, you will
admit that a great effort of genius would not be needed to conclude
that the hair and the plume of that blonde must in every way
resemble the samples which have detached themselves. You feel
that perfectly. And since similar hair never grew from skin of
uncertain whiteness, analogy will have taught you as it has taught
me, that this beautiful silvery hair must have a dazzling complexion,
something which no observer can dispute with us without
dishonoring his judgment.
“It is thus that a slightly worn spot in the taffeta on the two
lateral parts of the interior of the hood which could not have come
from anything but a repeated rubbing of two small hard bodies in
movement, showed me that, not that she wore the pendants on that
particular day, but that she does so ordinarily; and that it is hardly
probable between you and me, that she would have neglected this
adornment on a day of conquest or of grand assembly, both which
are one. If I reason badly do not spare me, I beg you. Rigor is not
injustice.
“The rest goes without saying. It can easily be seen that it was
sufficient for me to examine the ribbon which was attached to the
mantle at the neck, and to knot it at the place rumpled by the
ordinary usage to see that the space enclosed being small, the neck
daily enclosed in that space must also be very fine and graceful. No
difficulty there.
“Suppose again, Monsieur, if on examining the body of the
mantle you should have found upon the taffeta the impression of a
very pretty little foot, marked in gray dust, would you not have
reflected as I did, that had any other woman stepped on the mantle
since its fall, she would certainly have deprived me of the pleasure
of picking it up? Therefore it would have been impossible that the
impression of the shoe came from any other person than her who
lost the mantle. It follows, you would have said that if the shoe was
small the foot must be smaller still. There is no merit in my having
recognized that; the most careless observer, a child would have
found that out.
“But this impression made in passing and even without being
felt, announces, besides an extreme vivacity of step, a strong
preoccupation of mind to which grave, cold, or aged persons are
little susceptible. I therefore very simply concluded that my charming
blond is in the flower of her age, very lively and distracted. Would
you not have thought the same, M. the Editor?
“The next day in recalling that I had been able to pick up the
mantle in a place where so many people passed (which proves that
it fell at the very instant) without having been able to see who lost it
(which proves that she was already far away), I said to myself,
‘Assuredly this person is the most alert beauty of England, Scotland
and Ireland; and if I do not join America to the rest, it is only
because they have become of late diablement alerte in that country.’
“In giving you this mantle, M. the Editor, permit me to envelop
myself in my own and that I sign myself,
“L’Amateur français.”

CHAPTER XVIII
Look upon my house, gentlemen, from henceforward as the
chief of all useful operations to you in Europe, and my person as one
of the most zealous partisans of your cause, the soul of your success
and a man most deeply impressed with the respectful esteem with
which I have the honor to be....
“Roderigue Hortalès et Compagnie”
Beaumarchais to the Secret Committee of Congress, Aug. 15, 1776.

Memoir Explaining to the King the Plan of His Commercial House—


Roderigue Hortalès et Cie.—The Doctor Du Bourg—Silas Deane’s
Arrival—His Contract with Beaumarchais—Lee’s Anger—His
Misrepresentations to Congress—Beaumarchais Obtains His
Rehabilitation.

O Nwrote
the 24th of May, 1776, Beaumarchais returned to France. He
to the Count de Vergennes the same night:
“Monsieur le Comte,
“I arrive very tired, completely exhausted. My first care is to ask
you for your orders and the hour when you will be so good as to
give me audience. It is three o’clock in the morning. My negro will
be at your levée, he will be back for mine. I hope he will bring me
the news which I desire with the greatest impatience, which is to go
in person, and assure you of the very respectful devotion with
which, I am, M. le Comte, yor very humble and very obedient
servitor, Beaumarchais.”
(Doniol.)
SILAS DEANE

No written statement was ever made of the exact arrangement


arrived at between the minister and his confidential agent. What is
certain is that as soon as the latter understood the new plan of
procedure he brought at once to the aid of the undertaking the
whole force of his powerful mind as well as the experience of those
years passed under the tutelage of old Du Verney, and in his
attempted enterprise at the court of Spain.
A letter without date, published for the first time by George
Clinton Genet in the Magazine of American History, 1878, written by
Beaumarchais to the King, gives a clear statement of how he
proposed to proceed in founding this new mercantile house which
should hide from all the world and even from the Americans
themselves the connivance of the Government in the operations:
“To the King Alone:
“While state reasons engage you to extend a helping hand to
the Americans, policy requires that Your Majesty shall take abundant
precaution to prevent the secret succor sent to America from
becoming a firebrand between France and England in Europe.... On
the other hand, prudence wills that you acquire a certainty that your
funds may never fall into other hands than those for whom you
destined them. Finally, the present condition of your finances does
not permit you to make so great sacrifice at the moment as passing
events seem to require.
“It becomes my duty, Sire, to present to you, and it is for your
wisdom to examine the following plan, the chief object of which is to
avoid, by a turn which is absolutely commercial, the suspicion that
your majesty has any hand in the affair.
“The principal merit of this plan is to augment your aid so that a
single million ... will produce the same results for the Americans as if
your Majesty really had disbursed nine millions in their favor.... Your
Majesty will begin by placing a million at the disposition of your
agent, who will be named Roderigue Hortalès et Cie.; this is their
commercial name and signature, under which I find it convenient
that the whole operation shall be carried out.... One half million
exchanged into Portuguese pieces, the only money current in
America, will be promptly sent there, for there is an immediate
necessity for the Americans to have a little gold at once to give life
to their paper money, which without means of making it circulate
already has become useless and stagnant in their hands. It is the
little leaven that is necessary to put into the paste to raise it and
make it ferment usefully.
“Upon that half million no benefit can be obtained except the
return of it in Virginian tobacco, which Congress must furnish to the
house of Hortalès, who will have made a sale in advance to the
Farmers-General of France, by which they will take the tobacco from
them at a good price; but that is of no great consequence.
“Roderigue Hortalès counts on employing the second half million
in the purchase of cannon and powder, which he will forward at once
to the Americans.”

Here follows an exposition of the proceedings, with an


explanation of how, supposing the king permits him to buy powder
at actual cost price from the magazines, instead of buying it in the
market of France, Holland, or elsewhere, the money invested by the
king will increase not in double progression, 1-2-4-8, etc., but in
triple progression, 1-3-9-27, etc.
“Your Majesty will not be frightened at the complicated air that
this operation assumes under my pen, when you remember that no
commercial speculation is carried on or succeeds by any more simple
or more natural means than this.
“I have treated this affair in so far, Sire, in the spirit of a great
trader, who wishes to make a successful speculation and I have
developed to you the unique secret by which commerce in bulk
augments the prosperity of all states that have the good sense to
protect it....
“If the return in tobacco and the sale of the product take place
as I have pointed out, Your Majesty soon will find yourself in a
position to send back by the hands of Hortalès et Cie. the three
millions provided for from the price and profits of these returns, to
recommence operations on a larger scale.”
Then follow considerations upon the advisability of employing
Holland or French vessels for the transport of the munitions to Cape
Francis, chosen by Hortalès et Cie. as the first depot of commerce.
“Holding to the choice of French vessel charged to the account
of Roderigue Hortalès et Cie., Congress, or rather Mr. Adams,
Secretary of Congress, will be alone forewarned by the agent in
England that a vessel is carrying to him at Cape Francis both goods
and munitions, which are to be returned in Virginian tobacco, so that
he may send to the Cape upon a vessel loaded with tobacco an
agent who will bear his power to receive both and to send back by
the captain of Hortalès et Cie. the entire return in tobacco or at all
events a recognition that he owes Hortalès et Cie. the balance of the
amount for which he may not have been able to furnish return.”
So far in Beaumarchais’s mind, the mercantile undertaking was
to be for the king, only cloaked by the appearance of a mercantile
house. But it seems that the French government, anxious to evade
all possible risk and wishing to deny all connivance in the
transactions, decided to remain entirely foreign to the operation.
“We will give you secretly,” said the government, “a million. We
will try to obtain the same amount from the court of Spain. ... with
these two millions and the co-operation of private individuals, whom
you will associate in your enterprise, you will found your house and
at your own risk and perils you will provision the Americans with
arms and munitions, and objects of equipment and whatever is
necessary to support the war. Our arsenals will deliver to you these
things, but you will replace them or pay for them. You shall not
demand money of the Americans, because they have none, but you
shall ask returns in commodities of their soil, the sale of which we
will facilitate in our country.... In a word, the operation secretly
sanctioned by us at the outset must grow and develop through its
own support. But on the other hand, we reserve the right of favoring
or opposing it according to political contingencies. You will render us
an account of your profits and losses, while we will decide whether
we should grant you new subsidies or discharge you of all
obligations previously made.” (Loménie, II, p. 109.)
In this transaction, the responsibility of the agent to the United
States had no consideration. “The advances of the government were
simply a guarantee to Beaumarchais against loss.” (Durand, p. 90.)
The difficulties and dangers of this undertaking have been
admirably summed up by M. de Loménie. “They were of a nature to
cause any other man than Beaumarchais to hesitate.... He threw
himself into this, however, with all his usual intrepidity, and the tenth
of June, 1776, a month before the United States had published their
Declaration of Independence, he signed the famous receipt which,
kept secret under the monarchy, delivered to the United States in
1794, under the republic, occasioned a suit lasting fifty years, and to
which we shall return. The receipt read thus:
“‘I have received of M. Duvergier, conformably to the orders of
M. de Vergennes, on the date of the 5th of this month, the sum of
one million, for which I shall render count to my said Sieur Comte de
Vergennes.
“‘Caron de Beaumarchais.
“‘Good for a million of livres tournois.
“‘At Paris, this 10th of June, 1776.’

“Two months later, Spain advanced the like sum, besides which
Beaumarchais had associated with himself numerous private
individuals in France and elsewhere, so that his first sending to the
Americans surpassed in itself alone, three millions.” (Loménie, II, p.
110.)
Early in June the vast mercantile house of Roderigue Hortalès et
Cie. was established at Paris, while agents, clerks, and employees of
every sort were installed at the center of operations, as well as at
the various sources of supplies and in the seaports, Beaumarchais
remaining the head and center of action, in every place.
It so happened at this time, that a complete change was being
made in the equipment of the French army, so that the arsenals and
forts were charged with munitions of war, which the government
was willing to dispose of at a nominal price.
Before the arrival of Beaumarchais on the scene of action, the
Comte de Vergennes had countenanced and furthered the
operations begun by Franklin before he left London. Among the
agents employed by the latter were the Brothers Mantaudoin of
Nantes, who had undertaken the transportation of munitions of war
to the Americans. (Doniol, I, p. 373.)
Another agent and intimate friend of Franklin was a certain
Doctor Dubourg, a man more or less widely known as a scientist, but
possessing as well a decided taste for mercantile operations. He had
entered heartily into the cause of the Americans, and was very
zealous in forwarding munitions of war to the insurgents. He seems
at the beginning to have possessed to a considerable degree the
confidence of the French minister, who deigned to correspond with
him in person, and to consult him on several occasions. But as it
became necessary “to act on a grander scale, the intervention of the
friend of Franklin was no longer sufficient.” (Doniol, p. 374.) The
“faithful and discreet agent” spoken of in the Réflexions had long
been fixed in the mind of the Minister of War. The good doctor who
knew nothing of the relationship between the famous author of the
Barbier de Séville and the French Government or of his interest and
services in the cause of American Independence, all along had been
secretly aspiring to a complete control of the transactions. What
succeeded in convincing him that he was the man destined for the
place was that early in June, 1776, Silas Deane, the agent of the
Secret Committee of Congress, arrived in Paris charged with a letter
from Franklin to his “dear good friend Barbeu Dubourg,” with
express instructions to regard this latter as “the best guide to seek
after and to follow.” (Doniol, V. I, p. 485.)
Elated at this mark of esteem shown him by the colonies, the
good doctor undertook to fulfill then to the letter the instructions of
Congress and to prevent Silas Deane from coming in contact with
anyone but himself. Deane soon realized that though “inspired with
the best intentions in the world,” the doctor would be a “hindrance
rather than the essential personage pointed out by Franklin.”
(Doniol.) He therefore insisted so strongly upon meeting the French
minister that Dubourg was forced to yield. The meeting took place
the 17th day of July, 1776.
“It must be said of Silas Deane at this important meeting that
he fulfilled the intention of his mandate not only with intelligence,
but with a fecundity of reasoning which could only come from a
vigilant patriotism. All the impression which he could desire to
produce and which was hoped from his mission flowed from his
replies.” (Doniol, V. I, p.491.)
The Comte de Vergennes appeared to refuse to give the aid
asked, but he led Silas Deane to understand that a confidential
agent would take the matter in charge. This confidential agent was
no other than Beaumarchais.
Four days before this interview, the Doctor Dubourg had learned
to his great disappointment where the confidence of the minister
had been placed. Knowing nothing of the real situation, he thought
to dissuade the latter from his choice by attacking the private
character of the man who had usurped his place. The effect of his
letter upon the Comte de Vergennes can be judged from the fact
that the latter immediately communicated it to Beaumarchais
himself, who was charged with the reply.
The Doctor wrote:

“Monseigneur:
“I have seen M. de Beaumarchais this morning and conferred
with him without reserve. Everyone knows his wit, his talents, and
no one renders more justice to his honesty, discretion and zeal for all
that is good and grand; I believe him one of the most proper men in
the world for political negotiations, but perhaps at the same time,
the least proper for mercantile enterprises. He loves display, they say
that he keeps women; he passes in a word for a spendthrift and
there is not a merchant in France who has not this idea of him and
who would not hesitate to enter into the smallest commercial
dealings with him. Therefore, I was very much astonished when he
informed me that you had charged him not only to aid you with his
advice but had concentrated on him alone the ensemble and the
details of all the commercial operations....
“I represented to him that in taking the immense traffic and
excluding those who already had run so many dangers and endured
so many fatigues ... it would be doing them a real wrong.... But I
return to my first and principal reflection and implore you,
Monseigneur, to weigh it well. Perhaps there are a hundred, perhaps
a thousand persons in France with talents very inferior to those of M.
de Beaumarchais, who would fill better your views, inspire more
confidence, etc., etc....”

The reply of Beaumarchais, first published by M. de Loménie,


and since become so famous, is in the former’s most characteristic
style. It had its part to play as we shall see, in the trouble which
came to its author, and was partly responsible for the non-
recognition of his services by the American people. The good doctor
always retained a grudge against his brilliant and preferred rival.
From him Doctor Franklin imbibed in the beginning such a prejudice
against the indefatigable friend of the American cause, that he
always avoided him as much as possible. From the reply, a copy of
which Beaumarchais sent at the same time for the amusement of
the ministers, we quote the following:

“Tuesday, June 16, 1776.


“Eh! What has that to do with our affairs, that I am a man
widely known, extravagant, and who keeps women? The women
that I keep for the last twenty years are your very humble servants.
They were five, four sisters and one niece. For three years two of
these women are dead, to my great regret. I keep now only three,
two sisters and a niece, which is still extravagant for a private
individual like myself. But what would you have thought if, knowing
me better, you should have learned that I push scandal so far as to
keep men as well; two nephews, very young and good looking, even
the very unhappy father who brought into the world this scandalous
voluptuary? As for my display, that is even worse. For three years,
finding lace and embroidered garments too petty for my vanity, have
I not affected the pride of having my wrists always garnished with
the most beautiful fine muslin? The most superb black cloth is not
too elegant for me, at times I have been known to push dandyism
so far as to wear silk when it was very hot, but I beg you, Monsieur,
do not write these things to M. the Comte de Vergennes; you will
end in losing for me his good opinion.
“You have reasons for writing evil of me to him, without
knowing me. I have mine for not being offended, although I have
the honor of knowing you; you are, Monsieur, an honest man so
inflamed with the desire to do a great good that you have thought
you could permit yourself a little evil to arrive at it.
“This thought is not exactly the thought of the évangile but I
have seen a good many persons accommodate themselves to it. But
let us cease to speak lightly; I am not angry because M. de
Vergennes is not a small man and I hold to his reply. That those to
whom I apply for advances may distrust me I admit, but let those
who are animated with true zeal for their common friends look twice
before they alienate themselves from an honorable man who offers
to render every service and to make every useful advance to those
same friends. Do you understand me now, Monsieur?
“I will have the honor of meeting with you this afternoon. I have
also that of being with the highest consideration, Monsieur, your very
humble and very obedient servitor, well known under the name of
Roderigue Hortalès et Compagnie.”

It was on the 17th of July that Silas Deane and Beaumarchais


met for the first time. Both men recognized at once in the other the
man for whom each was looking. Both had warm, generous and
unselfish natures; both had their minds fixed upon one object alone,
the procuring and sending of aid as quickly as possible to the
insurged colonies. In excusing himself to Congress for discarding the
services of the “dear, good friend” of Franklin, Mr. Deane wrote: “I
have been forced to discourage my friend on seeing where the
confidence of M. de Vergennes was placed.” At the same time he
does ample justice to the kindness and interest manifested by
Dubourg.

“M. Dubourg has continued,” wrote Deane, “to render me every


assistance in his power.... His abilities and connections are of the
first class in this kingdom and his zeal for the cause of the colonies is
to be described only by saying that at times they are in danger of
urging him beyond both.”
Beaumarchais, on his side, finding Silas Deane empowered by
Congress to act directly, ceased to communicate with Arthur Lee.
Already a change had come in their relationship. Returned to
France and finding the government bent upon another form of
offering aid to the Americans, it had become necessary to break his
connections with Lee. Unable to explain the true nature of the
enterprise, being bound to absolute secrecy, Beaumarchais wrote
the 12th of June, 1776: “The difficulties which I have found in my
negotiations with the ministers have forced me to form a company
which will cause aid to reach your friends immediately by the way of
Cap Français.”
Naturally enough this meager information was very
unsatisfactory to Lee; more than this, he had hoped to play himself
a principal rôle in the enterprise (Spark’s Life of Franklin, p. 449).
From Beaumarchais he learned that Silas Deane had arrived
from the colonies empowered to treat with the ministers who had
refused steadily to permit his own appearance at Versailles; more
than this, he learned that Beaumarchais had entered at once into
negotiations with the agent of Congress and that he, Arthur Lee,
was being consulted by no one. “Enraged and disappointed,”
continued Sparks, “Lee hurried to Paris, where he endeavored to
bring about a quarrel between Deane and Beaumarchais. Failing in
this, he returned to London, vexed in his disappointment and furious
against Deane.” To avenge himself he wrote to the committee in
congress that the two men were agreed together to deceive at once
the French Government and the Americans by changing what the
former meant to be a gratuitous offering into a commercial
speculation. (Silas Deane Papers.)
As can readily be seen, these letters arriving in Philadelphia
before any report from Deane, predisposed Congress—two of whose
members were brothers of Arthur Lee, against the measures Deane
was taking with Beaumarchais. But for the moment, no one
interfered with their operations and both men were too intent upon
the all-important matter in hand to speculate upon the possible
results of the irritation of Doctor Dubourg, or the anger and jealousy
of Arthur Lee. Deane, however, fearing lest the noise of Lee’s visit to
Paris should offend the French Minister, addressed to the latter the
following letter:
“Sir: I was informed this morning of the arrival of Arthur Lee.
This was a surprise to me, as I know of no particular affair that
might call him here, and considering the extreme jealousy of the
British ministry at this time and that Mr. Lee was the agent of the
colonies in Great Britain, and known to be such, I could wish unless
he had received some particular orders from the United Colonies
that he had suspended his visit, as I know not otherwise how he can
serve me or my affairs—with profound gratitude I say it—now in as
favorable a course as the situation of the times will admit. I have the
honor to be,
“Silas Deane.”
(From Spark’s Dip. Correspondence, p. 40.)
Immediately after their first meeting, Beaumarchais had
addressed a letter to Deane of which the following is an extract:

“Paris, July 18, 1776.


“I have the honor to inform you that for a long while I have
formed the project of aiding the brave Americans to shake off the
yoke of England.... I have spoken already of my plans with a
gentleman in London (Arthur Lee), who says he is very much
attached to America; but our correspondence since I left England
has been followed with difficulty and in cipher; I have received no
reply to my last letter, in which I fixed certain points of this great
and important affair. Since you are clothed, Monsieur, with a
character which permits me to have confidence in you, I shall be
very well satisfied to recommence, in a more certain and regular
manner, a negotiation which till now has been barely touched....”

Silas Deane replied:


“Paris, Hôtel Grand-Villars, July 20, 1776.
“Monsieur:
“Conformably with your demand in our interview yesterday, I
enclose a copy of my commission and an extract of my instructions,
which will give you the certitude that I am authorized to make the
acquisitions for which I addressed myself to you....
“In regard to the credit which we demand and which I hope to
obtain from you, I hope that a long one will not be necessary. A year
is the most that my compatriots are in the habit of asking; and
Congress having engaged a great quantity of tobacco in Virginia and
Maryland which will be embarked as soon as ships can be procured,
I do not doubt but considerable returns in nature will be made within
six months, and the whole be paid for within the year. I shall press
Congress for this in my letters. Nevertheless, events are uncertain,
and our commerce is exposed to suffer; but I hope that whatever
comes you will soon receive sufficient returns to be enabled to wait
for the rest. In case that any sum whatever remains due after the
expiration of the accepted credit, it is of course understood that the
usual interest will be paid you for the sum.
“I am with all the respect and attachment possible, your, etc.
“Silas Deane.”

In his reply to this letter Beaumarchais after accepting the


conditions offered by the agent of Congress ends thus:
“As I believe I have to do with a virtuous people, it will suffice
for me to keep an exact account of all my advances. Congress will
be master to decide whether I shall be paid in merchandise at their
usual value at the time of their arrival or to receive them at the
buying price, the delays and assurances with a commission
proportional to the pains and care, which is impossible to fix to-day.
I intend to serve your country as though it were my own, and I hope
to find in the friendship of a generous people the true recompense
for my work which I consecrate to them with pleasure.”

In a lengthy letter written the 24th of July, 1776, the agent of


Congress set forth the difficulties of the enterprise in which they are
engaged.
He manifested also with warmth his grateful recognition of the
services of Beaumarchais. He wrote to him:

“Paris, July 24th, 1776.


“Monsieur:
“I have read with attention the letter which you have done me
the favor to write the 22nd, and I think that your propositions for
the regulation of the price of merchandise are just and equitable.
The generous confidence which you place in the virtue and justice of
my constituents inspires me with the greatest joy and gives me the
most flattering hopes for the success of this enterprise, for their
satisfaction as well as yours, and permit me to assure you again that
the United Colonies will take the most effective measures to send
you returns, and to justify in all respects the sentiments which
animate you toward them.
“Silas Deane.”

Nothing could be clearer and more explicit than the


understanding arrived at between Beaumarchais and Deane. The
latter possessed full power to act, and the former relied unreservedly
upon the good faith of the American Congress. In the meantime
Deane wrote, introducing his new friend to the Committee of Secret
Correspondence.

“Paris, August 18, 1776.


“... I was directed to apply for arms, etc., for 25,000 men....
This I wished to get of the ministry direct, but they evaded it and I
am now in treaty for procuring them through the Agency of M.
Chaumont and M. Beaumarchais, on credit of eight months, from the
time of their delivery. If I effect this as I undoubtedly shall, I must
rely on the remittance being made this fall and winter, without fail,
or the credit of the colonies will suffer....” (Spark’s Diplomatic
Correspondence, V. I, p. 28.)

Three days earlier he had written, “I find M. de Beaumarchais


possessed of the entire confidence of the ministry; he is a man of
wit and genius, and a considerable writer on comic and political
subjects. All my supplies come through his hands, which at first
greatly discouraged my friends....”
At the same time Beaumarchais, inflamed with zeal for the
cause of liberty, and wholly unconscious of the effect which his
sincere but fantastic letters would have upon the unexpansive nature
of the men to whom they were addressed, wrote the following to
Congress:

“Paris, August 18, 1776.


“Gentlemen:
“The respectful esteem which I bear towards that brave people
who so well defend their liberty under your conduct has induced me
to form a plan concurring in this great work by establishing an
extensive commercial house ... to supply you with necessaries of
every sort that can be useful for the honorable war in which you are
engaged. Your deputies, gentlemen, will find in me a sure friend, an
asylum in my home, money in my coffers, and every means of
facilitating their operations whether of an open, or of a secret
nature. I will, so far as possible, remove all obstacles that may
oppose your wishes, from the politics of Europe.... The secrecy
necessary in some parts of the operations which I have undertaken
for your service, requires also on your part a formal resolution that
all vessels and their demands should be directed constantly to our
house alone, in order that there may be no idle chatting or loss of
time, two things that are the ruin of affairs....
“... I shall facilitate your unloading, selling, or disposing of that
which I do not wish.... For instance, five American vessels have just
arrived in the port of Bordeaux laden with salt fish; though this
merchandise coming from strangers is prohibited in our ports, yet as
soon as your deputy had told me that these vessels were sent to him
by you to raise money by the sale for aiding him in his purchases in
Europe, I took such care that I secretly obtained from the
government an order for the landing without notice being taken....
“I shall have a correspondent in each seaport town, who on the
arrival of your vessels shall wait on the captain and offer every
service in his power.... Everything which you wish to arrive safely in
any country in Europe ... shall go with great punctuality through me,
and this will save much anxiety and many delays. I request you,
gentlemen, to send me next spring, if it is possible, ten or twelve
thousand hogsheads or more if you can of tobacco of the best
quality from Virginia.
“You will understand well that my commerce with you is carried
on in Europe; that it is in the great ports of Europe that I make and
take returns. However well founded my house may be and though I
have appropriated many millions to your trade alone, yet it would be
impossible for me to support it, if all the dangers of the sea, of
exports and imports were not entirely at your risks....
“Your deputy shall receive as soon as possible full power and
authority to accept what I shall deliver to him, to receive my
accounts, examine them, make payments upon them or enter into
engagements which you shall be bound to ratify as the head of the
brave people to whom I am devoted. In short, you may always treat
of your interests directly with me.
“Notwithstanding the open opposition which the King of France
and his ministers show, and ought to show, to the violation of
foreign treaties ... I dare promise you, gentlemen, that my
indefatigable zeal shall never be wanting to clear up all difficulties,
soften prohibitions, and, in short, facilitate all operations of
commerce....
“One thing can never diminish; it is the avowed and ardent zeal
which I have in serving you to the utmost of my power....
“Look upon my house, then, gentlemen, henceforth, as the chief
of all useful operations to you in Europe and my person as one of
the most zealous partisans of your cause, the soul of your success,
and a man most deeply impressed with the respectful esteem with
which I have the honor to be, etc.
“Roderigue Hortalès et Cie.”

“It must be admitted,” says Loménie, “that the letters of


Beaumarchais were curious enough by their medley of patriotism
and commercialism, both equally sincere with him, to inspire distrust
in the minds already prejudiced. Imagine serious Yankees, who
nearly all before having made war had been merchants, receiving
masses of stuff, embarked often in secret, during the night, and
whose bills presented in consequence certain irregularities,
accompanied with letters in which Beaumarchais associated
protestations of enthusiasm, offers of limitless services, political
counsels and demands for tobacco, indigo, and salt fish.
“The calculating minds of the Yankees were naturally inclined to
think that a being so ardent and fantastic, if he really existed, was
playing a commercial comedy concurred in by the government and
that one might with all security of conscience utilize his remittances,
read his amplifications, and dispense with sending him tobacco,”
which, as we shall soon see, was exactly what happened.
Infinite difficulties and complications, however, were to arise
before even the first shipments could leave the ports of France, and
in August the cargoes were not yet collected.
The sixteenth of August Beaumarchais wrote to Vergennes:

“It is decided that all vessels coming from America shall be


addressed to the house of Hortalès.... So many things must be
carried on together without counting the manufacture of cloth and
linen, that I am forced to take on more workers. This affair politico-
commerçante is becoming so immense that I shall drown myself in
details as well as the few aids which I have employed up to the
present time, if I do not add more. Some will travel, some reside in
the seaports, the manufactories, etc.
“I have promised tobacco to the Farmers-General, and I ask it
of the Americans. Their hemp will be a good commodity. At last I
begin to see the way clear for my business. The only thing which I
do not see are those fatal letters-patent of which I have neither wind
nor news.... M. de Maurepas tells me every time he sees me, ‘It is
attended to, it is finished.’... I should have had them Tuesday. Here it
is Friday, but the letters have not come. At the end of the session of
parliament this delay of three days makes me lose three months,
because of vacation. I am not angry but distressed to see my
condition so equivocal and my future uncertain.” (Doniol, V. I, p.
513-14.)

As shown in the above letter, Beaumarchais while beginning his


extraordinary operations for the Americans was not forgetful of his
own interests. He was still a civilly degraded man with no solid basis
upon which to build. Gudin, in his history of Beaumarchais, says:
“Arriving from London, May, 1776, he presented a petition to the
council in order to obtain letters of relief; that is, letters of the king
by which it was permitted him to appeal from the judgment
rendered against him, although the delay accorded by law had long
expired.
“The development of his projects called him to the west coast of
France; he did not wish to go until his request was admitted.
“‘Go all the same,’ M. de Maurepas said to him. ‘The council will
pronounce very well without you.’”
The projects alluded to by Gudin were, of course, his mercantile
operations for supplying the Americans with munitions of war. But so
well did Beaumarchais guard his secret, that his dearest friend knew
as little of the real nature of his enterprise as the rest of the world.
In his visit to the ports of France during the summer of 1776, Gudin
accompanied him. Their reception at Bordeaux is described by the
latter.
Here as elsewhere, Beaumarchais hid his real occupation under
the show of seeking amusement.
“When it was known,” says Gudin, “of our arrival, invitations
poured in upon us from every side; the women received him as the
most amiable of men, the merchants as the most intelligent, the
crowds as the most extraordinary; we passed several days in the
midst of festivities.... All the while Beaumarchais was preparing new
commercial combinations.
“One evening, on entering, he found several letters from Paris;
he read them while I was preparing for bed, hurried by fatigue to
repose myself. I asked him if he was satisfied with his news.
“‘Very well,’ he said to me without the least emotion. I was soon
asleep. In the morning I felt myself pulled by the arm; I wakened,
recognized him and asked if he were ill.
“‘No,’ he replied, ‘but in half an hour we leave for Paris.’
“‘Eh, pourquoi? What has happened? Have you been sent for?’
“‘The council has rejected my demands.’
“‘Ah, ciel! and you said nothing to me last evening?’
“‘No, my friend, I did not wish to disturb your night. It was
enough that I did not sleep. I have been thinking all night of what
there is for me to do. I have decided, my plan is formed and I go to
execute it....’
“Sixty hours later we were in Paris.
“‘Eh, what,’ he said to M. de Maurepas, who was somewhat
surprised to see him so promptly, ‘while I was running to the
extremities of France to look after the affairs of the king, you lose
mine at Versailles.’
“‘It is a blunder of Mormesnil (the minister of justice). Go find
him, tell him that I want him, and come back together.’
“They explained themselves all three. The matter was taken up
under another form, the council judged differently, the request was
granted and letters of relief obtained the 12th of August, 1776.”
This, however, was but the first step. The letters patent simply
allowed Beaumarchais the privilege of having his case brought up a
second time for judgment. At this juncture, a new difficulty
presented itself. In the words of Loménie: “It was the end of August;
the parliament was about to enter on its vacation and it did not wish
to take up the matter until afterwards. But Beaumarchais did not
adjourn so easily anything once begun. He went again to M. de
Maurepas, and persuaded that one is never better served than by
himself he did with the first minister what we have seen him do with
the king. He drew a note for the first president of Parliament and for
the solicitor-general, had M. de Maurepas to sign two copies of the
note and send one to each of the above officials.” The notes ran
thus:

“Versailles, this 27th of August, 1776.


“That part of the affairs of the king with which M. de
Beaumarchais is charged, requires, Monsieur, that he make several
voyages very shortly. He fears to leave Paris before his case has
been tried. He assures me that it can be done before vacation. I do
not ask any favor as to the ground of the affair, but only celerity for
the judgment; you will oblige him who has the honor to be, very
truly yours, etc.
“Maurepas.”

In the same way, Beaumarchais served himself through


Monsieur de Vergennes, obtaining with the same facility the favor
which he desired. He wrote:

“August 29th, 1776.


“I had the honor of seeing M. le Comte de St.-Germain
yesterday.... I was very well received.... After two hours’
conversation, he wished to keep me to dinner. But can a miserable
unfortunate who is running after the solution of his lawsuit take time
to dine? I left him, but I have hope that he will be an additional
protector. If all is not well, at least all is not bad. I have drawn up a
letter intended to correct the fault committed.
“It is your reply to his letter. Pardon, M. de Comte, if I have
taken the liberty of acting as your secretary. For so long I have been
attached to you by all possible titles, if you approve of the letter
there is only a signature and an envelope necessary.” (Doniol, V. I, p.
574.)

M. de Loménie continued: “This was still not sufficient for


Beaumarchais. He wished the Attorney-General Seguier to speak and
to be eloquent in his favor; for this he wrote a letter to Maurepas,
accompanied by another note, rather more expressive, for M.
Seguier, a note which the minister copied with the same docility as
the preceding one.” It runs as follows:

“Versailles, this 30th of August, 1776.


“I learn, Monsieur, by M. de Beaumarchais, that if you have not
the goodness to speak on his affair it will be impossible for him to
obtain a judgment before the 7th of September. That part of the
affair of the king with which M. de Beaumarchais is entrusted
requires that he make a voyage very soon; he fears to leave Paris
before he is restored to his estate as citizen; it has been so long now
that he suffers, and his desire in this respect is truly legitimate. I ask
no favor as to the ground of the affair, but you will oblige me
infinitely if you will contribute towards having him judged before
vacation.
“I have the honor to be, etc. Maurepas.”

The trial took place. Beaumarchais chose for his defense a


lawyer, Target, who had remained firm during the entire existence of
the parliament Maupeou, refusing to plead before it.
“Beaumarchais,” says Loménie, “always faithful to his taste for mise
en scène, wrote him a letter which circulated everywhere and which
commenced with the words, ‘The Martyr Beaumarchais to the Virgin
Target.’”
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookname.com

You might also like