comparison roundup/backends/back_postgresql.py @ 3715:50add98cbbac

change as per last message in patch [SF#1429391]
author Richard Jones <richard@users.sourceforge.net>
date Tue, 03 Oct 2006 23:15:09 +0000
parents ff9f4ca42454
children 5770f1802cd0
comparison
equal deleted inserted replaced
3714:23c682387985 3715:50add98cbbac
1 #$Id: back_postgresql.py,v 1.34 2006-08-29 04:20:50 richard Exp $ 1 #$Id: back_postgresql.py,v 1.35 2006-10-03 23:15:09 richard Exp $
2 # 2 #
3 # Copyright (c) 2003 Martynas Sklyzmantas, Andrey Lebedev <andrey@micro.lt> 3 # Copyright (c) 2003 Martynas Sklyzmantas, Andrey Lebedev <andrey@micro.lt>
4 # 4 #
5 # This module is free software, and you may redistribute it and/or modify 5 # This module is free software, and you may redistribute it and/or modify
6 # under the same terms as Python, so long as this copyright message and 6 # under the same terms as Python, so long as this copyright message and
10 __docformat__ = 'restructuredtext' 10 __docformat__ = 'restructuredtext'
11 11
12 import os, shutil, popen2, time 12 import os, shutil, popen2, time
13 try: 13 try:
14 import psycopg 14 import psycopg
15 from psycopg import QuotedString
15 except: 16 except:
16 import psycopg2 as psycopg 17 from psycopg2 import psycopg1 as psycopg
18 from psycopg2.extensions import QuotedString
17 import logging 19 import logging
18 20
19 from roundup import hyperdb, date 21 from roundup import hyperdb, date
20 from roundup.backends import rdbms_common 22 from roundup.backends import rdbms_common
21 23
200 self.cursor = self.conn.cursor() 202 self.cursor = self.conn.cursor()
201 203
202 def sql_stringquote(self, value): 204 def sql_stringquote(self, value):
203 ''' psycopg.QuotedString returns a "buffer" object with the 205 ''' psycopg.QuotedString returns a "buffer" object with the
204 single-quotes around it... ''' 206 single-quotes around it... '''
205 return str(psycopg.QuotedString(str(value)))[1:-1] 207 return str(QuotedString(str(value)))[1:-1]
206 208
207 def sql_index_exists(self, table_name, index_name): 209 def sql_index_exists(self, table_name, index_name):
208 sql = 'select count(*) from pg_indexes where ' \ 210 sql = 'select count(*) from pg_indexes where ' \
209 'tablename=%s and indexname=%s'%(self.arg, self.arg) 211 'tablename=%s and indexname=%s'%(self.arg, self.arg)
210 self.sql(sql, (table_name, index_name)) 212 self.sql(sql, (table_name, index_name))

Roundup Issue Tracker: http://roundup-tracker.org/