Method: DBSourceAdapter#add_student

Defined in:
lib/source/repositories/adapters/db_source_adapter.rb

#add_student(student) ⇒ Object



30
31
32
33
34
# File 'lib/source/repositories/adapters/db_source_adapter.rb', line 30

def add_student(student)
  template = 'INSERT INTO student(last_name, first_name, father_name, phone, telegram, email, git) VALUES (?, ?, ?, ?, ?, ?, ?)'
  @db.prepare_exec(template, *student_fields(student))
  @db.query('SELECT LAST_INSERT_ID()').first.first[1]
end