CS357: Database System Implementation
Homework Assignment 2 -- The File Manager


Given: Wednesday, 30 January
Due Date: Wednesday, 6 February @ 5pm



1.  Do exercise 12.1 from the text.  

2.  Do exercise 12.18 from the text.  This exercise requires you to modify the code in class Page so that strings are implemented as a sequence of characters ending with the delimiter character '\0'.  Note that your revised getString and setString methods will necessarily be quite different from how they currently are.  Currently, a string is converted into a byte array and stored "en masse" in the page.  Your code will instead need to process a string character by character.  Also note that you will need to change the method that computes the size of a string, taking into consideration the fact that characters in Java are always 2 bytes long.

3.  Write a program to test your code from #2.  This code shouldn't use JDBC; instead, it should be similar to Figure 12-12 of the text.  For example, it could write some strings to a page and read them back.  (You also should make sure that SimpleDB still works when you replace its version of Page with yours.  But it is always good to write your own test code too.)

Submit your answer to the first exercise on paper, and submit a printout of your code for the second and third exercises.  If your code doesn't work, include a note explaining the situation and what you think is wrong.