<s> import threading <EOL> import Queue <EOL> sqlSubmitQueue = Queue . Queue ( ) <EOL> sqlReturnQueue = Queue . Queue ( ) <EOL> sqlLock = threading . Lock ( ) <EOL> def sqlQuery ( sqlStatement , * args ) : <EOL> sqlLock . acquire ( ) <EOL> sqlSubmitQueue . put ( sqlStatement ) <EOL> if args == ( ) : <EOL> sqlSubmitQueue . put ( '<STR_LIT>' ) <EOL> else : <EOL> sqlSubmitQueue . put ( args ) <EOL> queryreturn = sqlReturnQueue . get ( ) <EOL> sqlLock . release ( ) <EOL> return queryreturn <EOL> def sqlExecute ( sqlStatement , * args ) : <EOL> sqlLock . acquire ( ) <EOL> sqlSubmitQueue . put ( sqlStatement ) <EOL> if args == ( ) : <EOL> sqlSubmitQueue . put ( '<STR_LIT>' ) <EOL> else : <EOL> sqlSubmitQueue . put ( args ) <EOL> sqlReturnQueue . get ( ) <EOL> sqlSubmitQueue . put ( '<STR_LIT>' ) <EOL> sqlLock . release ( ) <EOL> def sqlStoredProcedure ( procName ) : <EOL> sqlLock . acquire ( ) <EOL> sqlSubmitQueue . put ( procName ) <EOL> sqlLock . release ( ) <EOL> class SqlBulkExecute : <EOL> def __enter__ ( self ) : <EOL> sqlLock . acquire ( ) <EOL> return self <EOL> def __exit__ ( self , type , value , traceback ) : <EOL> sqlSubmitQueue . put ( '<STR_LIT>' ) <EOL> sqlLock . release ( ) <EOL> def execute ( self , sqlStatement , * args ) : <EOL> sqlSubmitQueue . put ( sqlStatement ) <EOL> if args == ( ) : <EOL> sqlSubmitQueue . put ( '<STR_LIT>' ) <EOL> else : <EOL> sqlSubmitQueue . put ( args ) <EOL> sqlReturnQueue . get ( ) <EOL> def query ( self , sqlStatement , * args ) : <EOL> sqlSubmitQueue . put ( sqlStatement ) <EOL> if args == ( ) : <EOL> sqlSubmitQueue . put ( '<STR_LIT>' ) <EOL> else : <EOL> sqlSubmitQueue . put ( args ) <EOL> return sqlReturnQueue . get ( ) </s>
