Thread: Good/Bad coding??

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Hamster without a wheel iain's Avatar
    Join Date
    Aug 2001
    Posts
    1,385
    Why use flat files?

    If you use a database you can have a unique ID for each customer in a customer table. A film table that holds a a unique film ID and the title and then a Rental table which would hold a record for each rental. Each rental record would contain a unique rental ID (just for primary key purpose), store the user id, and the film id that was rented. This could be extended to store date issued and issue length etc. Flat files are not really flexible or fast enough for this kind of system
    Monday - what a way to spend a seventh of your life

  2. #2
    Registered User computerfreaks's Avatar
    Join Date
    Jan 2005
    Posts
    30
    Inevitably.... the next question is how exactly??


    As I understand from reading books and the FAQ on linked lists, this would mean (correct me if wrong) that all of my data is loaded into memory?

    I say this, because to have a pointer to the next item, you would need it to have a memory location would you not?


    With this in mind, that would mean that as more films are added to my database, and more customers rent more films etc, I would eventually be loading up a lot of data.

    So, is this the best way to do it?? is that how you guys would do it presented with the same problem?? are there any other options?

    Many thanks for the help, all this correspondance will go into my final report and help me A LOT.

    Computerfreaks

  3. #3
    Registered User
    Join Date
    Feb 2005
    Posts
    12
    You don't have to load the entire database each time you run your program. As the user selects the customer whose history is to be viewed, you fetch the data relevant to that customer only. There are functions like SQLfetchData() etc to get data from the database. This I do in MSVC++6.0 and don't know whether it works with gcc etc or not and what are the other equivalent functions.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 03-20-2009, 05:22 PM
  2. Coding Guideline ....!!
    By imfeelingfortun in forum Tech Board
    Replies: 8
    Last Post: 10-08-2006, 07:09 AM
  3. Before Coding
    By cyberCLoWn in forum C++ Programming
    Replies: 16
    Last Post: 12-15-2003, 02:26 AM
  4. Coding Contest....
    By Koshare in forum A Brief History of Cprogramming.com
    Replies: 46
    Last Post: 10-14-2001, 04:32 PM