1 |
suka 12/05/29 18:50:55 |
2 |
|
3 |
Added: tasque-0.1.9-cachetasks.patch |
4 |
Removed: tasque-0.1.8-debug-fixup.patch |
5 |
Log: |
6 |
Remove evolution-data-server support as it is broken, add a litte performance improvement |
7 |
|
8 |
(Portage version: 2.2.0_alpha108/cvs/Linux x86_64) |
9 |
|
10 |
Revision Changes Path |
11 |
1.1 app-misc/tasque/files/tasque-0.1.9-cachetasks.patch |
12 |
|
13 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-misc/tasque/files/tasque-0.1.9-cachetasks.patch?rev=1.1&view=markup |
14 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-misc/tasque/files/tasque-0.1.9-cachetasks.patch?rev=1.1&content-type=text/plain |
15 |
|
16 |
Index: tasque-0.1.9-cachetasks.patch |
17 |
=================================================================== |
18 |
diff --git a/src/Backends/Sqlite/SqliteBackend.cs b/src/Backends/Sqlite/SqliteBackend.cs |
19 |
index 4e7ec7a..417f6b2 100644 |
20 |
--- a/src/Backends/Sqlite/SqliteBackend.cs |
21 |
+++ b/src/Backends/Sqlite/SqliteBackend.cs |
22 |
@@ -243,10 +243,10 @@ namespace Tasque.Backends.Sqlite |
23 |
bool hasValues = false; |
24 |
|
25 |
string command = "SELECT id FROM Categories"; |
26 |
- SqliteCommand cmd = db.Connection.CreateCommand(); |
27 |
- cmd.CommandText = command; |
28 |
- SqliteDataReader dataReader = cmd.ExecuteReader(); |
29 |
- while(dataReader.Read()) { |
30 |
+ SqliteCommand cmd = db.Connection.CreateCommand(); |
31 |
+ cmd.CommandText = command; |
32 |
+ SqliteDataReader dataReader = cmd.ExecuteReader(); |
33 |
+ while(dataReader.Read()) { |
34 |
int id = dataReader.GetInt32(0); |
35 |
hasValues = true; |
36 |
|
37 |
@@ -255,10 +255,10 @@ namespace Tasque.Backends.Sqlite |
38 |
defaultCategory = newCategory; |
39 |
iter = categoryListStore.Append (); |
40 |
categoryListStore.SetValue (iter, 0, newCategory); |
41 |
- } |
42 |
- |
43 |
- dataReader.Close(); |
44 |
- cmd.Dispose(); |
45 |
+ } |
46 |
+ |
47 |
+ dataReader.Close(); |
48 |
+ cmd.Dispose(); |
49 |
|
50 |
if(!hasValues) |
51 |
{ |
52 |
@@ -286,23 +286,32 @@ namespace Tasque.Backends.Sqlite |
53 |
Gtk.TreeIter iter; |
54 |
SqliteTask newTask; |
55 |
bool hasValues = false; |
56 |
- |
57 |
- string command = "SELECT id FROM Tasks"; |
58 |
- SqliteCommand cmd = db.Connection.CreateCommand(); |
59 |
- cmd.CommandText = command; |
60 |
- SqliteDataReader dataReader = cmd.ExecuteReader(); |
61 |
- while(dataReader.Read()) { |
62 |
- int id = dataReader.GetInt32(0); |
63 |
+ |
64 |
+ string command = "SELECT id,Category,Name,DueDate,CompletionDate,Priority, State FROM Tasks"; |
65 |
+ SqliteCommand cmd = db.Connection.CreateCommand(); |
66 |
+ cmd.CommandText = command; |
67 |
+ SqliteDataReader dataReader = cmd.ExecuteReader(); |
68 |
+ while(dataReader.Read()) { |
69 |
+ int id = dataReader.GetInt32(0); |
70 |
+ int category = dataReader.GetInt32(1); |
71 |
+ string name = dataReader.GetString(2); |
72 |
+ int dueDate = dataReader.GetInt32(3); |
73 |
+ int completionDate = dataReader.GetInt32(4); |
74 |
+ int priority = dataReader.GetInt32(5); |
75 |
+ int state = dataReader.GetInt32(6); |
76 |
+ |
77 |
hasValues = true; |
78 |
- |
79 |
- newTask = new SqliteTask(this, id); |
80 |
+ |
81 |
+ newTask = new SqliteTask(this, id, category, |
82 |
+ name, dueDate, completionDate, |
83 |
+ priority, state); |
84 |
iter = taskStore.AppendNode(); |
85 |
taskStore.SetValue (iter, 0, newTask); |
86 |
taskIters [newTask.SqliteId] = iter; |
87 |
- } |
88 |
+ } |
89 |
|
90 |
- dataReader.Close(); |
91 |
- cmd.Dispose(); |
92 |
+ dataReader.Close(); |
93 |
+ cmd.Dispose(); |
94 |
|
95 |
if(!hasValues) |
96 |
{ |
97 |
diff --git a/src/Backends/Sqlite/SqliteTask.cs b/src/Backends/Sqlite/SqliteTask.cs |
98 |
index a9f5d42..9ede1b1 100644 |
99 |
--- a/src/Backends/Sqlite/SqliteTask.cs |
100 |
+++ b/src/Backends/Sqlite/SqliteTask.cs |
101 |
@@ -12,22 +12,41 @@ namespace Tasque.Backends.Sqlite |
102 |
{ |
103 |
private SqliteBackend backend; |
104 |
private int id; |
105 |
+ private int category; |
106 |
+ private string name; |
107 |
+ private long dueDate; |
108 |
+ private long completionDate; |
109 |
+ private int priority; |
110 |
+ private int state; |
111 |
|
112 |
public SqliteTask(SqliteBackend backend, string name) |
113 |
{ |
114 |
this.backend = backend; |
115 |
Logger.Debug("Creating New Task Object : {0} (id={1})", name, id); |
116 |
name = backend.SanitizeText (name); |
117 |
+ this.name = name; |
118 |
+ this.dueDate = Database.FromDateTime(DateTime.MinValue); |
119 |
+ this.completionDate = Database.FromDateTime(DateTime.MinValue); |
120 |
+ this.category = 0; |
121 |
+ this.priority = (int)(TaskPriority.None); |
122 |
+ this.state = (int)TaskState.Active; |
123 |
string command = String.Format("INSERT INTO Tasks (Name, DueDate, CompletionDate, Priority, State, Category, ExternalID) values ('{0}','{1}', '{2}','{3}', '{4}', '{5}', '{6}'); SELECT last_insert_rowid();", |
124 |
- name, Database.FromDateTime(DateTime.MinValue), Database.FromDateTime(DateTime.MinValue), |
125 |
- ((int)(TaskPriority.None)), ((int)TaskState.Active), 0, string.Empty ); |
126 |
+ name, dueDate, completionDate, |
127 |
+ priority, state, category, string.Empty); |
128 |
this.id = Convert.ToInt32 (backend.Database.ExecuteScalar (command)); |
129 |
} |
130 |
- |
131 |
- public SqliteTask (SqliteBackend backend, int id) |
132 |
+ |
133 |
+ public SqliteTask (SqliteBackend backend, int id, int category, string name, |
134 |
+ long dueDate, long completionDate, int priority, int state) |
135 |
{ |
136 |
this.backend = backend; |
137 |
this.id = id; |
138 |
+ this.category = category; |
139 |
+ this.name = name; |
140 |
+ this.dueDate = dueDate; |
141 |
+ this.completionDate = completionDate; |
142 |
+ this.priority = priority; |
143 |
+ this.state = state; |
144 |
} |
145 |
|
146 |
#region Public Properties |
147 |
@@ -44,12 +63,10 @@ namespace Tasque.Backends.Sqlite |
148 |
|
149 |
public override string Name |
150 |
{ |
151 |
- get { |
152 |
- string command = String.Format("SELECT Name FROM Tasks where ID='{0}'", id); |
153 |
- return backend.Database.GetSingleString(command); |
154 |
- } |
155 |
+ get { return this.name; } |
156 |
set { |
157 |
string name = backend.SanitizeText (value); |
158 |
+ this.name = name; |
159 |
string command = String.Format("UPDATE Tasks set Name='{0}' where ID='{1}'", name, id); |
160 |
backend.Database.ExecuteScalar(command); |
161 |
backend.UpdateTask(this); |
162 |
@@ -58,12 +75,10 @@ namespace Tasque.Backends.Sqlite |
163 |
|
164 |
public override DateTime DueDate |
165 |
{ |
166 |
- get { |
167 |
- string command = String.Format("SELECT DueDate FROM Tasks where ID='{0}'", id); |
168 |
- return backend.Database.GetDateTime(command); |
169 |
- } |
170 |
+ get { return Database.ToDateTime(this.dueDate); } |
171 |
set { |
172 |
- string command = String.Format("UPDATE Tasks set DueDate='{0}' where ID='{1}'", Database.FromDateTime(value), id); |
173 |
+ this.dueDate = Database.FromDateTime(value); |
174 |
+ string command = String.Format("UPDATE Tasks set DueDate='{0}' where ID='{1}'", this.dueDate, id); |
175 |
backend.Database.ExecuteScalar(command); |
176 |
backend.UpdateTask(this); |
177 |
} |
178 |
@@ -72,14 +87,12 @@ namespace Tasque.Backends.Sqlite |
179 |
|
180 |
public override DateTime CompletionDate |
181 |
{ |
182 |
- get { |
183 |
- string command = String.Format("SELECT CompletionDate FROM Tasks where ID='{0}'", id); |
184 |
- return backend.Database.GetDateTime(command); |
185 |
- } |
186 |
+ get { return Database.ToDateTime(this.completionDate); } |
187 |
set { |
188 |
- string command = String.Format("UPDATE Tasks set CompletionDate='{0}' where ID='{1}'", Database.FromDateTime(value), id); |
189 |
+ this.completionDate = Database.FromDateTime(value); |
190 |
+ string command = String.Format("UPDATE Tasks set CompletionDate='{0}' where ID='{1}'", this.completionDate, id); |
191 |
backend.Database.ExecuteScalar(command); |
192 |
- backend.UpdateTask(this); |
193 |
+ backend.UpdateTask(this); |
194 |
} |
195 |
} |
196 |
|
197 |
@@ -96,14 +109,12 @@ namespace Tasque.Backends.Sqlite |
198 |
|
199 |
public override TaskPriority Priority |
200 |
{ |
201 |
- get { |
202 |
- string command = String.Format("SELECT Priority FROM Tasks where ID='{0}'", id); |
203 |
- return (TaskPriority)backend.Database.GetSingleInt(command); |
204 |
- } |
205 |
+ get { return (TaskPriority) this.priority; } |
206 |
set { |
207 |
- string command = String.Format("UPDATE Tasks set Priority='{0}' where ID='{1}'", ((int)value), id); |
208 |
+ this.priority = (int) value; |
209 |
+ string command = String.Format("UPDATE Tasks set Priority='{0}' where ID='{1}'", this.priority, id); |
210 |
backend.Database.ExecuteScalar(command); |
211 |
- backend.UpdateTask(this); |
212 |
+ backend.UpdateTask(this); |
213 |
} |
214 |
} |
215 |
|
216 |
@@ -127,27 +138,21 @@ namespace Tasque.Backends.Sqlite |
217 |
|
218 |
public TaskState LocalState |
219 |
{ |
220 |
- get { |
221 |
- string command = String.Format("SELECT State FROM Tasks where ID='{0}'", id); |
222 |
- return (TaskState)backend.Database.GetSingleInt(command); |
223 |
- } |
224 |
+ get { return (TaskState) this.state; } |
225 |
set { |
226 |
- string command = String.Format("UPDATE Tasks set State='{0}' where ID='{1}'", ((int)value), id); |
227 |
+ this.state = (int) value; |
228 |
+ string command = String.Format("UPDATE Tasks set State='{0}' where ID='{1}'", this.state, id); |
229 |
backend.Database.ExecuteScalar(command); |
230 |
- backend.UpdateTask(this); |
231 |
+ backend.UpdateTask(this); |
232 |
} |
233 |
} |
234 |
|
235 |
public override ICategory Category |
236 |
{ |
237 |
- get { |
238 |
- string command = String.Format("SELECT Category FROM Tasks where ID='{0}'", id); |
239 |
- int catID = backend.Database.GetSingleInt(command); |
240 |
- SqliteCategory sqCat = new SqliteCategory(backend, catID); |
241 |
- return sqCat; |
242 |
- } |
243 |
+ get { return new SqliteCategory(backend, this.category); } |
244 |
set { |
245 |
- string command = String.Format("UPDATE Tasks set Category='{0}' where ID='{1}'", ((int)(value as SqliteCategory).ID), id); |
246 |
+ this.category = (int)(value as SqliteCategory).ID; |
247 |
+ string command = String.Format("UPDATE Tasks set Category='{0}' where ID='{1}'", category, id); |
248 |
backend.Database.ExecuteScalar(command); |
249 |
backend.UpdateTask(this); |
250 |
} |
251 |
@@ -166,7 +171,7 @@ namespace Tasque.Backends.Sqlite |
252 |
int taskId = dataReader.GetInt32(0); |
253 |
string text = dataReader.GetString(1); |
254 |
notes.Add (new SqliteNote (taskId, text)); |
255 |
- } |
256 |
+ } |
257 |
|
258 |
return notes; |
259 |
} |
260 |
-- |
261 |
cgit v0.9.0.2 |