Refactor db handler interface
What file or files will be changed by the refactor Db handler code, model code for databases
Describe what changes will be made by the refactor
-
refactor model functions like getFieldsInOrder
andgetValuesInOrder
to become one function that returns an object with the fields as keys and their values as object values. -
Have db interface take a DbQuery
model, which than has a function that returns the sql string. -
Have DbQuery
model be extended byDbGet
,DbDelete
, andDbSet
models that take the values relevant and produces the sql string as above.
Describe the benefits of the refactor
-
Reduces coupling between model functions, don't need to ensure same order of the fields/values.
-
Reduces coupling between db interface and rest of the code, no longer will need
dbGet.course
,dbDelete.course
, etc. -
Provides structure to db handling, ensures improper raw strings won't happen.