Ñò dÖMc@svddkZddkZddkZddkZdd d„ƒYZdd d„ƒYZdd d„ƒYZd„ZdS( iÿÿÿÿNt ConnectioncBs/eZdd„Zd„Zd„Zd„ZRS(cCsd|_||_dS(N(tNonetdbcontlog(tselfR((s9/home/olivier/project/pgsql/contrib/openBarter/cron/db.pyt__init__s cCs”d|_yVtidtidtidtidtidti ƒ|_|ii ti i ƒWn+ti j o}|idƒ|‚nX|iS(Ntdatabasetpasswordtuserthosttports!could not connect to the database(RRtpsycopg2tconnecttsettingst DATABASE_NAMEtDATABASE_PASSWORDt DATABASE_USERt DATABASE_HOSTt DATABASE_PORTtset_isolation_levelt extensionstISOLATION_LEVEL_AUTOCOMMITtErrorterror(Rte((s9/home/olivier/project/pgsql/contrib/openBarter/cron/db.pyt __enter__s        cCs?|o|idt|ƒfƒn|iiƒd|_tS(NsAn error %s occured(RtstrRtcloseRtFalse(Rttypetvaluettb((s9/home/olivier/project/pgsql/contrib/openBarter/cron/db.pyt__exit__&s   cCs/|io|ii|ƒnti|IJdS(N(RRtsyststderr(RR((s9/home/olivier/project/pgsql/contrib/openBarter/cron/db.pyR-s N(t__name__t __module__RRRR R(((s9/home/olivier/project/pgsql/contrib/openBarter/cron/db.pyRs   tCurorIntcBs eZdZd„Zd„ZRS(s pas fini cCs||_|iiƒ|_dS(N(tconntcursortcur(RR&((s9/home/olivier/project/pgsql/contrib/openBarter/cron/db.pyR5s cCs|i|ƒdS(N(texecute(Rtargv((s9/home/olivier/project/pgsql/contrib/openBarter/cron/db.pyR)9s(R#R$t__doc__RR)(((s9/home/olivier/project/pgsql/contrib/openBarter/cron/db.pyR%3s tCursorcBs2eZdZd„Zd„Zd„Zd„ZRS(s includes a transaction cCs||_||_dS(N(R&R(RR&R((s9/home/olivier/project/pgsql/contrib/openBarter/cron/db.pyRAs cCs|iiƒ|_|iS(N(R&R'(R((s9/home/olivier/project/pgsql/contrib/openBarter/cron/db.pyREs cCs5|tijo|i|iƒn|iiƒtS(s¯ if(exc_type==None): self.cursor.execute("COMMIT") # self.log.info("COMMIT") else: self.cursor.execute("ROLLBACK") self.log.error("ROLLBACK",exc_info=True) (R RRtpgerrorR'RR(Rtexc_typetexc_valtexc_tb((s9/home/olivier/project/pgsql/contrib/openBarter/cron/db.pyR Ss  cCs/|io|ii|ƒnti|IJdS(N(RRR!R"(RR((s9/home/olivier/project/pgsql/contrib/openBarter/cron/db.pyRbs (R#R$R+RRR R(((s9/home/olivier/project/pgsql/contrib/openBarter/cron/db.pyR,=s    ccshxatoY|iƒ}|pPnh}x/t|iƒD]\}}||||ds    # +