(self, db_or_curs, q, args, commit = True, quiet = False, prefix = None)
Run SQL on db with code/value error handling.
Run SQL on db with code/value error handling.
Run SQL on db with code / value error handling .
def exec_cmd(self, db_or_curs, q, args, commit = True, quiet = False, prefix = None):
        """Run SQL on db with code/value error handling."""
        if hasattr(db_or_curs, 'cursor'):
            db = db_or_curs
            curs = db.cursor()
        else:
            db = None
            curs = db_or_curs
        (ok, rows) = self._exec_cmd(curs, q, args, quiet, prefix)
        if ok:
            if commit and db:
                db.commit()
            return rows
        else:
            if db:
                db.rollback()
            if self.options.verbose:
                raise Exception("db error")
            # error is already logged
            sys.exit(1)
def exec_cmd ( self , db_or_curs , q , args , commit = True , quiet = False , prefix = None ) : if hasattr ( db_or_curs , 'cursor' ) : db = db_or_curs curs = db . cursor ( ) else : db = None curs = db_or_curs ( ok , rows ) = self . _exec_cmd ( curs , q , args , quiet , prefix ) if ok : if commit and db : db . commit ( ) return rows else : if db : db . rollback ( ) if self . options . verbose : raise Exception ( "db error" ) # error is already logged sys . exit ( 1 )