Beispiel #1
0
 def execute(self, sql=None):
     if sql is None:
         return None
     
     resultRow = []
     cursor = None
     try:
         cursor = self.db.cursor()
         cursor.execute(sql)
     
         result = cursor.fetchall()
         if result is not None:
             for r in result:
                 resultRow.append(r)
         return resultRow
     except pymysql.MySQLError, e:
         raise cloudstackException.dbException("db Exception:%s"%e[1]) 
Beispiel #2
0
    def execute(self, sql=None):
        if sql is None:
            return None

        resultRow = []
        cursor = None
        try:
            # commit to restart the transaction, else we don't get fresh data
            self.db.commit()
            cursor = self.db.cursor()
            cursor.execute(sql)

            result = cursor.fetchall()
            if result is not None:
                for r in result:
                    resultRow.append(r)
            return resultRow
        except pymysql.MySQLError, e:
            raise cloudstackException.dbException("db Exception:%s" % e)
 def execute(self, sql=None):
     if sql is None:
         return None
     
     resultRow = []
     cursor = None
     try:
         # commit to restart the transaction, else we don't get fresh data
         self.db.commit()
         cursor = self.db.cursor()
         cursor.execute(sql)
     
         result = cursor.fetchall()
         if result is not None:
             for r in result:
                 resultRow.append(r)
         return resultRow
     except pymysql.MySQLError, e:
         raise cloudstackException.dbException("db Exception:%s"%e)