Re: Can prepared statement created in thread1 can be used in thread2?
Posted by: Ken Kavanagh
Date: March 30, 2012 07:04PM

it is possible but a bad idea. a prepared statment is bound to some specific memory. if t1 and t2 both happen to input their own values to a stmt's predicate at the same time, you'll get crazy output.

proper practice is to create a thread specific stmt. if you're writting a parallel query handlers with multiple threads waiting on queue input, each thread would have its own stack of prepared stmts.

each thread however, should (not 100% sure if mandatory on win32) call mysl_thread_init(). so says the docs (http://dev.mysql.com/doc/refman/5.5/en/mysql-thread-init.html)

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Can prepared statement created in thread1 can be used in thread2?
1382
March 30, 2012 07:04PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.