Re: C API: Storing is easy; How do you retrieve?

2005-05-03 Thread Philippe Poelvoorde
Matthew Boehm wrote:
Hey guys,
 (Why is there no C API specific list?)
I want to write a C application that can take some audio file, store it in
MySQL, then at a later date/time (upon request) pull from db and write to
temporary file to be streamed.
I've got the storing portion of the code down. The problem I have is, how do
I SELECT out the audio and store it to a file on the local disk?
2 solutions for it.
you can retrieve the data :
mysql_query(mysql_conx, "SELECT audio FROM ...");
myres = mysql_store_result(mysql_conx);
myrow = mysql_fetch_row(myres);
audiodata = stripslashes(myrow[0]);
(providing you escape characters);
then the usual C function should do the trick (fopen, fwrite...)
or SELECT INTO OUTFILE (check the manual, I don't know the details ;) to 
store the file on the server.

--
Philippe Poelvoorde
COS Trading Ltd.
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: C API: Storing is easy; How do you retrieve?

2005-05-01 Thread Karam Chand
The docs should have it.

Basically these API is what you require (in order):

mysql_init();
mysql_real_connect();
mysql_real_query();
mysql_store_result() or mysql_use_result();
mysql_fetch_row();
mysql_free_result;
mysql_close ();

HTH

--- Matthew Boehm <[EMAIL PROTECTED]> wrote:
> Hey guys,
>  (Why is there no C API specific list?)
> 
> I want to write a C application that can take some
> audio file, store it in
> MySQL, then at a later date/time (upon request) pull
> from db and write to
> temporary file to be streamed.
> 
> I've got the storing portion of the code down. The
> problem I have is, how do
> I SELECT out the audio and store it to a file on the
> local disk?
> 
> Any examples? Sample code? Specific API functions I
> should look at?
> 
> I've seen how this is done using ODBC, but the ODBC
> code is really crappy
> and not at all as easy as MySQL API.
> 
> Thanks,
> Matthew
> 
> 
> 
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:   
>
http://lists.mysql.com/[EMAIL PROTECTED]
> 
> 

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



C API: Storing is easy; How do you retrieve?

2005-05-01 Thread Matthew Boehm
Hey guys,
 (Why is there no C API specific list?)

I want to write a C application that can take some audio file, store it in
MySQL, then at a later date/time (upon request) pull from db and write to
temporary file to be streamed.

I've got the storing portion of the code down. The problem I have is, how do
I SELECT out the audio and store it to a file on the local disk?

Any examples? Sample code? Specific API functions I should look at?

I've seen how this is done using ODBC, but the ODBC code is really crappy
and not at all as easy as MySQL API.

Thanks,
Matthew



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]