Project

General

Profile

« Previous | Next » 

Revision 2665

sql.py: DbConn: Added can_mogrify() and use it in mogrify()

View differences:

lib/sql.py
269 269
    
270 270
    def esc_name(self, name): return esc_name(self, name) # calls global func
271 271
    
272
    def mogrify(self, query, params=None):
272
    def can_mogrify(self):
273 273
        module = util.root_module(self.db)
274
        if module == 'psycopg2': return self.db.cursor().mogrify(query, params)
275
        else: raise NotImplementedError("Can't mogrify query for "+module
276
            +' database')
274
        return module == 'psycopg2'
277 275
    
276
    def mogrify(self, query, params=None):
277
        if self.can_mogrify(): return self.db.cursor().mogrify(query, params)
278
        else: raise NotImplementedError("Can't mogrify query")
279
    
278 280
    def run_query(self, query, params=None, cacheable=False, log_level=2,
279 281
        debug_msg_ref=None):
280 282
        '''

Also available in: Unified diff