[Assignment #2]

Ÿ  Title: Development of a toy storage system.

Ÿ  You develop a toy storage system for  Student records with the following functions.

Ÿ  Record: Student
  - ID:           9 characters
  - name:     20 characters
  - dept:        20 characters
  - advisor:  20 characters
  - score:      4 byte floating point number
(*ID is the key of record, and other attributes may have same values)

Ÿ  Development Environment
  - NTFS or FAT32
  - MS-Windows
  - VC++ 6.0

Ÿ  Interfaces
1. open related files and initialize DB.
  
 error_code openDB(char* DBName)
      a)
DBName is the name of DB, e.g. my_students.
      b)
error_code is defined in ¡°errorCode.h¡±
2. close related files and finalize DB.
  
 error_code closeDB(char* DBName)
      a)
DBName is the name of DB, e.g. my_students.
      b)
error_code is defined in ¡°errorCode.h¡±
3. Search records with a given condition
  
 error_code searchRecords(char* condition, int* numberStudents, char* resultFile)
      a)
numberStudents is the number of records as the answer.
      b) The condition is given as a character string, such as
           ¡°lower_bound<=attribute_name<=upper_bound¡± and
           specifies only one condition.
           When lower_bound=upper_bound, this implies an exact match query.
           The attributes
ID,   name, dept, and advisor allow only exact match queries.
      c) The records retrieved by this function must be stored in
result.txt in ASCII under the following format;
           one line for each student record like
           name(30 characters) ID(9 characters) dept(20 characters) advisor(30 characters) score(1 digit ¡±.¡± 2 digits)
           For example
     Ki-Joune Li          A19802345 Computer Science     Sophie Marceau       2.76
     Hwan-Gue Cho         A19802356 Computer Science     Isaac Newton         3.45
           . . .
4. Insert a record
     
error_code insertRecord(char* ID, char* name, char* dept, char* advisor,float score)
5. Delete records with a given condition
     
error_code deleteRecords(int* numberStudents, char* condition)
      a)
numberStudents is the number of records deleted.
      b) The condition is given as search query
6.
errorCode.h is given as follows;
/* error code */
#define       E_OK                                          0x0000
#define       E_DUPLICATED_KEY            0x0001
#define       E_DB_NOT_OPEN                  0x0002
#define       E_WRITE_ERROR                  0x0003
#define       E_READ_ERROR                    0x0004
#define       E_UNKNOWN                           0x0100

Ÿ  Evaluation based on
  - The correctness is to be examined by the result.txt, which means that you should
    respect the format of result file given by 3-c).
  - Submit your source code via e-mail: fp-2010-assignment2@isel.cs.pusan.ac.kr
  - Ranks will be given by the execution time for the given scenario,
    and bonus of 20%, 15%, 10%, and 10% will be given to the four fastest ones.
    Note that these bonus rates are over the total sum of tests and assignments.

Ÿ  Due date: May 31 6 pm.

Ÿ  A Sample main program and input data file.