예제 #1
0
 def eliminar(cls, persona):
     with CursorDelPool() as cursor:
         logger.debug(cursor.mogrify(cls.__ELIMINAR))
         logger.debug(f'Persona a eliminar: {persona}')
         valores = (persona.get_id_persona(),)
         cursor.execute(cls.__ELIMINAR, valores)
         
         return cursor.rowcount
예제 #2
0
 def insertar(cls,persona):
     with CursorDelPool() as cursor:
         
         logger.debug(cursor.mogrify(cls.__INSERTAR))
         logger.debug(f'Persona a insertar: {persona}')
         valores = (persona.get_nombre(),persona.get_apellido(), persona.get_email())
         cursor.execute(cls.__INSERTAR, valores)
         return cursor.rowcount
예제 #3
0
 def actualizar(cls,persona):
     with CursorDelPool() as cursor:
         logger.debug(cursor.mogrify(cls.__ACTUALIZAR))
         logger.debug(f'Persona a actualizar: {persona}')
         valores = (persona.get_nombre(),persona.get_apellido(), persona.get_email(), persona.get_id_persona())
         cursor.execute(cls.__ACTUALIZAR, valores)
     
         return cursor.rowcount
예제 #4
0
 def seleccionar(cls):
     with CursorDelPool() as cursor:
         logger.debug(cursor.mogrify(cls.__SELECCIONAR))
         cursor.execute(cls.__SELECCIONAR)
         registros = cursor.fetchall()
         personas=[]
         for registro in registros:
             persona=Persona(registro[0],registro[1],registro[2],registro[3])
             personas.append(persona)
         return personas