selectstatement.cs

来自「.net的数据持久层」· CS 代码 · 共 39 行

CS
39
字号
using System;
using System.Text;

namespace Platform.Data {

	public class SelectStatement : StatementBase {

		public SelectStatement() : base() { }

		public SelectStatement(object obj) : base( obj ) {
		}

		public override void BuildSqlClause() {
			this.FieldString = this.BuildFieldString();
			this.WhereString = this.BuildWhereString();

			this.SqlClause = String.Format("SELECT {0} FROM {1} WHERE {2}",
				this.FieldString, this.TableName, this.WhereString );
		}
		
		public override void FillDataParameter(object obj) {
			foreach(FieldProp fp in this.Fields){
				if( fp.IsKeyField ){
					DataParameter dp = this.Parameters[ fp.FieldName ];
					if( fp.Size != 0 ){
						dp.Size = fp.Size;
					}
					dp.Value = fp.GetValue( obj );
				}
			}
		}

		public override StatementBase Create() {
			return new SelectStatement();
		}

	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?