MySQL’s C API

This section outlines the creation of a very simple C application for accessing the small database created in the preceding “whirlwind tour” section.

Don’t Try This at Work, Kids

The program in Listing 1.3 makes a very good, tight, small, simple program. It does not make good Software Engineering. There are many things wrong with it, such as the following:

  • Main() is entirely too long.

  • The SHOW statements could be abstracted to a single function, with the only parameter being the string defining it.

  • It does not contain enough comments.

  • The database it is hitting is unsecured.

  • The database name and host name are hardcoded in the routine.

And on and on. My point is, Listing 1.3 is an example for this section of this book. It is not representative ...

Get MySQL Building User Interfaces now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.