Unit 02 of 03
Data Access
The database access layer, transactions, migration management, the queries behind object–relational mapping, data formats and the HTTP client — at every point where the application reads and writes data, whether the result is decided by the code, the environment or an outside party.
Published Updated
Lessons
- 01 The Database Access Layer Sets up a PDO connection, the error mode, prepared statements, named and positional placeholders and fetch modes; when a connection option comes from the environment, measures who can change the type of the returned value. 1 min read
- 02 Transactions Runs a transfer between two accounts with and without a transaction; when the second write fails, measures who can change the balance total, and shows what a transaction without a rollback call does not protect. 1 min read
- 03 Migration Management Builds migration files, a migration log table, ordered application and rollback in a small mechanism; measures that the database state decides how many migrations are applied in a run, while the code decides the schema version. 1 min read
- 04 Queries Behind Object–Relational Mapping Counts the queries sent while a list is printed with a counter; measures that the query count grows with the rows in lazy loading, stays at two in eager loading, and that the query text can still change with the data sent. 1 min read
- 05 Data Formats Parses JSON, XML and CSV text from a partner; measures who can change the result when the partner writes the same field differently, and shows whose choice the number notation in our own response is. 1 min read
- 06 The HTTP Client Builds an HTTP client from request and response objects, a transport closure, a timeout exception, retry and a fallback value; measures how the price reported by the service and these defenses change who owns the result. 1 min read