Commit a27670b9 authored by Daniele Cocca's avatar Daniele Cocca
Browse files

Merge branch 'rebase' of gitorious.org:chakra/akabeicore into rebase

parents c3c014c9 a17e907e
......@@ -544,12 +544,10 @@ QStringList filesFromDb(SQLiteResource &table)
QStringList files = stringlistFromDb(f);
QString prefix = table.getDataAt(0, "prefix").toString();
if (!prefix.isEmpty())
{
if (!prefix.isEmpty()) {
QDir pdir(prefix);
QStringList realfiles;
foreach (const QString &file, files)
{
foreach (const QString &file, files) {
realfiles << pdir.absoluteFilePath(file);
}
return realfiles;
......@@ -955,13 +953,13 @@ int QueryPerformer::insertDelta(Akabei::Database* db, Akabei::Delta const* delta
int QueryPerformer::insertDelta(SQLiteConnection& dbConnection, Akabei::Delta const* delta, int packageId)
{
try {
dbConnection.bind(":Package", packageId);
dbConnection.bind(":Filename", delta->filename());
dbConnection.bind(":VersionFrom", QString::fromAscii(delta->versionFrom()));
dbConnection.bind(":VersionTo", QString::fromAscii(delta->versionTo()));
dbConnection.bind(":MD5SUM", QString::fromAscii(delta->md5sum()));
dbConnection.query(QString("INSERT INTO delta (`package`, `filename`, `versionfrom`, `versionto`, `md5sum`) "
"VALUES (%1, %2, %3, %4, %5);")
.arg(packageId)
.arg(delta->filename())
.arg(QString::fromAscii(delta->versionFrom()))
.arg(QString::fromAscii(delta->versionTo()))
.arg(QString::fromAscii(delta->md5sum())));
"VALUES (:Package, :Filename, :VersionFrom, :VersionTo, :MD5SUM);"));
} catch (SQLiteException& ex) {
return SQLITE_ABORT;
}
......@@ -998,9 +996,11 @@ int QueryPerformer::insertFiles(SQLiteConnection &dbConnection, Package* p, cons
QString sqlQuery;
try {
foreach (QString file, p->retrieveFiles())
{
sqlQuery = "INSERT INTO files ('package', 'files', 'prefix') VALUES (" + QString::number(p->databaseId()) + ", '" + file + "', '" + prefix + "');";
foreach (const QString &file, p->retrieveFiles()) {
sqlQuery = "INSERT INTO files ('package', 'files', 'prefix') VALUES (:Package, :File, :Prefix);";
dbConnection.bind(":Package", p->databaseId());
dbConnection.bind(":File", file);
dbConnection.bind(":Prefix", prefix);
dbConnection.query(sqlQuery);
}
} catch (SQLiteException& e) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment