Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select id from tbl005_league_club where name = 'PERFUMERIAS AVENIDA'
- self.connection = pymysql.connect(host = DDBB.DDBB_HOST,
- user = DDBB.DDBB_USER,
- password = DDBB.DDBB_PSWD,
- db = DDBB.DDBB_NAME,
- charset = DDBB.DDBB_CHARSET,
- cursorclass=pymysql.cursors.DictCursor)
- def query(self, sql, data):
- """Método que devuelve un objeto ResultData con el resultado de la consulta"""
- try:
- with self.connection.cursor() as cursor:
- totalRows = cursor.execute(sql, data)
- print("Total Rows: " + str(totalRows))
- print("Ultima query: " + cursor.mogrify(sql, data))
- data = cursor.fetchall()
- if totalRows > 0:
- result = ResultData(RESULT.RESULT_OK, data, totalRows)
- else:
- result = ResultData(RESULT.RESULT_OK, None, totalRows)
- return result
- except Exception as error:
- raise DDBBException("DAOMySQL", "query", error,
- "Se ha producido un error al hacer la consulta")
Add Comment
Please, Sign In to add comment