I’m trying to write a program that reads operations from a file. these operators look like below :
CREATE TABLE student(id:integer, gpa:decimal, name:string, family:string,isMale:Boolean)
INSERT INTO student(id,gpa,name,fami
SELECT id, name FROM student WHERE id=0
then the program will have a parser that translates these lines and makes a database to do the operations.
after parsing and execution of each line ;a log will be made in a another file:
ERROR: Duplicate column name
family Table student created
ERROR: Table student already exists
ERROR: Invalid table name st
as for the assignment I shouldn’t use prepared packages for storing data like sql. so I’ve chosen JSON(JSON – simple) for making a more organized database and I will use regular expression for parser.
my first question is if I’m using the right tools for this task.
and my second question is how should I design the program so it will have a good OOP quality in respect to how classes and methods are written.
for example I’m writing a prototype code that reads simple lines from input file then simply splits them to an array and writes them into an output text file(see this question for the code I’ve written) . how should I design the objects.? should write and read parts be methods in a same class? should they be static methods?