zwei1121

博客园 首页 新随笔 联系 订阅 管理

else if (type == typeof(decimal))
return (decimal)pk == default(decimal);

public override void PreExecute(IDbCommand cmd)
{
//cmd.GetType().GetProperty("BindByName").SetValue(cmd, true, null);
PropertyInfo bindByNameInfo = cmd.GetType().GetProperty("BindByName");
}

 

public override void PreExecute(IDbCommand cmd)
{
//cmd.GetType().GetProperty("BindByName").SetValue(cmd, true, null);
PropertyInfo bindByNameInfo = cmd.GetType().GetProperty("BindByName");
}

行:4124-4128

http://blog.csdn.net/littlewolf766/article/details/10630141

 

 

//<#@ import namespace="System.Data.OracleClient" #>
//<#@ import namespace="Oracle.ManagedDataAccess.Client" #>

 

//using System.Data.OracleClient;
//using Oracle.ManagedDataAccess.Client;

 

const string COLUMN_SQL=@"select table_name TableName,
column_name ColumnName,
data_type DataType,
data_scale DataScale,
nullable IsNullable
from USER_TAB_COLS utc
where table_name = :tableName
and hidden_column='NO'
order by column_id";
}
//and virtual_column='NO'
//and data_type!='RAW'

 

 //oracle

using (var rdr=cmd.ExecuteReader())
{
while(rdr.Read())
{
Table tbl=new Table();
tbl.Name=rdr["TABLE_NAME"].ToString();
tbl.Schema = rdr["TABLE_SCHEMA"].ToString();
tbl.IsView=string.Compare(rdr["TABLE_TYPE"].ToString(), "View", true)==0;
tbl.CleanName=CleanUp(tbl.Name);
tbl.ClassName=Inflector.MakeSingular(tbl.CleanName);
tbl.SequenceName=tbl.Name+"_SEQUENCE";
result.Add(tbl);
}
}

 

 

public override string GetExistsSql()
{
//return "SELECT EXISTS (SELECT 1 FROM {0} WHERE {1})";
return "SELECT EXISTS (SELECT 1 FROM {0} {1})";
}

 

OracleSchemaReader:

 

col.PropertyType=GetPropertyType(rdr["DataType"].ToString(), (rdr["DATASCALE"] == DBNull.Value ? "" : rdr["DATASCALE"].ToString()));

//col.IsNullable=rdr["IsNullable"].ToString()=="YES";
col.IsNullable=rdr["IsNullable"].ToString()=="Y";

 

using (var rdr=cmd.ExecuteReader())
{
while(rdr.Read())
{
Table tbl=new Table();
tbl.Name=rdr["TABLE_NAME"].ToString();
tbl.Schema = rdr["TABLE_SCHEMA"].ToString();
tbl.IsView=string.Compare(rdr["TABLE_TYPE"].ToString(), "View", true)==0;
tbl.CleanName=CleanUp(tbl.Name);
tbl.ClassName=Inflector.MakeSingular(tbl.CleanName);
//修改
tbl.SequenceName=tbl.Name+"_SEQUENCE";
result.Add(tbl);
}
}

 

public Sql GetMultiLikeSql(List<string> list, string fieldName)
{
if (list != null && fieldName == "")
{
var sqlLikeStatement = "";
int index = 0;
foreach (var item in list)
{
sqlLikeStatement += string.Format("{1} like CONCAT('%',@{0},'%') or ", index, fieldName);
index++;
}
Sql multiLikeSql = Sql.Builder;
multiLikeSql.Append("(" + fieldName.TrimEnd(" or ".ToArray()) + ")", list.ToArray());
return multiLikeSql;
}
else
{
return null;
}

}

posted on 2014-11-07 14:34  zwei  阅读(566)  评论(0编辑  收藏  举报