Skip to content

Commit

Permalink
fix: set PAGE_SIZE from db file on init
Browse files Browse the repository at this point in the history
  • Loading branch information
rudrOwO committed Nov 27, 2024
1 parent 7418d99 commit ea27e8c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions internal/api/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package api
import (
"log"
"os"

"github.com/rudrowo/sqlite/internal/btree"
)

var dbFile *os.File
Expand All @@ -14,5 +16,6 @@ func Init(fileName string) *os.File {
log.Fatal(err)
}

btree.PAGE_SIZE = int64(ReadPageSize())
return dbFile
}
4 changes: 2 additions & 2 deletions internal/btree/page.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (
"github.com/rudrowo/sqlite/internal/dataformat"
)

const (
PAGE_SIZE = 4096
var PAGE_SIZE = int64(4096)

const (
INTERIOR_INDEX_PAGE_TYPE = 0x02
LEAF_INDEX_PAGE_TYPE = 0x0a

Expand Down

0 comments on commit ea27e8c

Please sign in to comment.