本文介绍了如何从另一个平台(iOS到Windows)打开和读取SQLite数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理一个 MFC 应用程序,其中我必须使用 sqlite 数据库 iOS 应用程序。



iOS 数据库使用 SQLite API sqlite3_key()。



但是当我试图打开在我的 MFC 中的 iOS 相同的数据库应用程序抛出异常说

$ c>数据库将从 Dropbox 通过 MFC 应用程序下载,并将替换当前数据库, / strong>



我使用以下代码打开数据库,使用。
其中 iOS 应用程序正在使用 数据库。



是相同的。所以,
任何人都可以告诉我如何实现这一点?



谢谢你在前进。

解决方案

从:

不兼容问题。


I am working on one MFC Application where I have to use sqlite database of iOS application.

The iOS database is encrypted by using SQLite API called sqlite3_key().

But when I am trying to open the same database of iOS in my MFC Application it throws exception saying File is encrypted or not a database and unable to read the data from the database.

The iOS database will be downloaded from Dropbox by MFC application and will replace current database and use it instead of previous

I am using following code for opening the database using CppSqlite3 Wrapper for Sqlite:

    CppSQLite3DB db;
try{
    db.open("mydb.db");
    TRACE(_T("database opened"));
    db.key("1234", strlen("1234"));
}catch(CppSQLite3Exception e){
    return NULL;
}

As the CppSQLite3DB class does not have a function called key(). I have added that function in the class

   void CppSQLite3DB::key(const char* szKey, int nKey)
{
    if (mpDB)
    {
        sqlite3_key(mpDB, szKey, nKey);
    }
}

and upgrade my library to SQLiteEncrypt.Whereas The iOS application is using SQLCipher for Database.

But, the result is same. So,Can anyone tell me how I can achieve that?

Thank you in Advance.

解决方案

From http://sqlcipher.net/:

Perhaps using SQLCipher in your Windows application would solve incompatibility problems.

这篇关于如何从另一个平台(iOS到Windows)打开和读取SQLite数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 22:02