Commit ab815c16 authored by Lukas Appelhans's avatar Lukas Appelhans
Browse files

Fix akabei-create-db

parent 3104f14c
...@@ -110,7 +110,7 @@ qint64 PolKitSQLiteConnection::getLastRowId() ...@@ -110,7 +110,7 @@ qint64 PolKitSQLiteConnection::getLastRowId()
void PolKitSQLiteConnection::bind(QString const& key, int value) void PolKitSQLiteConnection::bind(QString const& key, int value)
{ {
if (!d->access) if (!d->access.testFlag(Akabei::Helpers::NoPermission))
d->connection->bind(key, value); d->connection->bind(key, value);
if (d->access & Akabei::Helpers::ReadWritePermission) if (d->access & Akabei::Helpers::ReadWritePermission)
...@@ -127,7 +127,7 @@ void PolKitSQLiteConnection::bind(QString const& key, int value) ...@@ -127,7 +127,7 @@ void PolKitSQLiteConnection::bind(QString const& key, int value)
void PolKitSQLiteConnection::bind(QString const& key, QString const& value) void PolKitSQLiteConnection::bind(QString const& key, QString const& value)
{ {
if (!d->access) if (!d->access.testFlag(Akabei::Helpers::NoPermission))
d->connection->bind(key, value); d->connection->bind(key, value);
if (d->access & Akabei::Helpers::ReadWritePermission) if (d->access & Akabei::Helpers::ReadWritePermission)
...@@ -144,7 +144,7 @@ void PolKitSQLiteConnection::bind(QString const& key, QString const& value) ...@@ -144,7 +144,7 @@ void PolKitSQLiteConnection::bind(QString const& key, QString const& value)
void PolKitSQLiteConnection::bind(QString const& key, QByteArray const& value) void PolKitSQLiteConnection::bind(QString const& key, QByteArray const& value)
{ {
if (!d->access) if (!d->access.testFlag(Akabei::Helpers::NoPermission))
d->connection->bind(key, value); d->connection->bind(key, value);
if (d->access & Akabei::Helpers::ReadWritePermission) if (d->access & Akabei::Helpers::ReadWritePermission)
......
...@@ -495,7 +495,7 @@ int QueryPerformer::insertPackage(PolKitSQLiteConnection &dbConnection, Package* ...@@ -495,7 +495,7 @@ int QueryPerformer::insertPackage(PolKitSQLiteConnection &dbConnection, Package*
dbConnection.bind(":Depend", dependency); dbConnection.bind(":Depend", dependency);
dbConnection.query(sqlQuery); dbConnection.query(sqlQuery);
} }
foreach (const QString& makedep, p->makeDependencies()) { foreach (const QString& makedep, p->makeDependencies()) {
sqlQuery = "INSERT INTO makedepends ('package', 'dependency') VALUES (:Package, :MakeDepend);"; sqlQuery = "INSERT INTO makedepends ('package', 'dependency') VALUES (:Package, :MakeDepend);";
dbConnection.bind(":Package", id); dbConnection.bind(":Package", id);
...@@ -561,19 +561,17 @@ int QueryPerformer::insertGroup(Database *db, Group* g) ...@@ -561,19 +561,17 @@ int QueryPerformer::insertGroup(Database *db, Group* g)
int QueryPerformer::insertGroup(PolKitSQLiteConnection &dbConnection, Group* g) int QueryPerformer::insertGroup(PolKitSQLiteConnection &dbConnection, Group* g)
{ {
// That's gonna be long.
// Query first. // Query first.
QString sqlQuery = QString sqlQuery =
"INSERT INTO groups ('name', 'description', 'icon') " "INSERT INTO groups ('name', 'description', 'icon') "
"VALUES (" "VALUES ("
":Name, :Description, :Iconname)"; ":Name, :Description, :Iconname)";
dbConnection.bind(":Name", g->name());
dbConnection.bind(":Description", g->description());
dbConnection.bind(":Iconname", g->iconName());
try { try {
dbConnection.bind(":Name", g->name());
dbConnection.bind(":Description", g->description());
dbConnection.bind(":Iconname", g->iconName());
dbConnection.query(sqlQuery); dbConnection.query(sqlQuery);
} catch (SQLiteException& e) { } catch (SQLiteException& e) {
akabeiDebug() << "Error inserting group: " << e.what(); akabeiDebug() << "Error inserting group: " << e.what();
......
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