Bring the QSQLITE plugin into the source tree and statically link it on Windows.
Also remove the unused xine windows patches, and move all the windows resources into dist/windows
This commit is contained in:
parent
6947fe2923
commit
b1e1de709c
|
@ -0,0 +1,30 @@
|
|||
cmake_minimum_required(VERSION 2.6)
|
||||
|
||||
# Source files
|
||||
set(SQLITE-SOURCES
|
||||
sqlite3.c
|
||||
qsql_sqlite.cpp
|
||||
smain.cpp
|
||||
)
|
||||
|
||||
# Header files that have Q_OBJECT in
|
||||
set(SQLITE-MOC-HEADERS
|
||||
qsql_sqlite.h
|
||||
)
|
||||
|
||||
set(SQLITE-WIN32-RESOURCES qsqlite_resource.rc)
|
||||
|
||||
qt4_wrap_cpp(SQLITE-SOURCES-MOC ${SQLITE-MOC-HEADERS})
|
||||
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
add_definitions(-DQT_PLUGIN -DQT_NO_DEBUG)
|
||||
|
||||
add_library(qsqlite
|
||||
${SQLITE-SOURCES}
|
||||
${SQLITE-SOURCES-MOC}
|
||||
${SQLITE-WIN32-RESOURCES}
|
||||
)
|
||||
target_link_libraries(qsqlite
|
||||
${QT_LIBRARIES}
|
||||
)
|
|
@ -0,0 +1,6 @@
|
|||
This is the qsqlite plugin from the Qt SDK. It's built statically on Windows
|
||||
and linked with libclementine. This is so librarybackend.cpp can use QLibrary
|
||||
to load the symbols from sqlite (like sqlite3_create_function) which by
|
||||
default aren't exported from the .dll on windows.
|
||||
|
||||
See the individual files for licensing information.
|
|
@ -0,0 +1,717 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the QtSql module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qsql_sqlite.h"
|
||||
|
||||
#include <qcoreapplication.h>
|
||||
#include <qvariant.h>
|
||||
#include <qsqlerror.h>
|
||||
#include <qsqlfield.h>
|
||||
#include <qsqlindex.h>
|
||||
#include <qsqlquery.h>
|
||||
#include <qstringlist.h>
|
||||
#include <qvector.h>
|
||||
#include <qdebug.h>
|
||||
|
||||
#if defined Q_OS_WIN
|
||||
# include <qt_windows.h>
|
||||
#else
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <sqlite3.h>
|
||||
|
||||
Q_DECLARE_METATYPE(sqlite3*)
|
||||
Q_DECLARE_METATYPE(sqlite3_stmt*)
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
static QString _q_escapeIdentifier(const QString &identifier)
|
||||
{
|
||||
QString res = identifier;
|
||||
if(!identifier.isEmpty() && identifier.left(1) != QString(QLatin1Char('"')) && identifier.right(1) != QString(QLatin1Char('"')) ) {
|
||||
res.replace(QLatin1Char('"'), QLatin1String("\"\""));
|
||||
res.prepend(QLatin1Char('"')).append(QLatin1Char('"'));
|
||||
res.replace(QLatin1Char('.'), QLatin1String("\".\""));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
static QVariant::Type qGetColumnType(const QString &tpName)
|
||||
{
|
||||
const QString typeName = tpName.toLower();
|
||||
|
||||
if (typeName == QLatin1String("integer")
|
||||
|| typeName == QLatin1String("int"))
|
||||
return QVariant::Int;
|
||||
if (typeName == QLatin1String("double")
|
||||
|| typeName == QLatin1String("float")
|
||||
|| typeName.startsWith(QLatin1String("numeric")))
|
||||
return QVariant::Double;
|
||||
if (typeName == QLatin1String("blob"))
|
||||
return QVariant::ByteArray;
|
||||
return QVariant::String;
|
||||
}
|
||||
|
||||
static QSqlError qMakeError(sqlite3 *access, const QString &descr, QSqlError::ErrorType type,
|
||||
int errorCode = -1)
|
||||
{
|
||||
return QSqlError(descr,
|
||||
QString::fromUtf16(static_cast<const ushort *>(sqlite3_errmsg16(access))),
|
||||
type, errorCode);
|
||||
}
|
||||
|
||||
class QSQLiteDriverPrivate
|
||||
{
|
||||
public:
|
||||
inline QSQLiteDriverPrivate() : access(0) {}
|
||||
sqlite3 *access;
|
||||
};
|
||||
|
||||
|
||||
class QSQLiteResultPrivate
|
||||
{
|
||||
public:
|
||||
QSQLiteResultPrivate(QSQLiteResult *res);
|
||||
void cleanup();
|
||||
bool fetchNext(QSqlCachedResult::ValueCache &values, int idx, bool initialFetch);
|
||||
// initializes the recordInfo and the cache
|
||||
void initColumns(bool emptyResultset);
|
||||
void finalize();
|
||||
|
||||
QSQLiteResult* q;
|
||||
sqlite3 *access;
|
||||
|
||||
sqlite3_stmt *stmt;
|
||||
|
||||
bool skippedStatus; // the status of the fetchNext() that's skipped
|
||||
bool skipRow; // skip the next fetchNext()?
|
||||
QSqlRecord rInf;
|
||||
QVector<QVariant> firstRow;
|
||||
};
|
||||
|
||||
QSQLiteResultPrivate::QSQLiteResultPrivate(QSQLiteResult* res) : q(res), access(0),
|
||||
stmt(0), skippedStatus(false), skipRow(false)
|
||||
{
|
||||
}
|
||||
|
||||
void QSQLiteResultPrivate::cleanup()
|
||||
{
|
||||
finalize();
|
||||
rInf.clear();
|
||||
skippedStatus = false;
|
||||
skipRow = false;
|
||||
q->setAt(QSql::BeforeFirstRow);
|
||||
q->setActive(false);
|
||||
q->cleanup();
|
||||
}
|
||||
|
||||
void QSQLiteResultPrivate::finalize()
|
||||
{
|
||||
if (!stmt)
|
||||
return;
|
||||
|
||||
sqlite3_finalize(stmt);
|
||||
stmt = 0;
|
||||
}
|
||||
|
||||
void QSQLiteResultPrivate::initColumns(bool emptyResultset)
|
||||
{
|
||||
int nCols = sqlite3_column_count(stmt);
|
||||
if (nCols <= 0)
|
||||
return;
|
||||
|
||||
q->init(nCols);
|
||||
|
||||
for (int i = 0; i < nCols; ++i) {
|
||||
QString colName = QString::fromUtf16(
|
||||
static_cast<const ushort *>(sqlite3_column_name16(stmt, i))
|
||||
).remove(QLatin1Char('"'));
|
||||
|
||||
// must use typeName for resolving the type to match QSqliteDriver::record
|
||||
QString typeName = QString::fromUtf16(
|
||||
static_cast<const ushort *>(sqlite3_column_decltype16(stmt, i)));
|
||||
|
||||
int dotIdx = colName.lastIndexOf(QLatin1Char('.'));
|
||||
QSqlField fld(colName.mid(dotIdx == -1 ? 0 : dotIdx + 1), qGetColumnType(typeName));
|
||||
|
||||
// sqlite3_column_type is documented to have undefined behavior if the result set is empty
|
||||
int stp = emptyResultset ? -1 : sqlite3_column_type(stmt, i);
|
||||
fld.setSqlType(stp);
|
||||
rInf.append(fld);
|
||||
}
|
||||
}
|
||||
|
||||
bool QSQLiteResultPrivate::fetchNext(QSqlCachedResult::ValueCache &values, int idx, bool initialFetch)
|
||||
{
|
||||
int res;
|
||||
int i;
|
||||
|
||||
if (skipRow) {
|
||||
// already fetched
|
||||
Q_ASSERT(!initialFetch);
|
||||
skipRow = false;
|
||||
for(int i=0;i<firstRow.count();i++)
|
||||
values[i]=firstRow[i];
|
||||
return skippedStatus;
|
||||
}
|
||||
skipRow = initialFetch;
|
||||
|
||||
if(initialFetch) {
|
||||
firstRow.clear();
|
||||
firstRow.resize(sqlite3_column_count(stmt));
|
||||
}
|
||||
|
||||
if (!stmt) {
|
||||
q->setLastError(QSqlError(QCoreApplication::translate("QSQLiteResult", "Unable to fetch row"),
|
||||
QCoreApplication::translate("QSQLiteResult", "No query"), QSqlError::ConnectionError));
|
||||
q->setAt(QSql::AfterLastRow);
|
||||
return false;
|
||||
}
|
||||
res = sqlite3_step(stmt);
|
||||
|
||||
switch(res) {
|
||||
case SQLITE_ROW:
|
||||
// check to see if should fill out columns
|
||||
if (rInf.isEmpty())
|
||||
// must be first call.
|
||||
initColumns(false);
|
||||
if (idx < 0 && !initialFetch)
|
||||
return true;
|
||||
for (i = 0; i < rInf.count(); ++i) {
|
||||
switch (sqlite3_column_type(stmt, i)) {
|
||||
case SQLITE_BLOB:
|
||||
values[i + idx] = QByteArray(static_cast<const char *>(
|
||||
sqlite3_column_blob(stmt, i)),
|
||||
sqlite3_column_bytes(stmt, i));
|
||||
break;
|
||||
case SQLITE_INTEGER:
|
||||
values[i + idx] = sqlite3_column_int64(stmt, i);
|
||||
break;
|
||||
case SQLITE_FLOAT:
|
||||
switch(q->numericalPrecisionPolicy()) {
|
||||
case QSql::LowPrecisionInt32:
|
||||
values[i + idx] = sqlite3_column_int(stmt, i);
|
||||
break;
|
||||
case QSql::LowPrecisionInt64:
|
||||
values[i + idx] = sqlite3_column_int64(stmt, i);
|
||||
break;
|
||||
case QSql::LowPrecisionDouble:
|
||||
case QSql::HighPrecision:
|
||||
default:
|
||||
values[i + idx] = sqlite3_column_double(stmt, i);
|
||||
break;
|
||||
};
|
||||
break;
|
||||
case SQLITE_NULL:
|
||||
values[i + idx] = QVariant(QVariant::String);
|
||||
break;
|
||||
default:
|
||||
values[i + idx] = QString::fromUtf16(static_cast<const ushort *>(
|
||||
sqlite3_column_text16(stmt, i)),
|
||||
sqlite3_column_bytes16(stmt, i) / sizeof(ushort));
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
case SQLITE_DONE:
|
||||
if (rInf.isEmpty())
|
||||
// must be first call.
|
||||
initColumns(true);
|
||||
q->setAt(QSql::AfterLastRow);
|
||||
sqlite3_reset(stmt);
|
||||
return false;
|
||||
case SQLITE_ERROR:
|
||||
// SQLITE_ERROR is a generic error code and we must call sqlite3_reset()
|
||||
// to get the specific error message.
|
||||
res = sqlite3_reset(stmt);
|
||||
q->setLastError(qMakeError(access, QCoreApplication::translate("QSQLiteResult",
|
||||
"Unable to fetch row"), QSqlError::ConnectionError, res));
|
||||
q->setAt(QSql::AfterLastRow);
|
||||
return false;
|
||||
case SQLITE_MISUSE:
|
||||
case SQLITE_BUSY:
|
||||
default:
|
||||
// something wrong, don't get col info, but still return false
|
||||
q->setLastError(qMakeError(access, QCoreApplication::translate("QSQLiteResult",
|
||||
"Unable to fetch row"), QSqlError::ConnectionError, res));
|
||||
sqlite3_reset(stmt);
|
||||
q->setAt(QSql::AfterLastRow);
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
QSQLiteResult::QSQLiteResult(const QSQLiteDriver* db)
|
||||
: QSqlCachedResult(db)
|
||||
{
|
||||
d = new QSQLiteResultPrivate(this);
|
||||
d->access = db->d->access;
|
||||
}
|
||||
|
||||
QSQLiteResult::~QSQLiteResult()
|
||||
{
|
||||
d->cleanup();
|
||||
delete d;
|
||||
}
|
||||
|
||||
void QSQLiteResult::virtual_hook(int id, void *data)
|
||||
{
|
||||
switch (id) {
|
||||
case QSqlResult::DetachFromResultSet:
|
||||
if (d->stmt)
|
||||
sqlite3_reset(d->stmt);
|
||||
break;
|
||||
default:
|
||||
QSqlCachedResult::virtual_hook(id, data);
|
||||
}
|
||||
}
|
||||
|
||||
bool QSQLiteResult::reset(const QString &query)
|
||||
{
|
||||
if (!prepare(query))
|
||||
return false;
|
||||
return exec();
|
||||
}
|
||||
|
||||
bool QSQLiteResult::prepare(const QString &query)
|
||||
{
|
||||
if (!driver() || !driver()->isOpen() || driver()->isOpenError())
|
||||
return false;
|
||||
|
||||
d->cleanup();
|
||||
|
||||
setSelect(false);
|
||||
|
||||
#if (SQLITE_VERSION_NUMBER >= 3003011)
|
||||
int res = sqlite3_prepare16_v2(d->access, query.constData(), (query.size() + 1) * sizeof(QChar),
|
||||
&d->stmt, 0);
|
||||
#else
|
||||
int res = sqlite3_prepare16(d->access, query.constData(), (query.size() + 1) * sizeof(QChar),
|
||||
&d->stmt, 0);
|
||||
#endif
|
||||
|
||||
if (res != SQLITE_OK) {
|
||||
setLastError(qMakeError(d->access, QCoreApplication::translate("QSQLiteResult",
|
||||
"Unable to execute statement"), QSqlError::StatementError, res));
|
||||
d->finalize();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool QSQLiteResult::exec()
|
||||
{
|
||||
const QVector<QVariant> values = boundValues();
|
||||
|
||||
d->skippedStatus = false;
|
||||
d->skipRow = false;
|
||||
d->rInf.clear();
|
||||
clearValues();
|
||||
setLastError(QSqlError());
|
||||
|
||||
int res = sqlite3_reset(d->stmt);
|
||||
if (res != SQLITE_OK) {
|
||||
setLastError(qMakeError(d->access, QCoreApplication::translate("QSQLiteResult",
|
||||
"Unable to reset statement"), QSqlError::StatementError, res));
|
||||
d->finalize();
|
||||
return false;
|
||||
}
|
||||
int paramCount = sqlite3_bind_parameter_count(d->stmt);
|
||||
if (paramCount == values.count()) {
|
||||
for (int i = 0; i < paramCount; ++i) {
|
||||
res = SQLITE_OK;
|
||||
const QVariant value = values.at(i);
|
||||
|
||||
if (value.isNull()) {
|
||||
res = sqlite3_bind_null(d->stmt, i + 1);
|
||||
} else {
|
||||
switch (value.type()) {
|
||||
case QVariant::ByteArray: {
|
||||
const QByteArray *ba = static_cast<const QByteArray*>(value.constData());
|
||||
res = sqlite3_bind_blob(d->stmt, i + 1, ba->constData(),
|
||||
ba->size(), SQLITE_STATIC);
|
||||
break; }
|
||||
case QVariant::Int:
|
||||
res = sqlite3_bind_int(d->stmt, i + 1, value.toInt());
|
||||
break;
|
||||
case QVariant::Double:
|
||||
res = sqlite3_bind_double(d->stmt, i + 1, value.toDouble());
|
||||
break;
|
||||
case QVariant::UInt:
|
||||
case QVariant::LongLong:
|
||||
res = sqlite3_bind_int64(d->stmt, i + 1, value.toLongLong());
|
||||
break;
|
||||
case QVariant::String: {
|
||||
// lifetime of string == lifetime of its qvariant
|
||||
const QString *str = static_cast<const QString*>(value.constData());
|
||||
res = sqlite3_bind_text16(d->stmt, i + 1, str->utf16(),
|
||||
(str->size()) * sizeof(QChar), SQLITE_STATIC);
|
||||
break; }
|
||||
default: {
|
||||
QString str = value.toString();
|
||||
// SQLITE_TRANSIENT makes sure that sqlite buffers the data
|
||||
res = sqlite3_bind_text16(d->stmt, i + 1, str.utf16(),
|
||||
(str.size()) * sizeof(QChar), SQLITE_TRANSIENT);
|
||||
break; }
|
||||
}
|
||||
}
|
||||
if (res != SQLITE_OK) {
|
||||
setLastError(qMakeError(d->access, QCoreApplication::translate("QSQLiteResult",
|
||||
"Unable to bind parameters"), QSqlError::StatementError, res));
|
||||
d->finalize();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
setLastError(QSqlError(QCoreApplication::translate("QSQLiteResult",
|
||||
"Parameter count mismatch"), QString(), QSqlError::StatementError));
|
||||
return false;
|
||||
}
|
||||
d->skippedStatus = d->fetchNext(d->firstRow, 0, true);
|
||||
if (lastError().isValid()) {
|
||||
setSelect(false);
|
||||
setActive(false);
|
||||
return false;
|
||||
}
|
||||
setSelect(!d->rInf.isEmpty());
|
||||
setActive(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool QSQLiteResult::gotoNext(QSqlCachedResult::ValueCache& row, int idx)
|
||||
{
|
||||
return d->fetchNext(row, idx, false);
|
||||
}
|
||||
|
||||
int QSQLiteResult::size()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int QSQLiteResult::numRowsAffected()
|
||||
{
|
||||
return sqlite3_changes(d->access);
|
||||
}
|
||||
|
||||
QVariant QSQLiteResult::lastInsertId() const
|
||||
{
|
||||
if (isActive()) {
|
||||
qint64 id = sqlite3_last_insert_rowid(d->access);
|
||||
if (id)
|
||||
return id;
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
QSqlRecord QSQLiteResult::record() const
|
||||
{
|
||||
if (!isActive() || !isSelect())
|
||||
return QSqlRecord();
|
||||
return d->rInf;
|
||||
}
|
||||
|
||||
QVariant QSQLiteResult::handle() const
|
||||
{
|
||||
return qVariantFromValue(d->stmt);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
|
||||
QSQLiteDriver::QSQLiteDriver(QObject * parent)
|
||||
: QSqlDriver(parent)
|
||||
{
|
||||
d = new QSQLiteDriverPrivate();
|
||||
}
|
||||
|
||||
QSQLiteDriver::QSQLiteDriver(sqlite3 *connection, QObject *parent)
|
||||
: QSqlDriver(parent)
|
||||
{
|
||||
d = new QSQLiteDriverPrivate();
|
||||
d->access = connection;
|
||||
setOpen(true);
|
||||
setOpenError(false);
|
||||
}
|
||||
|
||||
|
||||
QSQLiteDriver::~QSQLiteDriver()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
bool QSQLiteDriver::hasFeature(DriverFeature f) const
|
||||
{
|
||||
switch (f) {
|
||||
case BLOB:
|
||||
case Transactions:
|
||||
case Unicode:
|
||||
case LastInsertId:
|
||||
case PreparedQueries:
|
||||
case PositionalPlaceholders:
|
||||
case SimpleLocking:
|
||||
case FinishQuery:
|
||||
case LowPrecisionNumbers:
|
||||
return true;
|
||||
case QuerySize:
|
||||
case NamedPlaceholders:
|
||||
case BatchOperations:
|
||||
case EventNotifications:
|
||||
case MultipleResultSets:
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static int qGetSqliteTimeout(QString opts)
|
||||
{
|
||||
enum { DefaultTimeout = 5000 };
|
||||
|
||||
opts.remove(QLatin1Char(' '));
|
||||
foreach(QString option, opts.split(QLatin1Char(';'))) {
|
||||
if (option.startsWith(QLatin1String("QSQLITE_BUSY_TIMEOUT="))) {
|
||||
bool ok;
|
||||
int nt = option.mid(21).toInt(&ok);
|
||||
if (ok)
|
||||
return nt;
|
||||
}
|
||||
}
|
||||
return DefaultTimeout;
|
||||
}
|
||||
|
||||
static int qGetSqliteOpenMode(QString opts)
|
||||
{
|
||||
opts.remove(QLatin1Char(' '));
|
||||
foreach(QString option, opts.split(QLatin1Char(';'))) {
|
||||
if (option == QLatin1String("QSQLITE_OPEN_READONLY"))
|
||||
return SQLITE_OPEN_READONLY;
|
||||
}
|
||||
return SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE;
|
||||
}
|
||||
|
||||
/*
|
||||
SQLite dbs have no user name, passwords, hosts or ports.
|
||||
just file names.
|
||||
*/
|
||||
bool QSQLiteDriver::open(const QString & db, const QString &, const QString &, const QString &, int, const QString &conOpts)
|
||||
{
|
||||
if (isOpen())
|
||||
close();
|
||||
|
||||
if (db.isEmpty())
|
||||
return false;
|
||||
|
||||
if (sqlite3_open_v2(db.toUtf8().constData(), &d->access, qGetSqliteOpenMode(conOpts), NULL) == SQLITE_OK) {
|
||||
sqlite3_busy_timeout(d->access, qGetSqliteTimeout(conOpts));
|
||||
setOpen(true);
|
||||
setOpenError(false);
|
||||
return true;
|
||||
} else {
|
||||
setLastError(qMakeError(d->access, tr("Error opening database"),
|
||||
QSqlError::ConnectionError));
|
||||
setOpenError(true);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void QSQLiteDriver::close()
|
||||
{
|
||||
if (isOpen()) {
|
||||
if (sqlite3_close(d->access) != SQLITE_OK)
|
||||
setLastError(qMakeError(d->access, tr("Error closing database"),
|
||||
QSqlError::ConnectionError));
|
||||
d->access = 0;
|
||||
setOpen(false);
|
||||
setOpenError(false);
|
||||
}
|
||||
}
|
||||
|
||||
QSqlResult *QSQLiteDriver::createResult() const
|
||||
{
|
||||
return new QSQLiteResult(this);
|
||||
}
|
||||
|
||||
bool QSQLiteDriver::beginTransaction()
|
||||
{
|
||||
if (!isOpen() || isOpenError())
|
||||
return false;
|
||||
|
||||
QSqlQuery q(createResult());
|
||||
if (!q.exec(QLatin1String("BEGIN"))) {
|
||||
setLastError(QSqlError(tr("Unable to begin transaction"),
|
||||
q.lastError().databaseText(), QSqlError::TransactionError));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool QSQLiteDriver::commitTransaction()
|
||||
{
|
||||
if (!isOpen() || isOpenError())
|
||||
return false;
|
||||
|
||||
QSqlQuery q(createResult());
|
||||
if (!q.exec(QLatin1String("COMMIT"))) {
|
||||
setLastError(QSqlError(tr("Unable to commit transaction"),
|
||||
q.lastError().databaseText(), QSqlError::TransactionError));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool QSQLiteDriver::rollbackTransaction()
|
||||
{
|
||||
if (!isOpen() || isOpenError())
|
||||
return false;
|
||||
|
||||
QSqlQuery q(createResult());
|
||||
if (!q.exec(QLatin1String("ROLLBACK"))) {
|
||||
setLastError(QSqlError(tr("Unable to rollback transaction"),
|
||||
q.lastError().databaseText(), QSqlError::TransactionError));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QStringList QSQLiteDriver::tables(QSql::TableType type) const
|
||||
{
|
||||
QStringList res;
|
||||
if (!isOpen())
|
||||
return res;
|
||||
|
||||
QSqlQuery q(createResult());
|
||||
q.setForwardOnly(true);
|
||||
|
||||
QString sql = QLatin1String("SELECT name FROM sqlite_master WHERE %1 "
|
||||
"UNION ALL SELECT name FROM sqlite_temp_master WHERE %1");
|
||||
if ((type & QSql::Tables) && (type & QSql::Views))
|
||||
sql = sql.arg(QLatin1String("type='table' OR type='view'"));
|
||||
else if (type & QSql::Tables)
|
||||
sql = sql.arg(QLatin1String("type='table'"));
|
||||
else if (type & QSql::Views)
|
||||
sql = sql.arg(QLatin1String("type='view'"));
|
||||
else
|
||||
sql.clear();
|
||||
|
||||
if (!sql.isEmpty() && q.exec(sql)) {
|
||||
while(q.next())
|
||||
res.append(q.value(0).toString());
|
||||
}
|
||||
|
||||
if (type & QSql::SystemTables) {
|
||||
// there are no internal tables beside this one:
|
||||
res.append(QLatin1String("sqlite_master"));
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static QSqlIndex qGetTableInfo(QSqlQuery &q, const QString &tableName, bool onlyPIndex = false)
|
||||
{
|
||||
QString schema;
|
||||
QString table(tableName);
|
||||
int indexOfSeparator = tableName.indexOf(QLatin1Char('.'));
|
||||
if (indexOfSeparator > -1) {
|
||||
schema = tableName.left(indexOfSeparator).append(QLatin1Char('.'));
|
||||
table = tableName.mid(indexOfSeparator + 1);
|
||||
}
|
||||
q.exec(QLatin1String("PRAGMA ") + schema + QLatin1String("table_info (") + _q_escapeIdentifier(table) + QLatin1String(")"));
|
||||
|
||||
QSqlIndex ind;
|
||||
while (q.next()) {
|
||||
bool isPk = q.value(5).toInt();
|
||||
if (onlyPIndex && !isPk)
|
||||
continue;
|
||||
QString typeName = q.value(2).toString().toLower();
|
||||
QSqlField fld(q.value(1).toString(), qGetColumnType(typeName));
|
||||
if (isPk && (typeName == QLatin1String("integer")))
|
||||
// INTEGER PRIMARY KEY fields are auto-generated in sqlite
|
||||
// INT PRIMARY KEY is not the same as INTEGER PRIMARY KEY!
|
||||
fld.setAutoValue(true);
|
||||
fld.setRequired(q.value(3).toInt() != 0);
|
||||
fld.setDefaultValue(q.value(4));
|
||||
ind.append(fld);
|
||||
}
|
||||
return ind;
|
||||
}
|
||||
|
||||
QSqlIndex QSQLiteDriver::primaryIndex(const QString &tblname) const
|
||||
{
|
||||
if (!isOpen())
|
||||
return QSqlIndex();
|
||||
|
||||
QString table = tblname;
|
||||
if (isIdentifierEscaped(table, QSqlDriver::TableName))
|
||||
table = stripDelimiters(table, QSqlDriver::TableName);
|
||||
|
||||
QSqlQuery q(createResult());
|
||||
q.setForwardOnly(true);
|
||||
return qGetTableInfo(q, table, true);
|
||||
}
|
||||
|
||||
QSqlRecord QSQLiteDriver::record(const QString &tbl) const
|
||||
{
|
||||
if (!isOpen())
|
||||
return QSqlRecord();
|
||||
|
||||
QString table = tbl;
|
||||
if (isIdentifierEscaped(table, QSqlDriver::TableName))
|
||||
table = stripDelimiters(table, QSqlDriver::TableName);
|
||||
|
||||
QSqlQuery q(createResult());
|
||||
q.setForwardOnly(true);
|
||||
return qGetTableInfo(q, table);
|
||||
}
|
||||
|
||||
QVariant QSQLiteDriver::handle() const
|
||||
{
|
||||
return qVariantFromValue(d->access);
|
||||
}
|
||||
|
||||
QString QSQLiteDriver::escapeIdentifier(const QString &identifier, IdentifierType type) const
|
||||
{
|
||||
Q_UNUSED(type);
|
||||
return _q_escapeIdentifier(identifier);
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
|
@ -0,0 +1,123 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the QtSql module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QSQL_SQLITE_H
|
||||
#define QSQL_SQLITE_H
|
||||
|
||||
#include <QtSql/qsqldriver.h>
|
||||
#include <QtSql/qsqlresult.h>
|
||||
#include <QtSql/private/qsqlcachedresult_p.h>
|
||||
|
||||
struct sqlite3;
|
||||
|
||||
#ifdef QT_PLUGIN
|
||||
#define Q_EXPORT_SQLDRIVER_SQLITE
|
||||
#else
|
||||
#define Q_EXPORT_SQLDRIVER_SQLITE Q_SQL_EXPORT
|
||||
#endif
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QSQLiteDriverPrivate;
|
||||
class QSQLiteResultPrivate;
|
||||
class QSQLiteDriver;
|
||||
|
||||
class QSQLiteResult : public QSqlCachedResult
|
||||
{
|
||||
friend class QSQLiteDriver;
|
||||
friend class QSQLiteResultPrivate;
|
||||
public:
|
||||
explicit QSQLiteResult(const QSQLiteDriver* db);
|
||||
~QSQLiteResult();
|
||||
QVariant handle() const;
|
||||
|
||||
protected:
|
||||
bool gotoNext(QSqlCachedResult::ValueCache& row, int idx);
|
||||
bool reset(const QString &query);
|
||||
bool prepare(const QString &query);
|
||||
bool exec();
|
||||
int size();
|
||||
int numRowsAffected();
|
||||
QVariant lastInsertId() const;
|
||||
QSqlRecord record() const;
|
||||
void virtual_hook(int id, void *data);
|
||||
|
||||
private:
|
||||
QSQLiteResultPrivate* d;
|
||||
};
|
||||
|
||||
class Q_EXPORT_SQLDRIVER_SQLITE QSQLiteDriver : public QSqlDriver
|
||||
{
|
||||
Q_OBJECT
|
||||
friend class QSQLiteResult;
|
||||
public:
|
||||
explicit QSQLiteDriver(QObject *parent = 0);
|
||||
explicit QSQLiteDriver(sqlite3 *connection, QObject *parent = 0);
|
||||
~QSQLiteDriver();
|
||||
bool hasFeature(DriverFeature f) const;
|
||||
bool open(const QString & db,
|
||||
const QString & user,
|
||||
const QString & password,
|
||||
const QString & host,
|
||||
int port,
|
||||
const QString & connOpts);
|
||||
void close();
|
||||
QSqlResult *createResult() const;
|
||||
bool beginTransaction();
|
||||
bool commitTransaction();
|
||||
bool rollbackTransaction();
|
||||
QStringList tables(QSql::TableType) const;
|
||||
|
||||
QSqlRecord record(const QString& tablename) const;
|
||||
QSqlIndex primaryIndex(const QString &table) const;
|
||||
QVariant handle() const;
|
||||
QString escapeIdentifier(const QString &identifier, IdentifierType) const;
|
||||
|
||||
private:
|
||||
QSQLiteDriverPrivate* d;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // QSQL_SQLITE_H
|
|
@ -0,0 +1,34 @@
|
|||
# if defined(UNDER_CE)
|
||||
# include <winbase.h>
|
||||
# else
|
||||
# include <winver.h>
|
||||
# endif
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 4,6,1,0
|
||||
PRODUCTVERSION 4,6,1,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS VS_FF_DEBUG
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS VOS__WINDOWS32
|
||||
FILETYPE VFT_DLL
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904B0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Nokia Corporation and/or its subsidiary(-ies)\0"
|
||||
VALUE "FileDescription", "C++ application development framework.\0"
|
||||
VALUE "FileVersion", "4.6.1.0\0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)\0"
|
||||
VALUE "OriginalFilename", "qsqlite4.dll\0"
|
||||
VALUE "ProductName", "Qt4\0"
|
||||
END
|
||||
END
|
||||
END
|
||||
/* End of Version info */
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** Commercial Usage
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** If you have questions regarding the use of this file, please contact
|
||||
** Nokia at qt-info@nokia.com.
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <qsqldriverplugin.h>
|
||||
#include <qstringlist.h>
|
||||
#include "qsql_sqlite.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QSQLiteDriverPlugin : public QSqlDriverPlugin
|
||||
{
|
||||
public:
|
||||
QSQLiteDriverPlugin();
|
||||
|
||||
QSqlDriver* create(const QString &);
|
||||
QStringList keys() const;
|
||||
};
|
||||
|
||||
QSQLiteDriverPlugin::QSQLiteDriverPlugin()
|
||||
: QSqlDriverPlugin()
|
||||
{
|
||||
}
|
||||
|
||||
QSqlDriver* QSQLiteDriverPlugin::create(const QString &name)
|
||||
{
|
||||
if (name == QLatin1String("QSQLITE")) {
|
||||
QSQLiteDriver* driver = new QSQLiteDriver();
|
||||
return driver;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
QStringList QSQLiteDriverPlugin::keys() const
|
||||
{
|
||||
QStringList l;
|
||||
l << QLatin1String("QSQLITE");
|
||||
return l;
|
||||
}
|
||||
|
||||
Q_EXPORT_STATIC_PLUGIN(QSQLiteDriverPlugin)
|
||||
Q_EXPORT_PLUGIN2(qsqlite, QSQLiteDriverPlugin)
|
||||
|
||||
QT_END_NAMESPACE
|
|
@ -0,0 +1,11 @@
|
|||
--- smain.cpp.old 2010-03-22 17:34:03.000000000 +0000
|
||||
+++ smain.cpp 2010-03-22 17:34:08.000000000 +0000
|
||||
@@ -41,7 +41,7 @@
|
||||
|
||||
#include <qsqldriverplugin.h>
|
||||
#include <qstringlist.h>
|
||||
-#include "../../../../src/sql/drivers/sqlite/qsql_sqlite.h"
|
||||
+#include "qsql_sqlite.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -89,6 +89,11 @@ add_subdirectory(src)
|
|||
|
||||
add_subdirectory(tests)
|
||||
|
||||
if (WIN32)
|
||||
add_definitions(-DQT_STATICPLUGIN)
|
||||
add_subdirectory(3rdparty/qsqlite)
|
||||
endif(WIN32)
|
||||
|
||||
# Uninstall support
|
||||
configure_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
|
||||
|
|
Before Width: | Height: | Size: 9.1 KiB After Width: | Height: | Size: 9.1 KiB |
|
@ -1,13 +0,0 @@
|
|||
--- src/combined/ffmpeg/ff_video_decoder.c~ 2010-02-13 13:42:52.000000000 +0000
|
||||
+++ src/combined/ffmpeg/ff_video_decoder.c 2010-02-13 13:42:52.000000000 +0000
|
||||
@@ -1235,8 +1235,10 @@
|
||||
if (this->decoder_init_mode) {
|
||||
int codec_type = buf->type & 0xFFFF0000;
|
||||
|
||||
+#ifdef AVCODEC_HAS_REORDERED_OPAQUE
|
||||
if (!ff_check_extradata(this, codec_type, buf))
|
||||
return;
|
||||
+#endif // AVCODEC_HAS_REORDERED_OPAQUE
|
||||
|
||||
/* init ffmpeg decoder */
|
||||
init_video_codec(this, codec_type);
|
|
@ -1,11 +0,0 @@
|
|||
--- src/input/input_file.c~ 2010-02-13 18:29:48.000000000 +0000
|
||||
+++ src/input/input_file.c 2010-02-13 18:29:48.000000000 +0000
|
||||
@@ -362,7 +362,7 @@
|
||||
else
|
||||
filename = strdup(this->mrl); /* NEVER unescape plain file names! */
|
||||
|
||||
- this->fh = open (filename, O_RDONLY|O_BINARY);
|
||||
+ this->fh = open (filename+1, O_RDONLY|O_BINARY);
|
||||
|
||||
if (this->fh == -1) {
|
||||
if (errno == EACCES) {
|
|
@ -1,138 +0,0 @@
|
|||
--- src/libspuhdmv/xine_hdmv_decoder_old.c 2009-11-30 20:55:59 +0000
|
||||
+++ src/libspuhdmv/xine_hdmv_decoder.c 2010-02-05 02:38:39 +0000
|
||||
@@ -47,8 +47,8 @@
|
||||
|
||||
#define TRACE(x...) printf(x)
|
||||
/*#define TRACE(x...) */
|
||||
-#define ERROR(x...) fprintf(stderr, "spuhdmv: " x)
|
||||
-/*#define ERROR(x...) lprintf(x) */
|
||||
+#define HDMVERROR(x...) fprintf(stderr, "spuhdmv: " x)
|
||||
+/*#define HDMVERROR(x...) lprintf(x) */
|
||||
|
||||
/*
|
||||
* cached palette (xine-lib format)
|
||||
@@ -73,7 +73,7 @@
|
||||
uint16_t width, height;
|
||||
|
||||
rle_elem_t *rle;
|
||||
- uint num_rle;
|
||||
+ unsigned int num_rle;
|
||||
size_t data_size;
|
||||
|
||||
#if 0
|
||||
@@ -150,7 +150,7 @@
|
||||
|
||||
#define LIST_REPLACE(list, obj, FREE_FUNC) \
|
||||
do { \
|
||||
- uint id = obj->id; \
|
||||
+ unsigned int id = obj->id; \
|
||||
\
|
||||
/* insert to list */ \
|
||||
obj->next = list; \
|
||||
@@ -252,7 +252,7 @@
|
||||
if ( buf->segment_type < 0x14 ||
|
||||
( buf->segment_type > 0x18 &&
|
||||
buf->segment_type != 0x80)) {
|
||||
- ERROR("unknown segment type, resetting\n");
|
||||
+ HDMVERROR("unknown segment type, resetting\n");
|
||||
segbuf_reset(buf);
|
||||
}
|
||||
} else {
|
||||
@@ -291,10 +291,10 @@
|
||||
|
||||
segbuf_parse_segment_header(buf);
|
||||
|
||||
- TRACE(" skip_segment: %d bytes left\n", (uint)buf->len);
|
||||
+ TRACE(" skip_segment: %d bytes left\n", (unsigned int)buf->len);
|
||||
} else {
|
||||
- ERROR(" skip_segment: ERROR - %d bytes queued, %d required\n",
|
||||
- (uint)buf->len, buf->segment_len);
|
||||
+ HDMVERROR(" skip_segment: ERROR - %d bytes queued, %d required\n",
|
||||
+ (unsigned int)buf->len, buf->segment_len);
|
||||
segbuf_reset (buf);
|
||||
}
|
||||
}
|
||||
@@ -319,7 +319,7 @@
|
||||
{
|
||||
if (!(buf->error = ++buf->segment_data > buf->segment_end))
|
||||
return buf->segment_data[-1];
|
||||
- ERROR("segbuf_get_u8: read failed (end of segment reached) !");
|
||||
+ HDMVERROR("segbuf_get_u8: read failed (end of segment reached) !");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -341,7 +341,7 @@
|
||||
if (buf->segment_data <= buf->segment_end)
|
||||
return val;
|
||||
}
|
||||
- ERROR("segbuf_get_string(%d): read failed (end of segment reached) !", (int)len);
|
||||
+ HDMVERROR("segbuf_get_string(%d): read failed (end of segment reached) !", (int)len);
|
||||
buf->error = 1;
|
||||
return NULL;
|
||||
}
|
||||
@@ -363,12 +363,12 @@
|
||||
return NULL;
|
||||
|
||||
if (len % 5) {
|
||||
- ERROR(" decode_palette: segment size error (%d ; expected %d for %d entries)\n",
|
||||
- (uint)len, (uint)(5 * entries), (uint)entries);
|
||||
+ HDMVERROR(" decode_palette: segment size error (%d ; expected %d for %d entries)\n",
|
||||
+ (unsigned int)len, (unsigned int)(5 * entries), (unsigned int)entries);
|
||||
return NULL;
|
||||
}
|
||||
TRACE("decode_palette: %d items (id %d, version %d)\n",
|
||||
- (uint)entries, palette_id, palette_version_number);
|
||||
+ (unsigned int)entries, palette_id, palette_version_number);
|
||||
|
||||
/* convert to xine-lib clut */
|
||||
subtitle_clut_t *clut = calloc(1, sizeof(subtitle_clut_t));
|
||||
@@ -480,7 +480,7 @@
|
||||
}
|
||||
|
||||
} else {
|
||||
- ERROR(" TODO: APPEND RLE, length %d bytes\n", buf->segment_len - 4);
|
||||
+ HDMVERROR(" TODO: APPEND RLE, length %d bytes\n", buf->segment_len - 4);
|
||||
/* TODO */
|
||||
free_subtitle_object(obj);
|
||||
return NULL;
|
||||
@@ -681,7 +681,7 @@
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int show_overlay(spuhdmv_decoder_t *this, composition_object_t *cobj, uint palette_id_ref,
|
||||
+static int show_overlay(spuhdmv_decoder_t *this, composition_object_t *cobj, unsigned int palette_id_ref,
|
||||
int overlay_index, int64_t pts, int force_update)
|
||||
{
|
||||
video_overlay_manager_t *ovl_manager = this->stream->video_out->get_overlay_manager(this->stream->video_out);
|
||||
@@ -819,7 +819,7 @@
|
||||
|
||||
for (i = 0; i < pseg->object_number; i++) {
|
||||
if (!cobj) {
|
||||
- ERROR("show_overlays: composition object %d missing !\n", i);
|
||||
+ HDMVERROR("show_overlays: composition object %d missing !\n", i);
|
||||
} else {
|
||||
show_overlay(this, cobj, pseg->palette_id_ref, i, pseg->pts, !pseg->shown);
|
||||
cobj = cobj->next;
|
||||
@@ -844,7 +844,7 @@
|
||||
static void decode_segment(spuhdmv_decoder_t *this)
|
||||
{
|
||||
TRACE("*** new segment, pts %010ld: 0x%02x (%8d bytes)",
|
||||
- this->pts, (uint)this->buf->segment_type, (uint)this->buf->segment_len);
|
||||
+ this->pts, (unsigned int)this->buf->segment_type, (unsigned int)this->buf->segment_len);
|
||||
|
||||
switch (this->buf->segment_type) {
|
||||
case 0x14:
|
||||
@@ -872,11 +872,11 @@
|
||||
free_objs(this);
|
||||
break;
|
||||
default:
|
||||
- ERROR(" segment type 0x%x unknown, skipping\n", this->buf->segment_type);
|
||||
+ HDMVERROR(" segment type 0x%x unknown, skipping\n", this->buf->segment_type);
|
||||
break;
|
||||
}
|
||||
if (this->buf->error) {
|
||||
- ERROR("*** DECODE ERROR ***\n");
|
||||
+ HDMVERROR("*** DECODE ERROR ***\n");
|
||||
}
|
||||
|
||||
update_overlays (this);
|
|
@ -184,7 +184,7 @@ endif(APPLE)
|
|||
|
||||
# resource file for windows
|
||||
if(WIN32)
|
||||
set(CLEMENTINE-WIN32-RESOURCES ../dist/windres.rc)
|
||||
set(CLEMENTINE-WIN32-RESOURCES ../dist/windows/windres.rc)
|
||||
endif(WIN32)
|
||||
|
||||
qt4_wrap_cpp(CLEMENTINE-SOURCES-MOC ${CLEMENTINE-MOC-HEADERS})
|
||||
|
@ -222,6 +222,12 @@ if (APPLE)
|
|||
endif (APPLE)
|
||||
add_dependencies(clementine_lib qtsingleapplication qxt)
|
||||
|
||||
# Link against the qsqlite plugin on windows
|
||||
if(WIN32)
|
||||
set(3RDPARTY_SQLITE_LIBRARY qsqlite)
|
||||
target_link_libraries(clementine_lib qsqlite)
|
||||
endif(WIN32)
|
||||
|
||||
add_executable(clementine
|
||||
MACOSX_BUNDLE
|
||||
WIN32
|
||||
|
|
|
@ -18,15 +18,15 @@
|
|||
const char* LibraryBackend::kDatabaseName = "clementine.db";
|
||||
const int LibraryBackend::kSchemaVersion = 5;
|
||||
|
||||
void (*LibraryBackend::_sqlite3_create_function) (
|
||||
int (*LibraryBackend::_sqlite3_create_function) (
|
||||
sqlite3*, const char*, int, int, void*,
|
||||
void (*) (sqlite3_context*, int, sqlite3_value**),
|
||||
void (*) (sqlite3_context*, int, sqlite3_value**),
|
||||
void (*) (sqlite3_context*)) = NULL;
|
||||
int (*LibraryBackend::_sqlite3_value_type) (sqlite3_value*) = NULL;
|
||||
sqlite_int64 (*LibraryBackend::_sqlite3_value_int64) (sqlite3_value*) = NULL;
|
||||
uchar* (*LibraryBackend::_sqlite3_value_text) (sqlite3_value*) = NULL;
|
||||
void (*LibraryBackend::_sqlite3_result_int64) (sqlite3_context*, int) = NULL;
|
||||
const uchar* (*LibraryBackend::_sqlite3_value_text) (sqlite3_value*) = NULL;
|
||||
void (*LibraryBackend::_sqlite3_result_int64) (sqlite3_context*, sqlite3_int64) = NULL;
|
||||
|
||||
|
||||
bool LibraryBackend::StaticInit() {
|
||||
|
@ -34,8 +34,18 @@ bool LibraryBackend::StaticInit() {
|
|||
return true;
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
// We statically link libqsqlite.dll on windows so these symbols are already
|
||||
// available
|
||||
_sqlite3_create_function = sqlite3_create_function;
|
||||
_sqlite3_value_type = sqlite3_value_type;
|
||||
_sqlite3_value_int64 = sqlite3_value_int64;
|
||||
_sqlite3_value_text = sqlite3_value_text;
|
||||
_sqlite3_result_int64 = sqlite3_result_int64;
|
||||
#else // Q_OS_WIN32
|
||||
QString plugin_path = QLibraryInfo::location(QLibraryInfo::PluginsPath) +
|
||||
"/sqldrivers/libqsqlite";
|
||||
|
||||
QLibrary library(plugin_path);
|
||||
if (!library.load()) {
|
||||
qDebug() << "QLibrary::load() failed for " << plugin_path;
|
||||
|
@ -48,9 +58,9 @@ bool LibraryBackend::StaticInit() {
|
|||
library.resolve("sqlite3_value_type"));
|
||||
_sqlite3_value_int64 = reinterpret_cast<sqlite_int64 (*) (sqlite3_value*)>(
|
||||
library.resolve("sqlite3_value_int64"));
|
||||
_sqlite3_value_text = reinterpret_cast<uchar* (*) (sqlite3_value*)>(
|
||||
_sqlite3_value_text = reinterpret_cast<const uchar* (*) (sqlite3_value*)>(
|
||||
library.resolve("sqlite3_value_text"));
|
||||
_sqlite3_result_int64 = reinterpret_cast<void (*) (sqlite3_context*, int)>(
|
||||
_sqlite3_result_int64 = reinterpret_cast<void (*) (sqlite3_context*, sqlite3_int64)>(
|
||||
library.resolve("sqlite3_result_int64"));
|
||||
|
||||
if (_sqlite3_create_function &&
|
||||
|
@ -60,7 +70,9 @@ bool LibraryBackend::StaticInit() {
|
|||
_sqlite3_result_int64) {
|
||||
return true;
|
||||
}
|
||||
qDebug() << "Couldn't resolve sqlite symbols";
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool LibraryBackend::Like(const char* needle, const char* haystack) {
|
||||
|
|
|
@ -125,7 +125,7 @@ class LibraryBackend : public QObject {
|
|||
// Custom LIKE() function for sqlite.
|
||||
static bool Like(const char* needle, const char* haystack);
|
||||
static void SqliteLike(sqlite3_context* context, int argc, sqlite3_value** argv);
|
||||
typedef void (*Sqlite3CreateFunc) (
|
||||
typedef int (*Sqlite3CreateFunc) (
|
||||
sqlite3*, const char*, int, int, void*,
|
||||
void (*) (sqlite3_context*, int, sqlite3_value**),
|
||||
void (*) (sqlite3_context*, int, sqlite3_value**),
|
||||
|
@ -135,8 +135,8 @@ class LibraryBackend : public QObject {
|
|||
static Sqlite3CreateFunc _sqlite3_create_function;
|
||||
static int (*_sqlite3_value_type) (sqlite3_value*);
|
||||
static sqlite_int64 (*_sqlite3_value_int64) (sqlite3_value*);
|
||||
static uchar* (*_sqlite3_value_text) (sqlite3_value*);
|
||||
static void (*_sqlite3_result_int64) (sqlite3_context*, int);
|
||||
static const uchar* (*_sqlite3_value_text) (sqlite3_value*);
|
||||
static void (*_sqlite3_result_int64) (sqlite3_context*, sqlite3_int64);
|
||||
};
|
||||
|
||||
#endif // LIBRARYBACKEND_H
|
||||
|
|
|
@ -16,6 +16,12 @@
|
|||
#include <QDir>
|
||||
#include <QNetworkAccessManager>
|
||||
|
||||
// Load sqlite plugin on windows
|
||||
#ifdef WIN32
|
||||
# include <QtPlugin>
|
||||
Q_IMPORT_PLUGIN(qsqlite)
|
||||
#endif
|
||||
|
||||
void LoadTranslation(const QString& prefix, const QString& path) {
|
||||
QTranslator* t = new QTranslator;
|
||||
t->load(prefix + "_" + QLocale::system().name(), path);
|
||||
|
|
Loading…
Reference in New Issue