Skip to content

Commit

Permalink
Backup
Browse files Browse the repository at this point in the history
  • Loading branch information
vic-ma committed Jun 20, 2024
1 parent 15966b6 commit 7019a39
Showing 1 changed file with 50 additions and 8 deletions.
58 changes: 50 additions & 8 deletions course-definition.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,56 @@ stages:
name: "Read header"
difficulty: very_easy
description_md: |-
TEST:
- adfoiajdsfoiadsjf adsfadsfdafadfoiajdsfoiadsjf adsfadsfdafadfoiajdsfoiadsjf adsfadsfdafadfoiajdsfoiadsjf adsfadsfdafadfoiajdsfoiadsjf adsfadsfdafadfoiajdsfoiadsjf adsfadsfdafadfoiajdsfoiadsjf adsfadsfdaf
SECOND LINE
- dsafdsafads
```
fadsfadf
```
- fdasfdsafsad
In this stage, you'll implement the `.dbinfo` [dot command](https://www.sqlite.org/cli.html#special_commands_to_sqlite3_dot_commands_), which prints metadata about a SQLite database.
### `.dbinfo`
The `.dbinfo` command is executed like this:
```
$ sqlite3 sample.db .dbinfo
```
It outputs metadata about the database file:
```
database page size: 4096
write format: 1
read format: 1
...
number of tables: 5
schema size: 330
data version: 1
```
In this stage, your `.dbinfo` command only needs to output the "database page size."
### Database file
The SQLite database file begins with the database header. The database page size is stored in the header, right after the magic string.
```
// Start of file
53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00 // Magic string: "SQLite format 3" + null terminator.
10 00 /* Database page size, in bytes,
stored in big-endian (read left-to-right).
Here, the page size is 4096 bytes. */
...
```
### Tests
Here's how the tester will execute your program:
```
$ ./your_sqlite3.sh sample.db .dbinfo
```
Your program must print the database page size of the database file, like this:
```
database page size: 4096
```
### Notes
- For more information about the SQLite database file format, see the [Database File Format](https://www.sqlite.org/fileformat.html#the_database_header) guide.
- Database headers use big-endian to store multi-byte fields. See the [MDN article on endianness](https://developer.mozilla.org/en-US/docs/Glossary/Endianness) to learn more.
marketing_md: |-
In this stage, we'll do XYZ.
Expand Down

0 comments on commit 7019a39

Please sign in to comment.