CS346 - Spring 2011
Database System Implementation
Modifying previous components
It's very common to make changes to earlier components after you've submitted
them. You're welcome to do so as long as you don't change the portions of the
interfaces we specified. You may also modify the PF component if you like, as
long as you don't modify how I/O statistics are kept. If you do make changes,
please turn in the new files with your next submitted component, so we always
have the latest files for your project.
String-valued attributes and string comparisons
When a RedBase attribute value is specified as a character string of
length n, then it contains n valid characters, even if
some of them are the null termination character "\0
". For
example, suppose we have an attribute that is a character string of
length 8. Strings "hello\0\0\0
" and
"hello\01\0
" are both 8-character strings, and
"hello\0\0\0 < hello\01\0
" should evaluate to true
(even though they look the same when printed).
When comparing strings of different lengths, the easiest approach
is to make both strings the same length by padding the shorter one
with "\0
" characters to match the length of the longer
one. For example, to compare "hello
" with
"helloworld
" you can pad "hello
" to
"hello\0\0\0\0\0
" then check "hello\0\0\0\0\0 <
helloworld
".