Код: Выделить всё
class EventAges:
def __init__(self, EventAgeName, EventAgeStart, EventAgeEnd):
self.EventAgeName = EventAgeName
self.EventAgeStart = EventAgeStart
self.EventAgeEnd = EventAgeEnd
Код: Выделить всё
def add_event_ages(self, event_ages):
query = '''INSERT INTO EventAges (EventAgeId, EventAgeName, EventAgeStart, EventAgeEnd) VALUES ( ?, ?, ?)'''
values = ( event_ages.EventAgeName, event_ages.EventAgeStart, event_ages.EventAgeEnd)
self.cursor.execute(query, values)
self.connection.commit()
EventAgeId = self.cursor.lastrowid
return EventAgeId
Как включить EventAgeId в класс конструктор, не требуя его при вставке в таблицу?
Подробнее здесь: https://stackoverflow.com/questions/786 ... l-on-inser