Ejemplo n.º 1
0
 def load_into_db(self,):
     dict_ = {
     'email': self.email,
     'password': self.password,
     'name': self.name,
     'type_account': self.type_account,
     'mute_status': self.mute_status,
     'ban_status': self.ban_status
     }
     # sql_query = """UPDATE player SET email=%(email); UPDATE player SET name=%(name)s;
     #  UPDATE player SET password=%(password); UPDATE player SET type_account=%(type_account);
     #  UPDATE player mute_status=%(mute_status); UPDATE player ban_status=$(ban_status)"""
     sql_query = """INSERT INTO `player` (`email`, `password`, `name`, `type_account`, `mute_status`, `ban_status`)
         VALUES (%(email)s, %(password)s, %(name)s, %(type_account)s, %(mute_status)s, %(ban_status)s);
     """
     with con:
         cur = con.cursor()
         cur.execute(sql_query, dict_)
     result = "load into db successful"
     return result
Ejemplo n.º 2
0
 def load_into_db(self, ):
     dict_ = {
         'email': self.email,
         'password': self.password,
         'name': self.name,
         'type_account': self.type_account,
         'mute_status': self.mute_status,
         'ban_status': self.ban_status
     }
     # sql_query = """UPDATE player SET email=%(email); UPDATE player SET name=%(name)s;
     #  UPDATE player SET password=%(password); UPDATE player SET type_account=%(type_account);
     #  UPDATE player mute_status=%(mute_status); UPDATE player ban_status=$(ban_status)"""
     sql_query = """INSERT INTO `player` (`email`, `password`, `name`, `type_account`, `mute_status`, `ban_status`)
         VALUES (%(email)s, %(password)s, %(name)s, %(type_account)s, %(mute_status)s, %(ban_status)s);
     """
     with con:
         cur = con.cursor()
         cur.execute(sql_query, dict_)
     result = "load into db successful"
     return result
Ejemplo n.º 3
0
import MySQLdb
from connection_sys import con
r = ''
with con:
    cur = con.cursor()
    cur.execute("SELECT * FROM player")
    for row in cur.fetchall():
        r += str(row)
print r
sql_query = 'delete FROM players.player where id_player = %(id)s'
sql_data = {'id': r[1]}
with con:
    cur = con.cursor()
    cur.execute(sql_query, sql_data)