Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

51 linhas
999 B

  1. #!/usr/bin/python
  2. # -*- coding: utf-8; tab-width: 4; indent-tabs-mode: nil; -*-
  3. from decorators import WSGIMySQL # decoratore ( singleton )
  4. wsgisql = WSGIMySQL()
  5. #
  6. # esempio minimo di controller WSGI
  7. #
  8. @wsgisql.db( 'mywiki', 'shoot' )
  9. def application( environ, start_response ):
  10. cur = environ['mysql.mywiki.cur']
  11. #
  12. # esecuzione query
  13. #
  14. cur.execute( 'SHOW tables;' )
  15. #
  16. # recupero record e generazione html
  17. #
  18. start_response( '200 OK', [('content-type', 'text/html; charset=utf-8')] )
  19. yield "<h1>elenco tabelle presenti nel db mywiki</h1>"
  20. for record in cur.fetchall():
  21. yield str( record ) + "<br>"
  22. #
  23. # recupero secondo cursore
  24. #
  25. cur2 = environ['mysql.shoot.cur']
  26. #
  27. # esecuzione query
  28. #
  29. cur2.execute( 'SHOW tables;' )
  30. #
  31. # recupero record e generazione html
  32. #
  33. yield "<h1>elenco tabelle presenti nel db shoot</h1>"
  34. for record in cur2.fetchall():
  35. yield str( record ) + "<br>"