Merge lp:~ivaldi/midori/endless-user-version into lp:midori

Proposed by André Stösel
Status: Merged
Approved by: Cris Dywan
Approved revision: 6411
Merged at revision: 6410
Proposed branch: lp:~ivaldi/midori/endless-user-version
Merge into: lp:midori
Diff against target: 39 lines (+6/-7)
1 file modified
midori/midori-database.vala (+6/-7)
To merge this branch: bzr merge lp:~ivaldi/midori/endless-user-version
Reviewer Review Type Date Requested Status
Cris Dywan Approve
Review via email: mp+186934@code.launchpad.net

Commit message

fix endless loop in Midori.Database.init

To post a comment you must log in.
6411. By André Stösel

begin with Update1.sql instead of Update2.sql

Revision history for this message
Cris Dywan (kalikiana) wrote :

Nice stuff.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'midori/midori-database.vala'
2--- midori/midori-database.vala 2013-09-17 23:39:10 +0000
3+++ midori/midori-database.vala 2013-09-22 13:49:02 +0000
4@@ -51,30 +51,29 @@
5 db.exec ("PRAGMA synchronous = NORMAL; PRAGMA temp_store = MEMORY;");
6 db.exec ("PRAGMA count_changes = OFF;");
7
8- int64 version, user_version;
9+ int64 user_version;
10 Sqlite.Statement stmt;
11 if (db.prepare_v2 ("PRAGMA user_version;", -1, out stmt, null) != Sqlite.OK)
12 throw new DatabaseError.EXECUTE ("Failed to compile statement %s".printf (db.errmsg ()));
13 if (stmt.step () != Sqlite.ROW)
14 throw new DatabaseError.EXECUTE ("Failed to get row %s".printf (db.errmsg ()));
15- version = user_version = stmt.column_int64 (0);
16+ user_version = stmt.column_int64 (0);
17
18- if (version == 0) {
19+ if (user_version == 0) {
20 exec_script ("Create");
21- user_version = version = 1;
22+ user_version = 1;
23 exec ("PRAGMA user_version = " + user_version.to_string ());
24 }
25
26 while (true) {
27- int64 new_version = version + 1;
28 try {
29- exec_script ("Update" + new_version.to_string ());
30+ exec_script ("Update" + user_version.to_string ());
31 } catch (DatabaseError error) {
32 if (error is DatabaseError.FILENAME)
33 break;
34 throw error;
35 }
36- user_version = new_version;
37+ user_version = user_version + 1;
38 exec ("PRAGMA user_version = " + user_version.to_string ());
39 }
40

Subscribers

People subscribed via source and target branches

to all changes: