GADriverSQLiteTestFixture
Overview
Please comment me using the following template inspired by Class Responsibility Collaborator (CRC) design:
For the Class part: State the name of the class with one line description: For example, I'm xxx the root of the hierarchy of visitor objects.
For the Responsibility part: Three sentences about my main responsibility, what I'm doing, what services do I offer.
For the Collaborators Part: State my main collaborators and one line about how I interact with them.
Public API and Key Messages
- label item
One simple example is simply gorgeous.
Internal Representation and Key Implementation Points.
Implementation Points
Instance Method Details
createDatabase
Nothing
createDatabase| encoding |
encoding := self connection encoding = 'utf8' .
self connection execute: ('PRAGMA encoding = "' , encoding) , '"'
createTables
createTablesself connection execute: 'CREATE TABLE student(
id INTEGER,
name_surname CHARACTER VARYING(30),
username VARCHAR(10),
pass VARCHAR(10),
mail VARCHAR(50),
regular BOOLEAN,
age SMALLINT,
average_grade DECIMAL(9,3),
sex CHARACTER(3),
description CHARACTER VARYING(200),
starting_hour TIME,
sign_up_date TIMESTAMP,
born_date DATE,
nullable_field VARCHAR(64) NULL,
CONSTRAINT pk_students_id PRIMARY KEY (id)
)'.
self connection execute: 'CREATE TABLE signature(
code INTEGER,
id_student INTEGER,
name CHARACTER VARYING(50),
course_grade INTEGER,
final_grade INTEGER,
observations CHARACTER VARYING(255)
)'.
self connection execute: 'CREATE TABLE course(
id_course INTEGER,
id_student INTEGER,
code_signature INTEGER,
starting_date DATE,
CONSTRAINT pk_courses_id_course PRIMARY KEY (id_student, code_signature)
)'
dropDatabase
We remove the database file
dropDatabaseself connection isMemory ifFalse: [ self connection database asFileReference delete ]
dropTables
dropTables
newConnection:
We always create the connection for testing with the same options in sqlite by the moment
newConnection: options