From d93e6216090c6a7bdd19bc835ced374ef20cbead Mon Sep 17 00:00:00 2001 From: Joe Wasson Date: Wed, 20 Apr 2011 09:02:04 -0700 Subject: [PATCH] Fix a bug in the "where" code --- Massive.cs | 5 ++--- README.markdown | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Massive.cs b/Massive.cs index acca8f3..f95a0a4 100644 --- a/Massive.cs +++ b/Massive.cs @@ -208,9 +208,8 @@ public class DynamicModel { if(where == null) return command; var whereString = where as string; if (whereString != null) { - var whereRegex = new Regex(@"^where ", RegexOptions.IgnoreCase); - var keyword = whereRegex.IsMatch(sql.Trim()) ? " AND " : " WHERE "; - command.CommandText += keyword + whereString.Replace(whereString.Trim(), String.Empty); + var keyword = Regex.IsMatch(sql, " WHERE ", RegexOptions.IgnoreCase) ? " AND " : " WHERE "; + command.CommandText += keyword + Regex.Replace(whereString.Trim(), @"^where ", String.Empty, RegexOptions.IgnoreCase); command.AddParams(args); } else { var dict = where.ToDictionary(); diff --git a/README.markdown b/README.markdown index 2a522ca..318053b 100644 --- a/README.markdown +++ b/README.markdown @@ -3,7 +3,7 @@ Massive is a Single File Database Lover. Move over Bacon - Taste is got a new fr I'm sharing this with the world because we need another way to access data - don't you think? Truthfully - I wanted to see if I could flex the C# 4 stuff and -run up data access with a single file. This is ready to roll and weighs in at a lovely 266 lines of code. Some of which is comments. +run up data access with a single file. This is ready to roll and weighs in at a lovely 265 lines of code. Some of which is comments. How To Install It? ------------------