This chapter covers database development related to CO-FOSS development.
Database Principles
Databases are persistant because its own lifetime and the data stored in it exceed the lifetime of the program or programs that access it. The databases have multiple structures, one being the relational model. This uses SQL or a structured query language. I’m pretty familiar with SQL and relational database structures.
Table naming conventions suggest the attribute names that unify a table with its corresponding class’s instance variable. Tables that are normalized result in more efficent queries, although some designs end up not fully normalized. Concurrency control is also needed because in a client server type application, two clients could try and access the database at once and cause a collision.
Connecting to a Program
These databases are connected to programming languages by database extensions. The extension depends on the type of database your using (MySQL, PostreSQL, SQLite). It is also necessary to create CRUD functions otherwise known as Create, Retrieve, Update, and Delete an individual row in that table. These are achieved by different mySQL queries.
Database Security
A secure database prevents unauthorized access to data and ensures data integrity. This means the data stored is always accurate. This security is achieved by controlling which users have what privleges. Restricting access ensures a hierarchy in the system. There are four levels of access that are controlled:
- Server level
- Database level
- Table level
- Column level
Testing
There is a three step process for unit testing each database module.
- Setup - create objects and insert new rows in the table, C
- Test - replace and update rows in the table, R U
- Teardown - D
In summary, this chapter covered the basics in database architecture and general testing of the database portion of an application that runs a CO-FOSS archiecture.