Skip to content

Commit 4e0314b

Browse files
authored
Merge pull request cstack#23 from khanhtc1202/fix_missing_initialize_root_page_num_code_snippet_in_md
fix missing initialize root_page_num code snippet in md part8
2 parents 7b1a30e + 099a2e6 commit 4e0314b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

_parts/part8.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ When we open the database for the first time, the database file will be empty, s
316316
Table* table = malloc(sizeof(Table));
317317
table->pager = pager;
318318
- table->num_rows = num_rows;
319+
+ table->root_page_num = 0;
319320
+
320321
+ if (pager->num_pages == 0) {
321322
+ // New database file. Initialize page 0 as leaf node.
@@ -701,6 +702,7 @@ Next time, we'll implement finding a record by primary key, and start storing ro
701702
Table* table = malloc(sizeof(Table));
702703
table->pager = pager;
703704
- table->num_rows = num_rows;
705+
+ table->root_page_num = 0;
704706
+
705707
+ if (pager->num_pages == 0) {
706708
+ // New database file. Initialize page 0 as leaf node.

0 commit comments

Comments
 (0)