MySQL databases may be used by programs written in the C programming language on Socrates and Plato and on the IS Solaris workstations. Full details of the C API (Application Program Interface) are given in the MySQL manual at http://www.mysql.com/doc/en/C.html.
The following example program (in file prog.c) should be compiled with this Unix command:
cc -I/usr/local/include/mysql prog.c -lmysqlclient -lsocket -lnsl -lm -lz
This program displays the second and third fields (numbered 1 and 2) of each row of table people in database ucabwww where field age is greater than 30:
#include <mysql.h> #include <stdio.h>
main() { MYSQL *conn; MYSQL_RES *res; MYSQL_ROW row;