[packagekit] [PATCH] Create transaction db properly if it's not exist
Zhang Qiang
qiang.z.zhang at intel.com
Thu Apr 21 02:24:44 PDT 2011
This commit create transaction db proxy table properly even if it's not
exist.
---
src/pk-transaction-db.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/pk-transaction-db.c b/src/pk-transaction-db.c
index 65bf7fc..a3d179d 100644
--- a/src/pk-transaction-db.c
+++ b/src/pk-transaction-db.c
@@ -940,7 +940,15 @@ pk_transaction_db_init (PkTransactionDb *tdb)
}
/* session proxy saving (since 0.5.1) */
- rc = sqlite3_exec (tdb->priv->db, "SELECT proxy_https FROM proxy LIMIT 1", NULL, NULL, &error_msg);
+ rc = sqlite3_exec (tdb->priv->db, "SELECT * FROM proxy LIMIT 1", NULL, NULL, &error_msg);
+ if (rc != SQLITE_OK) {
+ g_debug ("adding table proxy: %s", error_msg);
+ statement = "CREATE TABLE proxy (created TEXT, proxy_http TEXT, proxy_https TEXT, proxy_ftp TEXT, proxy_socks TEXT, no_proxy TEXT, pac TEXT, uid INTEGER, session TEXT);";
+ sqlite3_exec (tdb->priv->db, statement, NULL, NULL, NULL);
+ }
+
+ /* session no_proxy proxy */
+ rc = sqlite3_exec (tdb->priv->db, "SELECT no_proxy FROM proxy LIMIT 1", NULL, NULL, &error_msg);
if (rc != SQLITE_OK) {
g_debug ("altering table to repair: %s", error_msg);
sqlite3_free (error_msg);
@@ -954,14 +962,6 @@ pk_transaction_db_init (PkTransactionDb *tdb)
sqlite3_exec (tdb->priv->db, statement, NULL, NULL, NULL);
}
- /* session no_proxy proxy */
- rc = sqlite3_exec (tdb->priv->db, "SELECT no_proxy FROM proxy LIMIT 1", NULL, NULL, &error_msg);
- if (rc != SQLITE_OK) {
- g_debug ("adding table proxy: %s", error_msg);
- statement = "CREATE TABLE proxy (created TEXT, proxy_http TEXT, proxy_ftp TEXT, uid INTEGER, session TEXT);";
- sqlite3_exec (tdb->priv->db, statement, NULL, NULL, NULL);
- }
-
/* transaction root (since 0.6.4) */
rc = sqlite3_exec (tdb->priv->db, "SELECT * FROM root LIMIT 1", NULL, NULL, &error_msg);
if (rc != SQLITE_OK) {
--
1.7.2.2
More information about the PackageKit
mailing list