Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Jan 2003 08:12:49 -0500
From:      Bill Moran <wmoran@potentialtech.com>
To:        Paul Hamilton <paul@computerwest.com.au>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: How can data be inserted into a MySQL DB using C code?
Message-ID:  <3E26AFD1.5040508@potentialtech.com>
References:  <AGEHIFHGNEMPFNCPLONMAENJEBAA.paul@compwest.com.au>

next in thread | previous in thread | raw e-mail | index | archive | help
Paul Hamilton wrote:
> Hi All,
> 
> Step one was collecting the data, Step two is to somehow get the info into a
> MySQL DB.
> 
> I am monitoring a serial port's CTS line, and need to get the fact that it's
> changed state logged into the DB.
> 
> I can use C and/or PHP.  Perl is beyond me :-(  (I have trouble enough just
> trying to add Perl modules).

This is OT for the FreeBSD lists.  MySQL has several list where you'll have
more people subscribed who can help you.

However, it sounds like you want to use the MySQL C API.  If you install the
MySQL client, the C API is included (if memory serves).  All you have to do
is write your code to use it, and be sure to give the proper options to cc
when you compile to link in the MySQL libraries.
This page starts the docs on the MySQL C API.
http://www.mysql.com/doc/en/C.html

> The C program runs continuously, monitoring the CTS bit, so I thought it
> would be nice to dump the info straight into the MySQL DB.
> 
> As a backup, I suppose, I could dump the 'date/time' and 'CTS-Open-Closed'
> into a text file, then once a day, run a PHP script to import the files
> contents into the MySQL DB.  However, that means I wouldn't get any live
> data.

That sounds pretty clunky.

> I know there is the MySQL++ project, but I had problems trying to get that
> to function, and my C++ knowledge is negligible.
> 
> Any help, or tips would be grateful.
> 
> Cheers,
> 
> Paul Hamilton

-- 
Bill Moran
Potential Technologies
http://www.potentialtech.com


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3E26AFD1.5040508>