Pro.SQLite3 — API for parsing SQLite3 databases

Overview

The Pro.SQLite3 module contains the API for parsing SQLite3 databases .

Enumerating tables in a SQLite3 database

The following code example demonstrates how to enumerate table names in a database by retrieving the internal sqlite3 handle and using the official SQLite C API:

from Pro.SQLite import *

db = obj.GetHandle() # retrieves the internal SQLite handle, never to be closed!

ret, stmt = sqlite3_prepare(db, "SELECT name FROM sqlite_master WHERE type = 'table'")
if sqlite3_step(stmt) == SQLITE_ROW:
    print(sqlite3_column_text(stmt, 0))
    sqlite3_finalize(stmt)

Module API

Pro.SQLite3 module API.

Classes:

SQLite3Object()

This class represents a SQLite3 database.

class SQLite3Object

Bases: Pro.Core.CFFObject

This class represents a SQLite3 database.

Methods:

GetFreePages([max_size])

Retrieves the concatenated space of free pages in the dabatase.

GetHandle()

GetPageSize()

Returns the page size of the database.

GetUsablePageSize()

Calculates the usable page size of the database.

HasFreePages()

Returns True if the database has free pages; otherwise returns False.

Header()

Returns the header of the SQLite database.

GetFreePages(max_size: int = 1024 * 1024 * 1024)Pro.Core.NTContainer

Retrieves the concatenated space of free pages in the dabatase.

Parameters

max_size (int) – The maximum data size to return.

Returns

Returns the free pages data if successful; otherwise returns an invalid Pro.Core.NTContainer instance.

Return type

NTContainer

See also HasFreePages().

GetHandle()sqlite3

Warning

The returned handle must never be closed!

Returns

Returns the internal sqlite3 handle.

Return type

sqlite3

GetPageSize()int
Returns

Returns the page size of the database.

Return type

int

See also GetUsablePageSize().

GetUsablePageSize()int

Calculates the usable page size of the database.

Hint

The usable page size is calculated by subtracting the reserved space from the page size.

Returns

Returns the usable page size of the data base.

Return type

int

See also GetPageSize().

HasFreePages()bool
Returns

Returns True if the database has free pages; otherwise returns False.

Return type

bool

See also GetFreePages().

Header()Pro.Core.CFFStruct
Returns

Returns the header of the SQLite database.

Return type

CFFStruct