From: "Andreas Proschofsky (suka)" <suka@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] gentoo-x86 commit in app-misc/tasque/files: tasque-0.1.9-cachetasks.patch tasque-0.1.8-debug-fixup.patch
Date: Tue, 29 May 2012 18:50:55 +0000 (UTC) [thread overview]
Message-ID: <20120529185055.CC4152004C@flycatcher.gentoo.org> (raw)
suka 12/05/29 18:50:55
Added: tasque-0.1.9-cachetasks.patch
Removed: tasque-0.1.8-debug-fixup.patch
Log:
Remove evolution-data-server support as it is broken, add a litte performance improvement
(Portage version: 2.2.0_alpha108/cvs/Linux x86_64)
Revision Changes Path
1.1 app-misc/tasque/files/tasque-0.1.9-cachetasks.patch
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-misc/tasque/files/tasque-0.1.9-cachetasks.patch?rev=1.1&view=markup
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
Index: tasque-0.1.9-cachetasks.patch
===================================================================
diff --git a/src/Backends/Sqlite/SqliteBackend.cs b/src/Backends/Sqlite/SqliteBackend.cs
index 4e7ec7a..417f6b2 100644
--- a/src/Backends/Sqlite/SqliteBackend.cs
+++ b/src/Backends/Sqlite/SqliteBackend.cs
@@ -243,10 +243,10 @@ namespace Tasque.Backends.Sqlite
bool hasValues = false;
string command = "SELECT id FROM Categories";
- SqliteCommand cmd = db.Connection.CreateCommand();
- cmd.CommandText = command;
- SqliteDataReader dataReader = cmd.ExecuteReader();
- while(dataReader.Read()) {
+ SqliteCommand cmd = db.Connection.CreateCommand();
+ cmd.CommandText = command;
+ SqliteDataReader dataReader = cmd.ExecuteReader();
+ while(dataReader.Read()) {
int id = dataReader.GetInt32(0);
hasValues = true;
@@ -255,10 +255,10 @@ namespace Tasque.Backends.Sqlite
defaultCategory = newCategory;
iter = categoryListStore.Append ();
categoryListStore.SetValue (iter, 0, newCategory);
- }
-
- dataReader.Close();
- cmd.Dispose();
+ }
+
+ dataReader.Close();
+ cmd.Dispose();
if(!hasValues)
{
@@ -286,23 +286,32 @@ namespace Tasque.Backends.Sqlite
Gtk.TreeIter iter;
SqliteTask newTask;
bool hasValues = false;
-
- string command = "SELECT id FROM Tasks";
- SqliteCommand cmd = db.Connection.CreateCommand();
- cmd.CommandText = command;
- SqliteDataReader dataReader = cmd.ExecuteReader();
- while(dataReader.Read()) {
- int id = dataReader.GetInt32(0);
+
+ string command = "SELECT id,Category,Name,DueDate,CompletionDate,Priority, State FROM Tasks";
+ SqliteCommand cmd = db.Connection.CreateCommand();
+ cmd.CommandText = command;
+ SqliteDataReader dataReader = cmd.ExecuteReader();
+ while(dataReader.Read()) {
+ int id = dataReader.GetInt32(0);
+ int category = dataReader.GetInt32(1);
+ string name = dataReader.GetString(2);
+ int dueDate = dataReader.GetInt32(3);
+ int completionDate = dataReader.GetInt32(4);
+ int priority = dataReader.GetInt32(5);
+ int state = dataReader.GetInt32(6);
+
hasValues = true;
-
- newTask = new SqliteTask(this, id);
+
+ newTask = new SqliteTask(this, id, category,
+ name, dueDate, completionDate,
+ priority, state);
iter = taskStore.AppendNode();
taskStore.SetValue (iter, 0, newTask);
taskIters [newTask.SqliteId] = iter;
- }
+ }
- dataReader.Close();
- cmd.Dispose();
+ dataReader.Close();
+ cmd.Dispose();
if(!hasValues)
{
diff --git a/src/Backends/Sqlite/SqliteTask.cs b/src/Backends/Sqlite/SqliteTask.cs
index a9f5d42..9ede1b1 100644
--- a/src/Backends/Sqlite/SqliteTask.cs
+++ b/src/Backends/Sqlite/SqliteTask.cs
@@ -12,22 +12,41 @@ namespace Tasque.Backends.Sqlite
{
private SqliteBackend backend;
private int id;
+ private int category;
+ private string name;
+ private long dueDate;
+ private long completionDate;
+ private int priority;
+ private int state;
public SqliteTask(SqliteBackend backend, string name)
{
this.backend = backend;
Logger.Debug("Creating New Task Object : {0} (id={1})", name, id);
name = backend.SanitizeText (name);
+ this.name = name;
+ this.dueDate = Database.FromDateTime(DateTime.MinValue);
+ this.completionDate = Database.FromDateTime(DateTime.MinValue);
+ this.category = 0;
+ this.priority = (int)(TaskPriority.None);
+ this.state = (int)TaskState.Active;
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();",
- name, Database.FromDateTime(DateTime.MinValue), Database.FromDateTime(DateTime.MinValue),
- ((int)(TaskPriority.None)), ((int)TaskState.Active), 0, string.Empty );
+ name, dueDate, completionDate,
+ priority, state, category, string.Empty);
this.id = Convert.ToInt32 (backend.Database.ExecuteScalar (command));
}
-
- public SqliteTask (SqliteBackend backend, int id)
+
+ public SqliteTask (SqliteBackend backend, int id, int category, string name,
+ long dueDate, long completionDate, int priority, int state)
{
this.backend = backend;
this.id = id;
+ this.category = category;
+ this.name = name;
+ this.dueDate = dueDate;
+ this.completionDate = completionDate;
+ this.priority = priority;
+ this.state = state;
}
#region Public Properties
@@ -44,12 +63,10 @@ namespace Tasque.Backends.Sqlite
public override string Name
{
- get {
- string command = String.Format("SELECT Name FROM Tasks where ID='{0}'", id);
- return backend.Database.GetSingleString(command);
- }
+ get { return this.name; }
set {
string name = backend.SanitizeText (value);
+ this.name = name;
string command = String.Format("UPDATE Tasks set Name='{0}' where ID='{1}'", name, id);
backend.Database.ExecuteScalar(command);
backend.UpdateTask(this);
@@ -58,12 +75,10 @@ namespace Tasque.Backends.Sqlite
public override DateTime DueDate
{
- get {
- string command = String.Format("SELECT DueDate FROM Tasks where ID='{0}'", id);
- return backend.Database.GetDateTime(command);
- }
+ get { return Database.ToDateTime(this.dueDate); }
set {
- string command = String.Format("UPDATE Tasks set DueDate='{0}' where ID='{1}'", Database.FromDateTime(value), id);
+ this.dueDate = Database.FromDateTime(value);
+ string command = String.Format("UPDATE Tasks set DueDate='{0}' where ID='{1}'", this.dueDate, id);
backend.Database.ExecuteScalar(command);
backend.UpdateTask(this);
}
@@ -72,14 +87,12 @@ namespace Tasque.Backends.Sqlite
public override DateTime CompletionDate
{
- get {
- string command = String.Format("SELECT CompletionDate FROM Tasks where ID='{0}'", id);
- return backend.Database.GetDateTime(command);
- }
+ get { return Database.ToDateTime(this.completionDate); }
set {
- string command = String.Format("UPDATE Tasks set CompletionDate='{0}' where ID='{1}'", Database.FromDateTime(value), id);
+ this.completionDate = Database.FromDateTime(value);
+ string command = String.Format("UPDATE Tasks set CompletionDate='{0}' where ID='{1}'", this.completionDate, id);
backend.Database.ExecuteScalar(command);
- backend.UpdateTask(this);
+ backend.UpdateTask(this);
}
}
@@ -96,14 +109,12 @@ namespace Tasque.Backends.Sqlite
public override TaskPriority Priority
{
- get {
- string command = String.Format("SELECT Priority FROM Tasks where ID='{0}'", id);
- return (TaskPriority)backend.Database.GetSingleInt(command);
- }
+ get { return (TaskPriority) this.priority; }
set {
- string command = String.Format("UPDATE Tasks set Priority='{0}' where ID='{1}'", ((int)value), id);
+ this.priority = (int) value;
+ string command = String.Format("UPDATE Tasks set Priority='{0}' where ID='{1}'", this.priority, id);
backend.Database.ExecuteScalar(command);
- backend.UpdateTask(this);
+ backend.UpdateTask(this);
}
}
@@ -127,27 +138,21 @@ namespace Tasque.Backends.Sqlite
public TaskState LocalState
{
- get {
- string command = String.Format("SELECT State FROM Tasks where ID='{0}'", id);
- return (TaskState)backend.Database.GetSingleInt(command);
- }
+ get { return (TaskState) this.state; }
set {
- string command = String.Format("UPDATE Tasks set State='{0}' where ID='{1}'", ((int)value), id);
+ this.state = (int) value;
+ string command = String.Format("UPDATE Tasks set State='{0}' where ID='{1}'", this.state, id);
backend.Database.ExecuteScalar(command);
- backend.UpdateTask(this);
+ backend.UpdateTask(this);
}
}
public override ICategory Category
{
- get {
- string command = String.Format("SELECT Category FROM Tasks where ID='{0}'", id);
- int catID = backend.Database.GetSingleInt(command);
- SqliteCategory sqCat = new SqliteCategory(backend, catID);
- return sqCat;
- }
+ get { return new SqliteCategory(backend, this.category); }
set {
- string command = String.Format("UPDATE Tasks set Category='{0}' where ID='{1}'", ((int)(value as SqliteCategory).ID), id);
+ this.category = (int)(value as SqliteCategory).ID;
+ string command = String.Format("UPDATE Tasks set Category='{0}' where ID='{1}'", category, id);
backend.Database.ExecuteScalar(command);
backend.UpdateTask(this);
}
@@ -166,7 +171,7 @@ namespace Tasque.Backends.Sqlite
int taskId = dataReader.GetInt32(0);
string text = dataReader.GetString(1);
notes.Add (new SqliteNote (taskId, text));
- }
+ }
return notes;
}
--
cgit v0.9.0.2
reply other threads:[~2012-05-29 18:51 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120529185055.CC4152004C@flycatcher.gentoo.org \
--to=suka@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox