Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
educg-net-18880-1777781
rmdb-tut
Commits
ec6fbb67
Commit
ec6fbb67
authored
1 year ago
by
天津理工大学11队
Browse files
Options
Download
Patches
Plain Diff
feat(rm_scan): 实现题目要求接口
parent
32f51c29
main
cjh_dev
freeze-task-1-full
freeze-task-10-full
freeze-task-2-full
freeze-task-3-full
freeze-task-4-full
freeze-task-5-full
freeze-task-6-full
freeze-task-7-full
freeze-task-8-full
freeze-task-9-full
lx_dev
qjy_dev
task-10-dev
task-9-dev
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/record/rm_scan.cpp
+23
-2
src/record/rm_scan.cpp
with
23 additions
and
2 deletions
+23
-2
src/record/rm_scan.cpp
+
23
−
2
View file @
ec6fbb67
...
...
@@ -18,7 +18,9 @@ See the Mulan PSL v2 for more details. */
RmScan
::
RmScan
(
const
RmFileHandle
*
file_handle
)
:
file_handle_
(
file_handle
)
{
// Todo:
// 初始化file_handle和rid(指向第一个存放了记录的位置)
rid_
.
page_no
=
RM_FIRST_RECORD_PAGE
;
rid_
.
slot_no
=
-
1
;
next
();
}
/**
...
...
@@ -27,7 +29,24 @@ RmScan::RmScan(const RmFileHandle *file_handle) : file_handle_(file_handle) {
void
RmScan
::
next
()
{
// Todo:
// 找到文件中下一个存放了记录的非空闲位置,用rid_来指向这个位置
if
(
is_end
())
{
return
;
}
// for pages
for
(;
rid_
.
page_no
<
this
->
file_handle_
->
file_hdr_
.
num_pages
;
rid_
.
page_no
++
){
rid_
.
slot_no
=
Bitmap
::
next_bit
(
true
,
file_handle_
->
fetch_page_handle
(
rid_
.
page_no
).
bitmap
,
file_handle_
->
file_hdr_
.
num_records_per_page
,
rid_
.
slot_no
);
if
(
rid_
.
slot_no
<
file_handle_
->
file_hdr_
.
num_records_per_page
)
{
return
;
}
rid_
.
slot_no
=
-
1
;
}
rid_
.
page_no
=
RM_NO_PAGE
;
}
/**
...
...
@@ -35,7 +54,9 @@ void RmScan::next() {
*/
bool
RmScan
::
is_end
()
const
{
// Todo: 修改返回值
if
(
rid_
.
page_no
==
RM_NO_PAGE
)
{
return
true
;
}
return
false
;
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets