Đang chuẩn bị liên kết để tải về tài liệu:
HandBooks Professional Java-C-Scrip-SQL part 140
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Tham khảo tài liệu 'handbooks professional java-c-scrip-sql part 140', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Free at Last An Efficient Method of Handling Variable-Length Records Introduction In this chapter we will develop an algorithm that uses the quantum file access method to handle a file containing a large number of records each of which can vary dynamically in size. In order to appreciate the power of this access method we will start by considering the much simpler problem of access to fixed-length records. Algorithm Discussed The Quantum File Access Method A Harmless Fixation Let us suppose that we want to access a number of fixed-length customer records by their record numbers.1 Given the record number we can locate that customer s record by multiplying the record number by the length of a record which gives us the offset into the file where that record will be found. We can then read or write that record as needed. Of course a real application needs to reuse records of customers who have become inactive to prevent the customer file from growing indefinitely. To handle this problem we could set a limit on the file size and when it is reached start reusing records that haven t been referenced for a long time making sure to correct or delete any records in other files that refer to the deleted customer. This fixed-length record system is not very difficult to implement but it has significant drawbacks address fields for example tend to vary greatly in length with some records needing 25 or 30 characters for a city name or street address and others needing only 10. If we allocate enough storage for the extreme case the records become much longer than if we had to handle only the average case. However allocating enough for only the average case will leave those customers whose names or addresses won t fit into the allotted space quite unhappy as I know from personal experience as a software developer The obvious solution is to allow the fields and therefore the records to vary in length as necessary. Checking Out of the Hotel Procrustes Unfortunately variable-length .