Does SQLite have a machine portable file format th

2019-04-12 03:05发布

I've tried passing binary SQLite DBs over the network between different OSes and architectures - it didn't work.

What format are you all using? I've tried an unholy hack of copying SQLite's shell.c and calling shell_main() with a hacked up argc, argv, stdin with success on Mac. Pity I'm developing for the iPhone and it fails only there.

Does everyone do such awful things?

1条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-04-12 03:38

This is one of the core features of SQLite.

Stable Cross-Platform Database File

The SQLite file format is cross-platform. A database file written on one machine can be copied to and used on a different machine with a different architecture. Big-endian or little-endian, 32-bit or 64-bit does not matter. All machines use the same file format. Furthermore, the developers have pledged to keep the file format stable and backwards compatible, so newer versions of SQLite can read and write older database files.

Most other SQL database engines require you to dump and restore the database when moving from one platform to another and often when upgrading to a newer version of the software.

http://sqlite.org/different.html

Check the code that's passing the databases. Do a byte-by-byte comparison to make sure they're equal after transfer. This definitely should be working.

Beyond Compare has good binary file comparison support.

查看更多
登录 后发表回答