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]



Best way to access field name in C

2004-10-11 Thread Matthew Boehm
What is the best way to access a specific field in C? Its really easy in
PHP...

PHP
---
$res = mysql_real_query($mysql,SELECT col1, col2 FROM table);
while($row = mysql_fetch_row($res)) {
print $row['col1'];
print $row['col2'];
}

Is the only way/best way to do the above in C by using a nested for-loop?
Ex:

fields = mysql_fetch_fields(res);
while((row=mysql_fetch_row(res)) {
for(x=0;xnumFields;x++) {
sprintf(output, Column name: %s  Column Value: %s\n,
fields[x].name, row[x]);
}
}

Seems painful and extra-loopy to do it in C. Is there a better way?

Thanks,
Matthew


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



How Do I Determine the Server's Version on Old Server?

2004-10-08 Thread Matthew Boehm
Hey guys,
 I see there is a mailing list for all other API's except the built in one.
Hmmm. Anyway, I'm writing an app in C that will connect to a MySQL database
server and run some queries. I'd like to use prepared statements in some
cases but since prepared statements are only available in 4.1 or higher I
need to find out what the server's version is first.
 Normally I could just check MYSQL_VERSION_ID and if it is greater or equal
to 40100 then I can use the prepared statements. But, in my case, I'm using
the 4.1 client libraries but the test server I'm connecting to is 3.23.50
which will not support prepared statements. But if I use my MYSQL_VERSION_ID
method, everything will seem ok and the compiler will put in the unusable
4.1 code.

 I found this function on the docs: mysql_get_server_version()

 However, the docs say this was added in 4.1.

 So, how do I find the server's version that I am connected to if the
function I need to use won't work on pre 4.1 and the VERSION_ID check won't
work for different client-server versions?

Thanks,
Matthew
-- 

Matthew Boehm
[EMAIL PROTECTED]
The University of Texas at Austin, Department of Geography

Why did the prison use Windows2K as a guard? Because it always locks up!
?PHP echo PHP kicks ASP!; ?




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