Sean O'Dell wrote:
>
> Where can I get started using the C API for MySQL under RedHat
> Linux? I got MySQL installed and running and have walked through
> the mysql client tutorial. Now I need to program using it. I'm not
> unfamiliar with SQL, but I haven't actually done any plain old SQL/C
> programming (ODBC using SQL, yes). I've got plenty of reading
> material on SQL and the MySQL C API seems simple enough, but I don't
> know how to put basic SQL together with the C API. That is, I've
> got something partially working, but I'm unsure what I ought to be
> doing to do things like lookup a record, modify it, add records,
> etc, etc.
>
> A book or tutorial on programming to the MySQL C API would be very
> helpful. Is there anyone who can point me in the right direction?
>
> Thanks,
>
> -Sean
You call mysql_connect(), check for errors with
mysql_error() then select the database with
mysql_select_db() then call mysql_query() and if you
care to pick up the results,
mysql_store_result() or mysql_use_result() and then
mysql_fetch_row() while it returns a non NULL. When
done, mysql_free_result(), and mysql_close().
--
Sasha Pachev
http://www.sashanet.com/ (home)
http://www.direct1.com/ (work)