You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kubsu-sm5-ruby/lab2/tests/test_select_db.rb

19 lines
734 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

require_relative '../db_connection'
require_relative '../providers/students_list_db'
students_db = StudentsListDB.new
# получение студента с ID = 1
student = students_db.get_student_by_id(1)
puts student ? student.get_info : "Студент не найден"
# получение второй страницы по 2 записи (если записей достаточно)
data_list = students_db.get_k_n_student_short_list(2, 2)
puts "Количество студентов: #{students_db.get_student_short_count}"
data_table = data_list.get_data
(0...data_table.rows_count).each do |row|
row_data = (0...data_table.columns_count).map { |col| data_table.item(row, col) }
puts row_data.join(" | ")
end