I should maybe specify: I'm using the C prepared statement API, so not SQL prepared statements. E.g.:
stmt = mysql_stmt_init(sql);
mysql_stmt_prepare(stmt, "SELECT f()", 10);
mysql_stmt_execute(stmt);
Output in server log is something like this:
110124 18:20:02 23 Connect user@localhost on db
23 Prepare SELECT f()
Output SHOULD be:
110124 18:20:02 23 Connect user@localhost on db
23 Prepare SELECT f()
23 Execute SELECT f()
The C code works fine if I use something like, say, "SELECT 1", and the stored function works fine if used from the mysql command line. It also works fine if I use prepare stmt on the command line. Just the combination C prepared statement and stored function seems to be causing problems.
Addendum: I was originally going to use a stored procedure and simply SELECT my result back from the table (the final function I want to use read some stuff, then writes some stuff and returns some info on what it wrote), however you can't have multiple results with prepared statements from what I read, so I redesigned the whole thing as a stored function. At first I thought it might be due to the unusual things I was doing with the function, but even simple ones won't work.
Edited 1 time(s). Last edit at 01/24/2011 01:46PM by Daniel Keyhani.