Commits

Inside Zhou committed 2dc6ded

生成QueryPlan、InputPlan时,首先查找缓存,避免无谓的sql查询。

Comments (0)

Files changed (3)

Inside.Util/Properties/AssemblyInfo.cs

  * 第四位数字表示,bugfix,细节优化这一级别。
  * 版本号互不相关,不再重置为0。
  */
-[assembly: AssemblyVersion("1.7.15.16")]
+[assembly: AssemblyVersion("1.8.15.16")]

Inside.Util/Sql/InputPlan.cs

 			}
 		}
 
-		public InputPlan(string relationName, SqlHelper sql) {
+		InputPlan(string relationName, SqlHelper sql) {
 			this.RelationName = relationName;
 
 			var dt = sql.Init("select * from {0} where 1 = 2".Fmt(relationName)).GetDataTable();

Inside.Util/Sql/QueryPlan.cs

 			}
 		}
 
+		QueryPlan(string sql, SqlHelper sh, QueryPlanType type) {
+			this.OriginalText = sql;
+			this.Sql = sh;
+			this._type = type;
+
+			var dt = sh.Init(@"
+SELECT * FROM ({0}) where 3 = 4
+".Fmt(sql)).GetDataTable();
+
+			var column = new DyObj();
+			foreach(DataColumn col in dt.Columns) {
+				var c = new DyObj();
+				var attrName = col.ColumnName.ToLower();
+				c["_guid"] = Guid.NewGuid().ToString();
+				c["attr_name"] = attrName;
+				column[attrName] = c;
+			}
+			this.Column = column;
+		}
+
+		QueryPlan(DyObj column, string sql, SqlHelper sh, QueryPlanType type) {
+			this.OriginalText = sql;
+			this.Sql = sh;
+			this._type = type;
+			this.Column = column;
+		}
+
 		public const string Rownum = "_rownum_";
 		public static int? CommandTimeout;
 		public static QueryPlanType DefaultQueryPlanType = QueryPlanType.Oracle;
 
 		public SqlHelper Sql { get; private set; }
 
-		public QueryPlan(string sql, SqlHelper sh) : this(sql, sh, DefaultQueryPlanType) { }
-
-		public QueryPlan(string sql, SqlHelper sh, QueryPlanType type) {
-			this.OriginalText = sql;
-			this.Sql = sh;
-			this._type = type;
-
-			var dt = sh.Init(@"
-SELECT * FROM ({0}) where 3 = 4
-".Fmt(sql)).GetDataTable();
-
-			var column = new DyObj();
-			foreach(DataColumn col in dt.Columns) {
-				var c = new DyObj();
-				var attrName = col.ColumnName.ToLower();
-				c["_guid"] = Guid.NewGuid().ToString();
-				c["attr_name"] = attrName;
-				column[attrName] = c;
-			}
-			this.Column = column;
-		}
-
-		public QueryPlan(DyObj column, string sql, SqlHelper sh) : this(column, sql, sh, DefaultQueryPlanType) { }
-
-		public QueryPlan(DyObj column, string sql, SqlHelper sh, QueryPlanType type) {
-			this.OriginalText = sql;
-			this.Sql = sh;
-			this._type = type;
-			this.Column = column;
-		}
-
 		public DataTable GetDataTable(int timeout = 15) {
 			dynamic sql = this._GenerateSQLObject();
 			var comm = this.Sql.Init(sql.txt as string, null == CommandTimeout ? timeout : (int)CommandTimeout);