Advertisement
Guest User

Untitled

a guest
Jun 19th, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. from twisted.enterprise import adbapi
  2.  
  3. dbpool = adbapi.ConnectionPool("MySQLdb", host="localhost",user="a",password="b",db="c")
  4.  
  5. def getTime():
  6. return dbpool.runQuery("SELECT NOW() AS TIME")
  7.  
  8. def printResult(result):
  9. if result:
  10. print("yes")
  11. else:
  12. print("no")
  13.  
  14. getTime().addCallback(printResult)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement