|
|
|
|
| |
The source file begins by including the header files my_global.h and mysql.h. Depending on what a MySQL client does, it may need include other header files as well, but usually these two are the bare minimum:
my_global.h takes care of including several other header files that are likely to be generally useful, such as stdio.h. It also includes windows.h for Windows compatibility if you're compiling the program on Windows. (You may not intend to build the program under Windows yourself, but if you plan to distribute your code, having that file included will help anyone else who does compile under Windows.)
mysql.h defines the primary MySQL-related constants and data structures.
The order of inclusion is important; my_global.h is intended to be included before any other MySQL-specific header files.
Next, the program declares a set of variables corresponding to the parameters that need to be specified when connecting to the server. For this client, the parameters are hardwired to have default values. Later, we'll develop a more flexible approach that allows the defaults to be overridden using values specified either in option files or on the command line. (That's why the names all begin with opt_; the intent is that eventually those variables will become settable through command options.) The program also declares a pointer to a MYSQL structure that will serve as a connection handler.
The main() function of the program establishes and terminates the connection to the server. Making a connection is a two-step process:
|
|
|
|
|
|
| Link Partners: Asia florist, Flowers to India, Hong kong flowers, Site submit, Cheap web hosting, China florist, Japan florist |
|