Got it - I think I understand.  I don't really care about free list pages,
just free blocks within a page.

So, deleting a second row from my small test database gave me the following
output:

Page Size is: 1024 (0400)
FreeListPage = 0
FreeListCount = 0
Going to offset: 1024
Freeblock = 964 (0D was at offset 0, so I read the next 2 bytes as described
in the Btree Page Header)
Start of offset: 1024, freeblock: 964
nextFreeBlock says 995
nextFreeBlock says 0
Hit 00 00, so stop
[964, 995, 0] (my free block list)

Thanks for the response, I also realized I had made notes from the SQLite
file format original page http://www.sqlite.org/fileformat.html - which
added to my confusion.

Quick question, do I have to read every page to find free blocks or is there
a bigger linked list somewhere?

-Dave

On Thu, Sep 9, 2010 at 4:22 PM, Richard Hipp <d...@sqlite.org> wrote:

>
>
> On Thu, Sep 9, 2010 at 4:03 PM, David C. Smith <dcsmit...@gmail.com>wrote:
>
>> All, I am trying to manually parse the freelist to recover deleted data.
>>  Yes, I googled for someone to have created this already :)
>>
>> I am getting data that I don't expect and wanted to see if anyone could
>> see
>> where I have a misunderstanding.  I am using
>> http://www.sqlite.org/fileformat2.html
>>
>> () = test data
>> read the database file
>>  read page size at offset 16 & 17 (1024 0x400)
>>  read first freelist trunk page  at offset 32 to 35) (00000000)
>>
>
> Your freelist is empty.  There are no unused pages in your database.
> Probably the two rows you delete were small enough to fit on a single page
> so no pages were released and no pages were added to the freelist.
>
>
>>  Go to that page (1024, page 1)
>>
>>  **> this is where I start having issues
>>  B-tree Page header format  says that offset 0, size 1 should be a 2,5,
>> 10,
>> 13 or is in error.  I have a 0D.
>>  But, offset 1, 2 have 03 E3 (995) and that leads to 2019, the start of my
>> deleted data .
>>
>> I have not built a database with 2 deleted rows, so I am not sure how to
>> follow the free block list.
>>
>> Any help comments?
>> _______________________________________________
>> sqlite-users mailing list
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
>
>
>
> --
> D. Richard Hipp
> d...@sqlite.org
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to