[smuxi] Engine: implemented SqliteMessageBuffer.GetEnumerator()
- From: Mirco M. M. Bauer <mmmbauer src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [smuxi] Engine: implemented SqliteMessageBuffer.GetEnumerator()
- Date: Fri, 28 Feb 2014 20:26:01 +0000 (UTC)
commit 6c43b1a75ac966951062086ce0e89fbb5d430d66
Author: Mirco Bauer <meebey meebey net>
Date: Wed Feb 26 23:05:31 2014 +0100
Engine: implemented SqliteMessageBuffer.GetEnumerator()
src/Engine/MessageBuffers/SqliteMessageBuffer.cs | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/src/Engine/MessageBuffers/SqliteMessageBuffer.cs
b/src/Engine/MessageBuffers/SqliteMessageBuffer.cs
index ddc2a62..78975bd 100644
--- a/src/Engine/MessageBuffers/SqliteMessageBuffer.cs
+++ b/src/Engine/MessageBuffers/SqliteMessageBuffer.cs
@@ -150,7 +150,16 @@ namespace Smuxi.Engine
public override IEnumerator<MessageModel> GetEnumerator()
{
- throw new NotImplementedException ();
+ using (var cmd = Connection.CreateCommand()) {
+ cmd.CommandText = "SELECT JSON FROM Messages";
+
+ var reader = cmd.ExecuteReader();
+ while (reader.Read()) {
+ var json = (string) reader["JSON"];
+ var dto = JsonSerializer.DeserializeFromString<MessageDtoModelV1>(json);
+ yield return dto.ToMessage();
+ }
+ }
}
public override int IndexOf(MessageModel item)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]