70 |
|
|
71 |
class PGSQL_DataObject(DBSIG_DataObject): |
class PGSQL_DataObject(DBSIG_DataObject): |
72 |
|
|
73 |
schema2nativeTypes={"auto":"int4", |
encodingList={'ascii' : 'SQL_ASCII', # ASCII |
74 |
"int":"int", |
'' : 'EUC_JP' # Japanese EUC |
75 |
"number":"int", |
'' : 'EUC_CN', # Chinese EUC |
76 |
"float":"float", |
'' : 'EUC_KR', # Korean EUC |
77 |
"decimal":"decimal", |
'' : 'JOHAB', # Korean EUC (Hangle base) |
78 |
"varchar":"varchar", |
'' : 'EUC_TW', # Taiwan EUC |
79 |
"char":"char", |
'utf-8' : 'UNICODE', # Unicode (UTF-8) |
80 |
"blob":"text", |
'' : 'MULE_INTERNAL', # Mule internal code |
81 |
"text":"text", |
'iso8859-1' : 'LATIN1', # ISO 8859-1 ECMA-94 Latin Alphabet No.1 |
82 |
"longtext":"text", |
'iso8859-2' : 'LATIN2', # ISO 8859-2 ECMA-94 Latin Alphabet No.2 |
83 |
"date":"date", |
'iso8859-3' : 'LATIN3', # ISO 8859-3 ECMA-94 Latin Alphabet No.3 |
84 |
"datetime":"datetime", |
'iso8859-4' : 'LATIN4', # ISO 8859-4 ECMA-94 Latin Alphabet No.4 |
85 |
"timestamp":"timestamp"} |
'iso8859-9' : 'LATIN5', # ISO 8859-9 ECMA-128 Latin Alphabet No.5 |
86 |
|
'iso8859-10': 'LATIN6', # ISO 8859-10 ECMA-144 Latin Alphabet No.6 |
87 |
|
'iso8859-13': 'LATIN7', # ISO 8859-13 Latin Alphabet No.7 |
88 |
|
'iso8859-14': 'LATIN8', # ISO 8859-14 Latin Alphabet No.8 |
89 |
|
'iso8859-15': 'LATIN9', # ISO 8859-15 Latin Alphabet No.9 |
90 |
|
'iso8859-16': 'LATIN10', # ISO 8859-16 ASRO SR 14111 Latin Alphabet No.10 |
91 |
|
'iso8859-5' : 'ISO-8859-5', # ECMA-113 Latin/Cyrillic |
92 |
|
'iso8859-6' : 'ISO-8859-6', # ECMA-114 Latin/Arabic |
93 |
|
'iso8859-7' : 'ISO-8859-7', # ECMA-118 Latin/Greek |
94 |
|
'iso8859-8' : 'ISO-8859-8', # ECMA-121 Latin/Hebrew |
95 |
|
'' : 'KOI8', # KOI8-R(U) |
96 |
|
'' : 'WIN', # Windows CP1251 |
97 |
|
'' : 'ALT', # Windows CP866 |
98 |
|
'' : 'WIN1256', # Arabic Windows CP1256 |
99 |
|
'' : 'TCVN', # Vietnamese TCVN-5712 (Windows CP1258) |
100 |
|
'' : 'WIN874'} # Thai Windows CP874 |
101 |
|
|
102 |
def __init__(self, pgdriver=None, pgresultset=None): |
def __init__(self, pgdriver=None, pgresultset=None): |
103 |
DBSIG_DataObject.__init__(self) |
DBSIG_DataObject.__init__(self) |
138 |
raise GDataObjects.LoginError, value |
raise GDataObjects.LoginError, value |
139 |
|
|
140 |
try: |
try: |
|
encoding = "" |
|
141 |
try: |
try: |
142 |
encoding = connectData['encoding'] |
self._databaseEncoding = connectData['encoding'] |
143 |
except KeyError: |
except KeyError: |
144 |
# if encoding is not defined in connectData use gnue.conf setting instead |
pass |
145 |
try: |
|
146 |
encoding = gConfig('encoding') |
encoding = self.encodingList(self._databaseEncoding) |
|
except: |
|
|
pass |
|
147 |
|
|
148 |
if encoding.upper() not in ("",'DEFAULT'): |
if encoding.upper() not in ("",'DEFAULT'): |
149 |
GDebug.printMesg(1,'Setting postgresql client_encoding to %s' % encoding) |
GDebug.printMesg(1,'Setting postgresql client_encoding to %s (%s)' % (encoding, |
150 |
|
self._databaseEncoding)) |
151 |
cursor = self._dataConnection.cursor() |
cursor = self._dataConnection.cursor() |
152 |
cursor.execute("SET CLIENT_ENCODING TO '%s'" % encoding) |
cursor.execute("SET CLIENT_ENCODING TO '%s'" % encoding) |
153 |
cursor.close() |
cursor.close() |