February 2015
Intermediate to advanced
338 pages
8h 16m
English
In our current system, the balance of the single account is stored in a file and read and written by the BalanceStore class. In our new design, we will make the Account responsible for reading the balance straight out of a database instead. It’s refactoring time again!
Once you have installed MySQL[47] you will need to create a database and user. This can be done simply, using the setup-bank.sql script:
| databases/00/setup-bank.sql | |
| | CREATE DATABASE bank; |
| | CREATE USER 'teller'@'localhost' IDENTIFIED BY 'password'; |
| | GRANT ALL ON bank.* TO 'teller'@'localhost'; |
As you can see, this script creates a database called bank. It then adds a user teller with password password and ...