From: Michael Widenius Date: August 16 2009 1:48pm Subject: re: EXECUTE and PREPARE - last minute issue List-Archive: http://lists.mysql.com/internals/37261 Message-Id: <19080.3614.273431.682277@narttu.askmonty.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi! >>>>> "Joseph" == Joseph Lukas writes: Joseph> I am having last minute issues with these 2 statements. I have spent Joseph> most of the day looking at the issue but have not had any luck solving Joseph> it. If the prepared statements contain a SET STATEMENT they will work Joseph> fine. Joseph> However when you put something like SET STATEMENT var1 = X FOR EXECUTE Joseph> mystatement1; I get errors/crash. After working on it for most of Joseph> the day I have determined that the error is caused by the Items being Joseph> removed. The pointers become invalid and forces a crash. The set_var, Joseph> and sys_var's both stay valid from my set_var list used by the reset Joseph> function only the Items containing the values disappear. The reason for this is that MySQL automaticly deletes all items after the end of the statement. Can you provide us with what exactly goes wrong ? In your case, there is some things you can do: - Ensure that you don't call free_items() in the middle of a statement. - If you want to remember items over several statements, like we do with prepare, you need to provide your own memroot for the duration of your items. See Prepared_statement::prepare(). Regards, Monty