Skip to content

boykopovar/sqlce

Repository files navigation

sqlce

C++ Python Platform License Reverse engineered

Reverse engineering of the .sdf (SQL Server Compact Edition) binary file format.

Analysis of the format's internal structure based on decompiled SQL CE components. The goal is to provide a cross-platform, runtime-independent implementation for reading .sdf files.

Intended solely for interoperability with existing .sdf files. Does not contain any original product source code.

Browser version (WebAssembly, runs locally - the file never leaves your tab): boykopovar.github.io/sqlce

  • core/ — C++ parser implementation
  • bindings/ — Bindings for the C++ library to other languages
  • python/sqlce/ — Python API
  • research/ — Experimental scripts

Example

pip install sqlce
from sqlce import SdfDatabase

db = SdfDatabase("example.sdf", password="secret123")

for table_name in db.list_tables():
    print(table_name, db.table_schema(table_name))
    for row in db.read_table(table_name):
        print(row)

The current implementation supports reading the list of tables, table schemas, and table contents (including password-protected databases). It is implemented in C++.

Reading encrypted .sdf version 3.5 files is not currently supported (unencrypted files are supported).

Testing

pytest

The tests use a locally installed SQL CE engine (via ODBC) to generate .sdf files containing predefined data and verify that the parser produces identical results. Therefore, the test suite can only be run on Windows with SQL Server Compact 4.0 installed. Test files are created in tests/sdf/ and are automatically removed before and after each test run.

Documentation

The documentation is currently concise but includes usage examples and tests.

Documentation

Code Style Conventions (Pull requests are welcome.)

About

Cross-platform lib for reading SQL Server CE (.sdf)

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors