Commits

Inside Zhou committed eb3a87d

完善InputPlan、QueryPlan;版本号思路转变。

Comments (0)

Files changed (6)

 Inside.Util.Test/bin/.*
 Inside.Util.Test/obj/.*
 syntax: glob
+Inside.Util.Test/Inside.Util.Test.csproj.user

Inside.Util.Test/Inside.Util.Test.csproj

     <Reference Include="Devart.Data.Oracle, Version=7.1.58.0, Culture=neutral, PublicKeyToken=09af7300eec23701, processorArchitecture=MSIL">
       <Private>True</Private>
     </Reference>
-    <Reference Include="itextsharp, Version=5.4.3.0, Culture=neutral, PublicKeyToken=8354ae6d2174ddca, processorArchitecture=MSIL" />
+    <Reference Include="itextsharp">
+      <HintPath>..\Lib\itextsharp.dll</HintPath>
+    </Reference>
     <Reference Include="Microsoft.CSharp" />
     <Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
       <Private>False</Private>
     <Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
       <Private>False</Private>
     </Reference>
-    <Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL" />
-    <Reference Include="NLog, Version=2.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL" />
+    <Reference Include="Newtonsoft.Json">
+      <HintPath>..\Lib\Newtonsoft.Json.dll</HintPath>
+    </Reference>
+    <Reference Include="NLog">
+      <HintPath>..\Lib\NLog.dll</HintPath>
+    </Reference>
     <Reference Include="System" />
     <Reference Include="System.configuration" />
     <Reference Include="System.Core">
     <Reference Include="System.XML" />
     <Reference Include="UIAutomationTypes" />
     <Reference Include="WindowsBase" />
+    <Reference Include="zxing">
+      <HintPath>..\Lib\zxing.dll</HintPath>
+    </Reference>
   </ItemGroup>
   <ItemGroup>
     <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">

Inside.Util.Test/Inside.Util.Test.csproj.user

-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <ProjectView>ProjectFiles</ProjectView>
-  </PropertyGroup>
-</Project>

Inside.Util/Properties/AssemblyInfo.cs

 [assembly: AssemblyTitle("Inside.Util")]
 [assembly: AssemblyDescription("")]
 [assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Inside")]
-[assembly: AssemblyProduct("Inside's Utility")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Inside's Utilities")]
 [assembly: AssemblyCopyright("")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
 // 方法是按如下所示使用“*”:
 // [assembly: AssemblyVersion("1.0.*")]
 
-/* 版本号说明:前两位数字变化不向上一版本兼容,后两位数字变化都兼容上一版本。
- * 一般情况下,第一位数字级别高于第二位,例如运行环境变动。
- * 第二位数字表示,API接口变动这一级别。
- * 第三位数字级别高于第四位,例如全新功能。
- * 第四位数字表示,bugfix,细节优化这一级别。
- * 版本号互不相关,不再重置为0。
+/* 第一位数字表示大规模变化或特性、功能发展到一定程度量变成为质变或项目某个基础的潜规则发生变化,例如运行环境变动、项目组织结构变动等。
+ * 第二位数字表示特性、功能增加,当第一位数字变化时,重置为0。
+ * 第三位数字表示破坏兼容性的修改但不涉及特性、功能的增加,当第二位数字变化时,重置为0。
+ * 第四位数字表示不破坏兼容性的修改,如bugfix,细节优化等,当第三位数字变化时,重置为0。
+ * 除非有特殊声明,否则前三位数字变化表示均不保证向后兼容。
  */
-[assembly: AssemblyVersion("1.11.16.20")]
+[assembly: AssemblyVersion("2.0.0.0")]

Inside.Util/Sql/InputPlan.cs

 
 namespace Inside.Util.Sql {
 	public class InputPlan {
+		public static DatabaseType DatabaseType = DatabaseType.Oracle;
+
 		static Dictionary<string, InputPlan> _cache = new Dictionary<string, InputPlan>();
 
 		/// <summary>
 			}
 		}
 
-		InputPlan(string relationName, SqlHelper sql) {
+		InputPlan(string relationName, SqlHelper sql, DatabaseType databaseType) {
+			if(databaseType != DatabaseType.Oracle) {
+				throw new NotImplementedException();
+			}
+
 			this.RelationName = relationName;
 
 			var dt = sql.Init("select * from {0} where 1 = 2".Fmt(relationName)).GetDataTable();
 		}
 
 		public static InputPlan CreateInstance(string relationName, SqlHelper sql) {
+			return CreateInstance(relationName, sql, DatabaseType);
+		}
+
+		public static InputPlan CreateInstance(string relationName, SqlHelper sql, DatabaseType databaseType) {
 			var key = "{0}|{1}".Fmt(relationName, sql.Conn.ConnectionString);
 
 			if(_cache.ContainsKey(key)) {
 				return _cache[key];
 			}
 			else {
-				var ins = new InputPlan(relationName, sql);
+				var ins = new InputPlan(relationName, sql, databaseType);
 				_cache[key] = ins;
 				return ins;
 			}
 						throw new ArgumentException(string.Format("生成查询参数时出错。\nname : {0}\nvalue : {1}", c.name, value.ToString()));
 					}
 #else
-							p.Value = value;
+					p.Value = value;
 #endif
 					parameters.Add(p);
 				}
 						throw new ArgumentException(string.Format("生成查询参数时出错。\nname : {0}\nvalue : {1}", c.name, value.ToString()));
 					}
 #else
-							p.Value = value;
+					p.Value = value;
 #endif
 					parameters.Add(p);
 				}

Inside.Util/Sql/QueryPlan.cs

 		static Dictionary<string, DyObj> _cache = new Dictionary<string, DyObj>();
 
 		public static QueryPlan CreateInstance(string sql, SqlHelper sh) {
-			return CreateInstance(sql, sh, DefaultQueryPlanType);
+			return CreateInstance(sql, sh, QueryPlanType);
 		}
 
-		public static QueryPlan CreateInstance(string sql, SqlHelper sh, QueryPlanType type) {
+		public static QueryPlan CreateInstance(string sql, SqlHelper sh, DatabaseType type) {
 			var key = "{0}||{1}".Fmt(sql, sh.Conn.ConnectionString);
 
 			if(_cache.ContainsKey(key)) {
 			}
 		}
 
-		QueryPlan(string sql, SqlHelper sh, QueryPlanType type) {
+		QueryPlan(string sql, SqlHelper sh, DatabaseType type) {
+			if(type != DatabaseType.Oracle) {
+				throw new NotImplementedException();
+			}
+
 			this.OriginalText = sql;
 			this.Sql = sh;
 			this._type = type;
 			this._column = column;
 		}
 
-		QueryPlan(DyObj column, string sql, SqlHelper sh, QueryPlanType type) {
+		QueryPlan(DyObj column, string sql, SqlHelper sh, DatabaseType type) {
 			this.OriginalText = sql;
 			this.Sql = sh;
 			this._type = type;
 
 		public static string Rownum = "_rownum_";
 		public static int? CommandTimeout;
-		public static QueryPlanType DefaultQueryPlanType = QueryPlanType.Oracle;
+		public static DatabaseType QueryPlanType = DatabaseType.Oracle;
 
 		#region 需要参与reset的部分。
 		List<Condition> _conditions = new List<Condition>(7);
 		public Func<DyObj, DyObj> RowHandler;
 		#endregion
 
-		QueryPlanType _type;
+		DatabaseType _type;
 
 		/// <example>
 		/// <code>
 			}
 
 			switch(this._type) {
-				case QueryPlanType.MSSQL:
-				case QueryPlanType.PGSQL:
+				case DatabaseType.MSSQL:
+				case DatabaseType.PGSQL:
 					throw new NotImplementedException();
-				case QueryPlanType.Oracle:
+				case DatabaseType.Oracle:
 				default:
 					if(this._offset > 0) {
 						txt.Insert(0, string.Format(@"SELECT * FROM (
 		}
 	}
 
-	public enum QueryPlanType {
+	public enum DatabaseType {
 		Oracle,
 		MSSQL,
 		PGSQL