Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJérémie Laval <jeremie.laval@gmail.com>2011-01-21 18:23:11 +0300
committerJérémie Laval <jeremie.laval@gmail.com>2011-01-22 04:21:16 +0300
commitb4b7fbbd379b6a32d12f1d71c804caeae3078618 (patch)
tree91f8c0ff1acfdfcf5f0d568546cde0b73d161e18 /mcs/class/WebMatrix.Data
parentbf0339ea2bda1bc16245908c81fdd70d0e6f862b (diff)
Fix up compilation of Database and DynamicRecord
Diffstat (limited to 'mcs/class/WebMatrix.Data')
-rw-r--r--mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs13
-rw-r--r--mcs/class/WebMatrix.Data/WebMatrix.Data/DynamicRecord.cs6
2 files changed, 11 insertions, 8 deletions
diff --git a/mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs b/mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs
index 6c9287ce302..c5d52066006 100644
--- a/mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs
+++ b/mcs/class/WebMatrix.Data/WebMatrix.Data/Database.cs
@@ -28,6 +28,7 @@
#if NET_4_0
using System;
+using System.Linq;
using System.Dynamic;
using System.Data.Common;
using System.Configuration;
@@ -92,9 +93,11 @@ namespace WebMatrix.Data
return result;
}
- public dynamic Query (string commandText, params object[] args)
+ public IEnumerable<dynamic> Query (string commandText, params object[] args)
{
-
+ var result = QueryInternal (commandText, args, false);
+
+ return result != null ? result.Select (r => new DynamicRecord (r)) : null;
}
public dynamic QuerySingle (string commandText, params object[] args)
@@ -104,7 +107,7 @@ namespace WebMatrix.Data
return result != null ? new DynamicRecord (result[0]) : null;
}
- List<Dictionary<string, object>> QueryInternal (string commandText, params object[] args, bool unique)
+ List<Dictionary<string, object>> QueryInternal (string commandText, object[] args, bool unique)
{
var command = PrepareCommand (commandText);
PrepareCommandParameters (command, args);
@@ -113,7 +116,7 @@ namespace WebMatrix.Data
connection.Open ();
- using (var reader = var.ExecuteReader ()) {
+ using (var reader = command.ExecuteReader ()) {
if (!reader.Read () || !reader.HasRows)
return null;
@@ -136,7 +139,7 @@ namespace WebMatrix.Data
connection.Close ();
command.Dispose ();
- return result;
+ return rows;
}
public object QueryValue (string commandText, params object[] args)
diff --git a/mcs/class/WebMatrix.Data/WebMatrix.Data/DynamicRecord.cs b/mcs/class/WebMatrix.Data/WebMatrix.Data/DynamicRecord.cs
index 3a616378af1..417c3e43635 100644
--- a/mcs/class/WebMatrix.Data/WebMatrix.Data/DynamicRecord.cs
+++ b/mcs/class/WebMatrix.Data/WebMatrix.Data/DynamicRecord.cs
@@ -42,7 +42,7 @@ namespace WebMatrix.Data
internal DynamicRecord (Dictionary<string, object> fields)
{
this.fields = fields;
- Columns = fields.Keys;
+ Columns = new List<string> (fields.Keys).AsReadOnly ();
}
public IList<string> Columns {
@@ -58,13 +58,13 @@ namespace WebMatrix.Data
public object this[int index] {
get {
- return fields.Keys[index];
+ return fields[Columns[index]];
}
}
public override IEnumerable<string> GetDynamicMemberNames ()
{
- return Columns;
+ return fields.Keys;
}
public override bool TryGetMember (GetMemberBinder binder, out object result)