[epiphany/history-rewrite: 24/45] history-service-urls-table: Add a zoom_level column



commit 7f3802be04d0737592a292fcef281c854ae8f1fd
Author: Claudio Saavedra <csaavedra igalia com>
Date:   Tue Jul 5 20:16:37 2011 +0300

    history-service-urls-table: Add a zoom_level column
    
    Bind it with the zoom_level field in EphyHistoryURL

 lib/history/ephy-history-service-urls-table.c |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/lib/history/ephy-history-service-urls-table.c b/lib/history/ephy-history-service-urls-table.c
index b48467f..91945df 100644
--- a/lib/history/ephy-history-service-urls-table.c
+++ b/lib/history/ephy-history-service-urls-table.c
@@ -40,7 +40,8 @@ ephy_history_service_initialize_urls_table (EphyHistoryService *self)
     "visit_count INTEGER DEFAULT 0 NOT NULL,"
     "typed_count INTEGER DEFAULT 0 NOT NULL,"
     "last_visit_time INTEGER,"
-    "favicon_id INTEGER DEFAULT 0 NOT NULL)", &error);
+    "favicon_id INTEGER DEFAULT 0 NOT NULL,"
+    "zoom_level REAL DEFAULT 1.0)", &error);
 
   if (error) {
     g_error("Could not create urls table: %s", error->message);
@@ -68,11 +69,11 @@ ephy_history_service_get_url_row (EphyHistoryService *self, const char *url_stri
 
   if (url != NULL && url->id != -1) {
     statement = ephy_sqlite_connection_create_statement (priv->history_database,
-      "SELECT id, url, title, visit_count, typed_count, last_visit_time FROM urls "
+      "SELECT id, url, title, visit_count, typed_count, last_visit_time, zoom_level FROM urls "
       "WHERE id=?", &error);
   } else {
     statement = ephy_sqlite_connection_create_statement (priv->history_database,
-      "SELECT id, url, title, visit_count, typed_count, last_visit_time FROM urls "
+      "SELECT id, url, title, visit_count, typed_count, last_visit_time, zoom_level FROM urls "
       "WHERE url=?", &error);
   }
 
@@ -114,6 +115,7 @@ ephy_history_service_get_url_row (EphyHistoryService *self, const char *url_stri
   url->visit_count = ephy_sqlite_statement_get_column_as_int (statement, 3),
   url->typed_count = ephy_sqlite_statement_get_column_as_int (statement, 4),
   url->last_visit_time = ephy_sqlite_statement_get_column_as_int (statement, 5);
+  url->zoom_level = ephy_sqlite_statement_get_column_as_double (statement, 6);
 
   g_object_unref (statement);
   return url;
@@ -130,8 +132,8 @@ ephy_history_service_add_url_row (EphyHistoryService *self, EphyHistoryURL *url)
   g_assert (priv->history_database != NULL);
 
   statement = ephy_sqlite_connection_create_statement (priv->history_database,
-    "INSERT INTO urls (url, title, visit_count, typed_count, last_visit_time) "
-    " VALUES (?, ?, ?, ?, ?)", &error);
+    "INSERT INTO urls (url, title, visit_count, typed_count, last_visit_time, zoom_level) "
+    " VALUES (?, ?, ?, ?, ?, ?)", &error);
   if (error) {
     g_error ("Could not build urls table addition statement: %s", error->message);
     g_error_free (error);
@@ -142,7 +144,8 @@ ephy_history_service_add_url_row (EphyHistoryService *self, EphyHistoryURL *url)
       ephy_sqlite_statement_bind_string (statement, 1, url->title, &error) == FALSE || 
       ephy_sqlite_statement_bind_int (statement, 2, url->visit_count, &error) == FALSE ||
       ephy_sqlite_statement_bind_int (statement, 3, url->typed_count, &error) == FALSE ||
-      ephy_sqlite_statement_bind_int (statement, 4, url->last_visit_time, &error) == FALSE) {
+      ephy_sqlite_statement_bind_int (statement, 4, url->last_visit_time, &error) == FALSE ||
+      ephy_sqlite_statement_bind_double (statement, 5, url->zoom_level, &error) == FALSE) {
     g_error ("Could not insert URL into urls table: %s", error->message);
     g_object_unref (error);
     return;
@@ -170,7 +173,7 @@ ephy_history_service_update_url_row (EphyHistoryService *self, EphyHistoryURL *u
   g_assert (priv->history_database != NULL);
 
   statement = ephy_sqlite_connection_create_statement (priv->history_database,
-    "UPDATE urls SET title=?, visit_count=?, typed_count=?, last_visit_time=? "
+    "UPDATE urls SET title=?, visit_count=?, typed_count=?, last_visit_time=?, zoom_level=? "
     "WHERE id=?", &error);
   if (error) {
     g_error ("Could not build urls table modification statement: %s", error->message);
@@ -182,7 +185,8 @@ ephy_history_service_update_url_row (EphyHistoryService *self, EphyHistoryURL *u
       ephy_sqlite_statement_bind_int (statement, 1, url->visit_count, &error) == FALSE ||
       ephy_sqlite_statement_bind_int (statement, 2, url->typed_count, &error) == FALSE ||
       ephy_sqlite_statement_bind_int (statement, 3, url->last_visit_time, &error) == FALSE ||
-      ephy_sqlite_statement_bind_int (statement, 4, url->id, &error) == FALSE) {
+      ephy_sqlite_statement_bind_double (statement, 4, url->zoom_level, &error) == FALSE ||
+      ephy_sqlite_statement_bind_int (statement, 5, url->id, &error) == FALSE) {
     g_error ("Could not modify URL in urls table: %s", error->message);
     g_object_unref (error);
     return;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]