如何从另一个平台(iOS到Windows)打开和读取SQLite数据库 [英] How to open and read SQLite database from another platform like (iOS to Windows)
问题描述
我正在处理一个 MFC
应用程序,其中我必须使用 sqlite
数据库 iOS
应用程序。
iOS
数据库使用 SQLite
API sqlite3_key()
。
但是当我试图打开在我的 MFC
中的 iOS 相同的数据库应用程序抛出异常说
Dropbox
通过 MFC
应用程序下载,并将替换当前数据库, / strong> 我使用以下代码打开数据库,使用: Sqlite
:: p>
CppSQLite3DB db;
try {
db.open(mydb.db);
TRACE(_T(database opened));
db.key(1234,strlen(1234));
} catch(CppSQLite3Exception e){
return NULL;
}
由于 CppSQLite3DB
类没有一个名为 key()
的函数。我在类
void CppSQLite3DB :: key(const char * szKey,int nKey)
{
if(mpDB)
{
sqlite3_key(mpDB,szKey,nKey);
}
}
并将我的媒体库升级至 SQLiteEncrypt 。
其中 iOS
应用程序正在使用 SQLCipher
数据库
。
是相同的。所以,
任何人都可以告诉我如何实现这一点?
谢谢你在前进。
SQLCipher具有广泛的平台支持 [..] C / C ++ [..] iPhone / 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/:
SQLCipher has broad platform support for [..] C/C++ [..] iPhone/iOS [..]
Perhaps using SQLCipher in your Windows application would solve incompatibility problems.
这篇关于如何从另一个平台(iOS到Windows)打开和读取SQLite数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!