这通常不是在哪里可以找到分步指南的问题,而是指南本身的问题。
我写这篇文章的目的是给其他人一个提示,他们在编译驱动程序插件时遇到了和我最近一样的问题。
如何使用 Windows/MinGW 平台使用 SQLCipher-extension 为 SQLite-DB 构建 Qt-SQL-driver-plugin 'QSQLCIPHER'?
最佳答案
如何使用 Windows/MinGW 平台为带有 SQLCipher 扩展的 SQLite-DB 构建 Qt-SQL-driver-plugin 'QSQLCIPHER':
C:\Qt\Qt5.4.0 C:\OpenSSL-Win32 C:\Windows\SysWOW64 ) C:\MinGW C:\MinGW C:\MinGW的内容到 Qt-MinGW 目录 C:\Qt\Qt5.4.0\Tools\mingw491_32 C:\Qt\Qt5.4.0\Tools\mingw491_32\msys\1.0\etc 中创建文件“fstab”#Win32_Path Mount_Point
C:/Qt/Qt5.4.0/Tools/mingw491_32 /mingw
C:/Qt/Qt5.4.0/5.4 /qt
C:/ /c
C:\Qt\Qt5.4.0\Tools\mingw491_32\msys\1.0\bin C:\temp\sqlcipher-master C:\OpenSSL-Win32\bin\libeay32.dll至 C:\temp\sqlcipher-master C:\OpenSSL-Win32\lib\libeay32.lib至 C:\temp\sqlcipher-master C:\Qt\Qt5.4.0\Tools\mingw491_32\msys\1.0\msys.bat$ cd /c/temp/sqlcipher-master
$ ./configure --prefix=$(pwd)/dist --with-crypto-lib=none --disable-tcl CFLAGS="-DSQLITE_HAS_CODEC -DSQLCIPHER_CRYPTO_OPENSSL -I/c/openssl-win32/include /c/temp/sqlcipher-master/libeay32.dll -L/c/temp/sqlcipher-master/ -static-libgcc" LDFLAGS="-leay32"
$ make clean
$ make sqlite3.c
$ make
$ make dll
$ make install
C:\sqlcipherC:\temp\sqlcipher-master\dist\bin\sqlcipher.exe至 C:\sqlcipher .C:\temp\sqlcipher-master\sqlite3.dll至 C:\sqlcipher .C:\Qt\Qt5.4.0\5.4\Src\qtbase\src\plugins\sqldrivers\sqlcipher #include <qsqldriverplugin.h>
#include <qstringlist.h>
#include "../../../../src/sql/drivers/sqlite/qsql_sqlite_p.h" // There was a missing " at the end of this line
QT_BEGIN_NAMESPACE
class QSQLcipherDriverPlugin : public QSqlDriverPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QSqlDriverFactoryInterface" FILE "sqlcipher.json")
public:
QSQLcipherDriverPlugin();
QSqlDriver* create(const QString &);
};
QSQLcipherDriverPlugin::QSQLcipherDriverPlugin()
: QSqlDriverPlugin()
{
}
QSqlDriver* QSQLcipherDriverPlugin::create(const QString &name)
{
if (name == QLatin1String("QSQLCIPHER")) {
QSQLiteDriver* driver = new QSQLiteDriver();
return driver;
}
return 0;
}
QT_END_NAMESPACE
#include "smain.moc"
TARGET = qsqlcipher
SOURCES = smain.cpp
OTHER_FILES += sqlcipher.json
include(../../../sql/drivers/sqlcipher/qsql_sqlite.pri)
wince*: DEFINES += HAVE_LOCALTIME_S=0
PLUGIN_CLASS_NAME = QSQLcipherDriverPlugin
include(../qsqldriverbase.pri)
{
"Keys": [ "QSQLCIPHER" ]
}
C:\Qt\Qt5.4.0\5.4\Src\qtbase\src\sql\drivers\sqlite至 C:\Qt\Qt5.4.0\5.4\Src\qtbase\src\sql\drivers\sqlcipher C:\Qt\Qt5.4.0\5.4\Src\qtbase\src\sql\drivers\sqlcipher\qsql_sqlite.pri该文件的内容应如下所示:HEADERS += $$PWD/qsql_sqlite_p.h
SOURCES += $$PWD/qsql_sqlite.cpp
!system-sqlite:!contains(LIBS, .*sqlite3.*) {
include($$PWD/../../../3rdparty/sqlcipher.pri) #<-- change path of sqlite.pri to sqlcipher.pri here !
} else {
LIBS += $$QT_LFLAGS_SQLITE
QMAKE_CXXFLAGS *= $$QT_CFLAGS_SQLITE
}
C:\Qt\Qt5.4.0\5.4\Src\qtbase\src\3rdparty 中创建文件 'sqlcipher.pri'具有以下内容:CONFIG(release, debug|release):DEFINES *= NDEBUG
DEFINES += SQLITE_OMIT_LOAD_EXTENSION SQLITE_OMIT_COMPLETE SQLITE_ENABLE_FTS3 SQLITE_ENABLE_FTS3_PARENTHESIS SQLITE_ENABLE_RTREE SQLITE_HAS_CODEC
!contains(CONFIG, largefile):DEFINES += SQLITE_DISABLE_LFS
contains(QT_CONFIG, posix_fallocate):DEFINES += HAVE_POSIX_FALLOCATE=1
winrt: DEFINES += SQLITE_OS_WINRT
winphone: DEFINES += SQLITE_WIN32_FILEMAPPING_API=1
qnx: DEFINES += _QNX_SOURCE
INCLUDEPATH += $$PWD/sqlcipher c:/openssl-win32/include
SOURCES += $$PWD/sqlcipher/sqlite3.c
LIBS += -L$$PWD/sqlcipher/lib -lsqlcipher -leay32 -lsqlite3
TR_EXCLUDE += $$PWD/*
C:\Qt\Qt5.4.0\5.4\Src\qtbase\src\3rdparty\sqlcipherC:\Qt\Qt5.4.0\5.4\Src\qtbase\src\3rdparty\sqlcipher
C:\Qt\Qt5.4.0\5.4\Src\qtbase\src\3rdparty\sqlcipher\lib
C:\Qt\Qt5.4.0\5.4\Src\qtbase\src\3rdparty\sqlcipher :C:\temp\sqlcipher-master\shell.c
C:\temp\sqlcipher-master\sqlite3.c
C:\temp\sqlcipher-master\sqlite3.h
C:\temp\sqlcipher-master\sqlite3ext.h
C:\Qt\Qt5.4.0\5.4\Src\qtbase\src\3rdparty\sqlcipher\lib :C:\temp\sqlcipher-master\dist\lib
C:\temp\sqlcipher-master\sqlite3.dll
C:\OpenSSL-Win32\bin\libeay32.dll
C:\QT\QT5.4.0\5.4\SRC\QTBASE\SRC\3RDPARTY\SQLCIPHER
| shell.c
| sqlite3.c
| sqlite3.h
| sqlite3ext.h
|
\---lib
| libeay32.dll
| libsqlcipher.a
| libsqlcipher.la
| sqlite3.dll
|
\---pkgconfig
sqlcipher.pc
C:\Windows\System32\cmd.exe /A /Q /K C:\Qt\Qt5.4.0\5.4\mingw491_32\bin\qtenv2.bat cd C:\Qt\Qt5.4.0\5.4\Src\qtbase\src\pluins\sqldrivers\sqlcipher
qmake
mingw32-make
C:\QT\QT5.4.0\5.4\SRC\QTBASE\PLUGINS\SQLDRIVERS
libqsqlcipher.a
libqsqlcipherd.a
qsqlcipher.dll
qsqlcipherd.dll
C:\Qt\Qt5.4.0\5.4\mingw491_32\plugins\sqldrivers . C:\sqlcipher ,其中包含“sqlcipher.exe”和“sqlite3.dll”(见上文)。C:\sqlcipher>sqlcpher.exe plaintext.db
SQLCipher version 3.8.6 2014-08-15 11:46:33
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> create table testtable (id integer, name text);
sqlite> insert into testtable (id,name) values(1,'Bob');
sqlite> insert into testtable (id,name) values(2,'Charlie');
sqlite> insert into testtable (id,name) values(3,'Daphne');
sqlite> select * from testtable;
1|Bob
2|Charlie
3|Daphne
sqlite> .exit
C:\sqlcipher\plaintext.db使用标准文本编辑器:C:\sqlcipher\encrypted.db使用 key “testkey”。C:\sqlcipher>sqlcipher.exe plaintext.db
SQLCipher version 3.8.6 2014-08-15 11:46:33
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> ATTACH DATABASE 'encrypted.db' AS encrypted KEY 'testkey';
sqlite> SELECT sqlcipher_export('encrypted');
sqlite> DETACH DATABASE encrypted;
sqlite> .exit
C:\sqlcipher\encrypted.db使用标准文本编辑器:QT += core sql
QT -= gui
TARGET = qsqlcipher
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
#include <QCoreApplication>
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QDebug>
#include <QString>
int main(int argc, char *argv[]) {
QCoreApplication a(argc, argv);
qDebug() << QSqlDatabase::drivers();
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLCIPHER");
db.setDatabaseName("C:/sqlcipher/encrypted.db");
db.open();
QSqlQuery q;
q.exec("PRAGMA key = 'testkey';");
q.exec("insert into testtable (id,name) values(4,'dummy')");
q.exec("SELECT id,name anz FROM testtable");
while (q.next()) {
QString id = q.value(0).toString();
QString name = q.value(1).toString();
qDebug() << "id=" << id << ", name=" << name;
}
db.close();
return 0;
}
("QSQLCIPHER", "QSQLITE", "QMYSQL", "QMYSQL3", "QODBC", "QODBC3", "QPSQL", "QPSQL7")
id= "1" , name= "Bob"
id= "2" , name= "Charlie"
id= "3" , name= "Daphne"
id= "4" , name= "dummy"
C:\TEMP\QSQLCIPHER-TEST
| icudt53.dll
| icuin53.dll
| icuuc53.dll
| libeay32.dll
| libgcc_s_dw2-1.dll
| libstdc++-6.dll
| libwinpthread-1.dll
| qsqlcipher.exe
| Qt5Core.dll
| Qt5Sql.dll
|
+---platforms
| qminimal.dll
| qoffscreen.dll
| qwindows.dll
|
\---sqldrivers
qsqlcipher.dll
...
q.exec("PRAGMA key = 'testkey';");
...
...
00002C90 70 68 65 72 2F 65 6E 63 72 79 70 74 65 64 2E 64 pher/encrypted.d
00002CA0 62 00 50 52 41 47 4D 41 20 6B 65 79 20 3D 20 27 b.PRAGMA key = '
00002CB0 74 65 73 74 6B 65 79 27 3B 00 00 00 69 6E 73 65 testkey';...inse
00002CC0 72 74 20 69 6E 74 6F 20 74 65 73 74 74 61 62 6C rt into testtabl
...
关于qt - 如何使用 Windows/MinGW 平台为带有 SQLCipher 扩展的 SQLite-DB 构建 Qt-SQL-driver-plugin 'QSQLCIPHER'?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29196087/
我正在学习如何使用Nokogiri,根据这段代码我遇到了一些问题:require'rubygems'require'mechanize'post_agent=WWW::Mechanize.newpost_page=post_agent.get('http://www.vbulletin.org/forum/showthread.php?t=230708')puts"\nabsolutepathwithtbodygivesnil"putspost_page.parser.xpath('/html/body/div/div/div/div/div/table/tbody/tr/td/div
我有一个Ruby程序,它使用rubyzip压缩XML文件的目录树。gem。我的问题是文件开始变得很重,我想提高压缩级别,因为压缩时间不是问题。我在rubyzipdocumentation中找不到一种为创建的ZIP文件指定压缩级别的方法。有人知道如何更改此设置吗?是否有另一个允许指定压缩级别的Ruby库? 最佳答案 这是我通过查看rubyzip内部创建的代码。level=Zlib::BEST_COMPRESSIONZip::ZipOutputStream.open(zip_file)do|zip|Dir.glob("**/*")d
类classAprivatedeffooputs:fooendpublicdefbarputs:barendprivatedefzimputs:zimendprotecteddefdibputs:dibendendA的实例a=A.new测试a.foorescueputs:faila.barrescueputs:faila.zimrescueputs:faila.dibrescueputs:faila.gazrescueputs:fail测试输出failbarfailfailfail.发送测试[:foo,:bar,:zim,:dib,:gaz].each{|m|a.send(m)resc
很好奇,就使用rubyonrails自动化单元测试而言,你们正在做什么?您是否创建了一个脚本来在cron中运行rake作业并将结果邮寄给您?git中的预提交Hook?只是手动调用?我完全理解测试,但想知道在错误发生之前捕获错误的最佳实践是什么。让我们理所当然地认为测试本身是完美无缺的,并且可以正常工作。下一步是什么以确保他们在正确的时间将可能有害的结果传达给您? 最佳答案 不确定您到底想听什么,但是有几个级别的自动代码库控制:在处理某项功能时,您可以使用类似autotest的内容获得关于哪些有效,哪些无效的即时反馈。要确保您的提
假设我做了一个模块如下:m=Module.newdoclassCendend三个问题:除了对m的引用之外,还有什么方法可以访问C和m中的其他内容?我可以在创建匿名模块后为其命名吗(就像我输入“module...”一样)?如何在使用完匿名模块后将其删除,使其定义的常量不再存在? 最佳答案 三个答案:是的,使用ObjectSpace.此代码使c引用你的类(class)C不引用m:c=nilObjectSpace.each_object{|obj|c=objif(Class===objandobj.name=~/::C$/)}当然这取决于
我正在尝试使用ruby和Savon来使用网络服务。测试服务为http://www.webservicex.net/WS/WSDetails.aspx?WSID=9&CATID=2require'rubygems'require'savon'client=Savon::Client.new"http://www.webservicex.net/stockquote.asmx?WSDL"client.get_quotedo|soap|soap.body={:symbol=>"AAPL"}end返回SOAP异常。检查soap信封,在我看来soap请求没有正确的命名空间。任何人都可以建议我
关闭。这个问题是opinion-based.它目前不接受答案。想要改进这个问题?更新问题,以便editingthispost可以用事实和引用来回答它.关闭4年前。Improvethisquestion我想在固定时间创建一系列低音和高音调的哔哔声。例如:在150毫秒时发出高音调的蜂鸣声在151毫秒时发出低音调的蜂鸣声200毫秒时发出低音调的蜂鸣声250毫秒的高音调蜂鸣声有没有办法在Ruby或Python中做到这一点?我真的不在乎输出编码是什么(.wav、.mp3、.ogg等等),但我确实想创建一个输出文件。
我正在尝试测试是否存在表单。我是Rails新手。我的new.html.erb_spec.rb文件的内容是:require'spec_helper'describe"messages/new.html.erb"doit"shouldrendertheform"dorender'/messages/new.html.erb'reponse.shouldhave_form_putting_to(@message)with_submit_buttonendendView本身,new.html.erb,有代码:当我运行rspec时,它失败了:1)messages/new.html.erbshou
我在我的项目目录中完成了compasscreate.和compassinitrails。几个问题:我已将我的.sass文件放在public/stylesheets中。这是放置它们的正确位置吗?当我运行compasswatch时,它不会自动编译这些.sass文件。我必须手动指定文件:compasswatchpublic/stylesheets/myfile.sass等。如何让它自动运行?文件ie.css、print.css和screen.css已放在stylesheets/compiled。如何在编译后不让它们重新出现的情况下删除它们?我自己编译的.sass文件编译成compiled/t
我想将html转换为纯文本。不过,我不想只删除标签,我想智能地保留尽可能多的格式。为插入换行符标签,检测段落并格式化它们等。输入非常简单,通常是格式良好的html(不是整个文档,只是一堆内容,通常没有anchor或图像)。我可以将几个正则表达式放在一起,让我达到80%,但我认为可能有一些现有的解决方案更智能。 最佳答案 首先,不要尝试为此使用正则表达式。很有可能你会想出一个脆弱/脆弱的解决方案,它会随着HTML的变化而崩溃,或者很难管理和维护。您可以使用Nokogiri快速解析HTML并提取文本:require'nokogiri'h