13 November 2011

Simple transaction database implementation

After a bit of messing about with android database tutorials and mocking up simple ERDs with the mySQL workbench tool, I've managed to come up with a basic database design model. I'll be starting off with one table and implementing the features of the database as I implement each iteration of functionality in to the app. I'll be starting with the fuel transaction side of things, which means I've set up a fuel transaction table. So far the columns that exist are transaction id, user id, price, mileage, volume, fuel type and comments. The primary key is the Transaction ID, and the user id which is not being used at the minute, will be a foreign key.

Other Tables that will be included will be a car manufacturer table, a car model table and a user table. It's current state is quite simplistic in it's design but it will grow in complexity over time.

As for the implementation of this database, so far today I've managed to implement a database helper class, which deals with creating the tables if they don't already exist and updating the database if changes are made to the structure of it. I also implemented a database adapter class for dealing with raw sql queries for adding, editing and modifying entries; opening and closing the database; and also for fetching from the database. I now just have to work on the GUI for displaying the results of the database in a pretty way, and also for giving the user an intuitive way of entering in transactions and making it fit in to the GUI in a way that looks good. I also need to add a date column that stores the time of the transaction in the database.

No comments:

Post a Comment