Hello,
I need to implement timeout for execute method in Mysql queries. I am using
MySQLdb.
I have tried it:
signal.signal(signal.SIGALRM,handler)
signal.alarm(1)
cursor.execute(sql)
signal.alarm(0)
But handler is never executed. In other example (changing cursor.execute by
time.sleep(5)) it is executed. Maybe execute disables signals? In Perl it is
disabled b ut there is a way to use.
I found it:
http://mail.python.org/pipermail/tut...ly/015343.html
And:
http://www.timo-tasi.org/python/timeoutsocket.py
I prefer to use alarm method (more clear, less instrusive, I only need it)
Any way how to do? I will read now tmieoutsocket.py to learn some way,
but they are not using signals or alarms.
Thank you very much,
--
Carles Pina i Estany GPG id: 0x8CBDAE64
http://pinux.info