equal
deleted
inserted
replaced
86 |
86 |
87 def system_sql(self, sql, args=None): |
87 def system_sql(self, sql, args=None): |
88 """return a sql cursor on the system database""" |
88 """return a sql cursor on the system database""" |
89 if not sql.split(None, 1)[0].upper() == 'SELECT': |
89 if not sql.split(None, 1)[0].upper() == 'SELECT': |
90 self.mode = 'write' |
90 self.mode = 'write' |
91 cursor = self.pool['system'] |
91 return self.pool.source('system').doexec(self, sql, args) |
92 self.pool.source('system').doexec(cursor, sql, args) |
|
93 return cursor |
|
94 |
92 |
95 def set_language(self, language): |
93 def set_language(self, language): |
96 """i18n configuration for translation""" |
94 """i18n configuration for translation""" |
97 vreg = self.vreg |
95 vreg = self.vreg |
98 language = language or self.user.property_value('ui.language') |
96 language = language or self.user.property_value('ui.language') |
135 """the session need a pool to execute some queries""" |
133 """the session need a pool to execute some queries""" |
136 if self._closed: |
134 if self._closed: |
137 raise Exception('try to set pool on a closed session') |
135 raise Exception('try to set pool on a closed session') |
138 if self.pool is None: |
136 if self.pool is None: |
139 # get pool first to avoid race-condition |
137 # get pool first to avoid race-condition |
140 self._threaddata.pool = self.repo._get_pool() |
138 self._threaddata.pool = pool = self.repo._get_pool() |
141 try: |
139 try: |
142 self._threaddata.pool.pool_set() |
140 pool.pool_set() |
143 except: |
141 except: |
144 self._threaddata.pool = None |
142 self._threaddata.pool = None |
145 self.repo._free_pool(self.pool) |
143 self.repo._free_pool(pool) |
146 raise |
144 raise |
147 self._threads_in_transaction.add(threading.currentThread()) |
145 self._threads_in_transaction.add(threading.currentThread()) |
148 return self._threaddata.pool |
146 return self._threaddata.pool |
149 |
147 |
150 def reset_pool(self): |
148 def reset_pool(self): |