SQLite 是否具有 C API 可以读/写的机器可移植文件格式? [英] Does SQLite have a machine portable file format that the C API can read/write?

查看:59
本文介绍了SQLite 是否具有 C API 可以读/写的机器可移植文件格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试过在不同操作系统和架构之间通过网络传递二进制 SQLite 数据库 - 它没有奏效.

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

你们都用什么格式?我已经尝试了一个邪恶的黑客攻击,即复制 SQLite 的 shell.c 并调用 shell_main() 并在 Mac 上成功地使用了 argc、argv、stdin.可惜我正在为 iPhone 开发,但它只在那里失败了.

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?

推荐答案

这是 SQLite 的核心功能之一.

This is one of the core features of SQLite.

稳定的跨平台数据库文件

SQLite 文件格式是跨平台的.写在一台机器上的数据库文件可以复制到另一台不同架构的机器上使用.大端或小端,32 位或 64 位都无关紧要.所有机器都使用相同的文件格式.此外,开发人员承诺保持文件格式稳定和向后兼容,以便较新版本的 SQLite 可以读写较旧的数据库文件.

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.

大多数其他 SQL 数据库引擎要求您在从一个平台移动到另一个平台时以及经常在升级到软件的较新版本时转储和恢复数据库.

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 具有良好的二进制文件比较支持.

Beyond Compare has good binary file comparison support.

这篇关于SQLite 是否具有 C API 可以读/写的机器可移植文件格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆