2016-03-02 14:29 GMT+01:00 m <m...@pavis.biodec.com>: > * Carlo Miron (ca...@golang.it) [160302 14:21]: >> >> >>> sto migrando un' applicazione da sqlite a mysql, funziona tutto tranne >>> che >>> per il fatto che se effettuo degli insert o update da un client queste >>> sono visibili >>> solo al client che esegue queste modifiche, mentre su tutti gli altri >>> devo chiudere l'applicazione e riavviarla. >>> Controllando sul server, le tabelle si aggiornano correttamente. >>> E' come se gli altri client vedessero le tabelle del server solo quando >>> si >>> apre la connessione. >> >> > > secondo me perché stanno all'interno di una transazione, e non la > chiudono mai, e il server sta andando con un livello di isolamento > 'repeatable read' --- quindi gli fa vedere sempre lo stesso 'snapshot' > del database > > se è quello (wild guess): > - puoi o portare il livello di isolamento a 'read committed' > (sconsigliato) > - o cambiare l'applicazione in modo che chiuda la transazione (soluzione > corretta) > > per inciso, se la diagnosi è corretta, avresti quel comportamento anche > con postgresql o altri db
la diagnosi è corretta. la cura, che non è farina del mio sacco, sarebbe la seguente...non credo ti piaccia :( cur = self.con.cursor() cur.execute("SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED") cur.execute("SELECT @@session.tx_isolation") cur.execute(sql,args) if fetch == True: rs = cur.fetchall() else: rs = cur.fetchone() cur.execute("SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ") cur.execute("SELECT @@session.tx_isolation") cur.close() return rs p.s. concordo anche con l'approfondita analisi di carlo.... ;) giuseppe > > -- > .*. finelli > /V\ > (/ \) -------------------------------------------------------------- > ( ) Linux: Friends dont let friends use Piccolosoffice > ^^-^^ -------------------------------------------------------------- > > First shalt thou take out the Holy Pin. Then, shalt thou count to three, > no more, no less. Three shalt be the number thou shalt count, and the > number of the counting shalt be three. Four shalt thou not count, nor > either count thou two, excepting that thou then proceed to three. Five > is right out. Once the number three, being the third number, be reached, > then lobbest thou thy Holy Hand Grenade of Antioch towards thou foe, who > being naughty in my sight, shall snuff it. > > _______________________________________________ > Python mailing list > Python@lists.python.it > http://lists.python.it/mailman/listinfo/python _______________________________________________ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python