summaryrefslogtreecommitdiff
path: root/db_proxy.py
diff options
context:
space:
mode:
authoryvesf <yvesf@d0e8fea9-7529-0410-93fb-d39fd5b9c1dd>2009-06-10 05:31:26 +0000
committeryvesf <yvesf@d0e8fea9-7529-0410-93fb-d39fd5b9c1dd>2009-06-10 05:31:26 +0000
commit7279c2ba6e9ad29a8e635c21d5549b21d7b8c461 (patch)
tree7664877372ac8cb3e145d8cc9eb429bbf5420aeb /db_proxy.py
parent39c6f9c39789e3941575e55e30c401d3c51657b4 (diff)
downloadomegle-7279c2ba6e9ad29a8e635c21d5549b21d7b8c461.tar.gz
omegle-7279c2ba6e9ad29a8e635c21d5549b21d7b8c461.zip
idlecount
git-svn-id: http://xapek.org/svn/common/omegle@1097 d0e8fea9-7529-0410-93fb-d39fd5b9c1dd
Diffstat (limited to 'db_proxy.py')
-rw-r--r--db_proxy.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/db_proxy.py b/db_proxy.py
index f21b363..9e5273e 100644
--- a/db_proxy.py
+++ b/db_proxy.py
@@ -15,7 +15,7 @@ class DBThread(Thread):
def __init__(self,conn_str):
Thread.__init__(self)
# dbconn = ...("dbname='yvesf' user='dbuser' host='localhost' password='dbpass'")
- self.conn = pyPgSQL.PgSQL.connect(conn_str)
+ self.conn = pyPgSQL.PgSQL.connect(conn_str, client_encoding="utf-8", unicode_results=1)
self.queue = Queue.Queue()
self.running = True
def run(self):
@@ -25,13 +25,13 @@ class DBThread(Thread):
msg = self.queue.get(block=True,timeout=2)
except Queue.Empty:
continue
- logging.getLogger("").debug("Insert %s" % msg)
cur = self.conn.cursor()
sql = """INSERT INTO omegle_messages(send_time,from_ident,to_ident,message)
VALUES (CURRENT_TIMESTAMP, %s, %s, %s)"""
cur.execute(sql,(msg['from_ident'],msg['to_ident'],msg['message']))
cur.close()
self.conn.commit()
+ logging.getLogger("").debug("commit" % msg)
def add_message(self,from_ident,to_ident,message):
self.queue.put_nowait({'from_ident':from_ident,'to_ident':to_ident,'message':message})