C and MySQL

If you're using C to write MySQL database applications, you will need the C API to communicate with the MySQL server. Like all APIs, it is the lowest common denominator for passing instructions and information between your application and a MySQL database.

The C API is distributed with MySQL. Unlike other languages, such as Perl with its DBI, there is no need to download or install it separately.

The administrative clients that come with MySQL, such as the mysql client program, are written in C and based on this API. If you installed MySQL from source, you may be interested to look at the C code of these programs, which you'll find in your MySQL source directory, in mysql-VERSION/client.

With the advent of MySQL version 4, it is now possible to embed MySQL into a C application. Although today's lesson shows you how to build a C application that uses the API to talk to MySQL, in Day 20, “Embedding the MySQL Server,” you will learn how to create an application that embeds an entire MySQL server into your C program.

Note

In today's lesson, I will refer frequently to NULL. Note that this means a C NULL pointer rather than a NULL value in a MySQL table.

In addition, note that the terms column and field are synonymous. Many of the API's functions include the word field, which makes it easier to refer to a field than a column, even though the meaning is the same.


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.167.183