def execute(self, sql, value=None):
        """
        @brief      execute sql commands, return result if it has
        @param      sql  String
        @param      value  Tuple
        @return     result  Array
        """
        c = self.conn.cursor()
        self.lock.acquire()
        hasReturn = sql.lstrip().upper().startswith("SELECT")

        try:
            if value:
                c.execute(sql, value)
            else:
                c.execute(sql)

            if hasReturn:
                result = c.fetchall()
        except Exception, e:
            Log.error(traceback.format_exc())
        finally:
            self.lock.release()

        self.conn.commit()

        if hasReturn:
            return result

        @brief      execute sql commands, return result if it has
        @param      sql  String
        @param      value  Tuple
        @return     result  Array
        
wxbot_project_py2.7/db/sqlite_db.py