I have been doing some reading/experimenting with the prepared statements. One of the issues I found is in the scope of visibility of the statements. From the MySQL 5.1 reference manual
http://dev.mysql.com/doc/refman/5.1/en/prepare.html, chapter 12.6.1
"The scope of a prepared statement is the session within which it is created. Other sessions cannot see it. "
To test this, I logged into mysql and created a simple prepared statement and executed it. It returned as expected. I then created a simple app in lazarus to execute the prepared statement and received an error "Unknown prepared statement handler given to EXECUTE"
I then used the .execSQL function to create a prepared statement from my app:
query.SQL.Text := 'prepare get_more_names From ''select AlbumName from Albums''';
query.ExecSQL;
The statement executes, (however I am unable to return a result as expected - I need to do more testing); but the prepared statement was found and executed as should be. I then went back to the mysql command prompt to execute get_more_names and received 'Unknown prepared statement handler' error.
I am not sure if I am on the right track - if this is totally off base from your issue, but as I see it, this could be a part of the problem. I know there are some members out there with way more smarts on this than I -- anybody else care to help out??