Advertisement
Guest User

Untitled

a guest
May 11th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.81 KB | None | 0 0
  1. import kinterbasdb,sys
  2.  
  3. # Classe de manipulation du SGBD
  4. class FBhandler:
  5.  
  6.     def __init__(self,domain,path,login="SYSDBA",passwd="masterkey"):
  7.         self.controller = kinterbasdb.connect(host=domain, database=path ,user=login, password=passwd)
  8.        
  9.     def query(self,request):
  10.         ptr = self.controller.cursor()
  11.         ptr.execute(request)
  12.         return ptr.fetchall()
  13.        
  14. host = "10.0.0.251"
  15. db = "/bases/prosper.gdb"
  16.  
  17. # Initialise le controller
  18. controller = FBhandler(host,db)
  19. # Ouvre le fichier
  20. file_handle = open("mail.txt","w")
  21.  
  22. # Procedure d'aspiration :
  23. for feed in ["MAIL_CAB","MAIL_DOM"]:
  24.     for email in controller.query("select "+feed+" from client"):
  25.         print(email)
  26.         if email != None and email[0] != None and email[0] != "":
  27.             file_handle.write(str(email[0]))
  28.             file_handle.write("\r\n")
  29.            
  30. file_handle.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement