KyleChaplin / Payroll-System

0 stars 0 forks source link

Code Cleanup! #16

Closed KyleChaplin closed 5 months ago

KyleChaplin commented 7 months ago
KyleChaplin commented 7 months ago

Using log4j I have added more in-depth logging to the database controller class.

image

KyleChaplin commented 6 months ago

When testing a different schedule, it was a lot easier to see where and what was wrong due to the new logging.

image

image

KyleChaplin commented 6 months ago

image

KyleChaplin commented 6 months ago

Looking to use the SQL 'MERGE' statement, it performs an 'INSERT' operation when a record doesn't exist and a 'UPDATE' operation when it does exist.

KyleChaplin commented 5 months ago

The DatabaseController class now has been broken down into smaller classes, more specialized classes, each responsible for a specific aspect of database operations (e.g., one class for reading, another for writing, etc.).

The classes are below:

DatabaseConnection - responsible for handling connecting and disconnecting from the database. DatabaseChecks - used to perform checks on the database (ensures all tables are present) and get environment info. CreateTables - handles the creation of tables if called required (checked in DatabaseChecks). UpdateTablesConstraints - updates the constraints of each table so the database can function as required. UpdateTableData - holds all the methods used to update records within tables. CheckTableData - methods that perform boolean checks on the database are in this class. GetTableData - retrieval of data from database tables is performed using methods in this class. DeleteTableData - used to handle to deletion of records from the database. InitialiseTables - stores a single method that performs checks, adds, and updates (only used for the current schedule). Encryption - stores all methods related to encrypting, decrypting, and hashing before storing them in the database. MiscMethod - every other method that does not fit the above classes.