Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
cyq1162 committed Jul 13, 2016
1 parent 3c7e1ad commit a813c99
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions SQL/SqlCreate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,13 @@ internal string GetInsertSql()
sql = "set identity_insert " + SqlFormat.Keyword(TableName, _action.dalHelper.dalType) + " on " + sql + " set identity_insert " + SqlFormat.Keyword(TableName, _action.dalHelper.dalType) + " off";
}
break;
//if (!(Parent.AllowInsertID && !primaryCell.IsNull)) // 对于自行插入ID的,跳过,主操作会自动返回ID。
//{
// sql += ((groupID == 1 && (primaryCell.IsNull || primaryCell.ToString() == "0")) ? " select cast(scope_Identity() as int) as OutPutValue" : string.Format(" select '{0}' as OutPutValue", primaryCell.Value));
//}
//case DalType.Oracle:
// sql += string.Format("BEGIN;select {0}.currval from dual; END;", AutoID);
// break;
//if (!(Parent.AllowInsertID && !primaryCell.IsNull)) // 对于自行插入ID的,跳过,主操作会自动返回ID。
//{
// sql += ((groupID == 1 && (primaryCell.IsNull || primaryCell.ToString() == "0")) ? " select cast(scope_Identity() as int) as OutPutValue" : string.Format(" select '{0}' as OutPutValue", primaryCell.Value));
//}
//case DalType.Oracle:
// sql += string.Format("BEGIN;select {0}.currval from dual; END;", AutoID);
// break;
}
return sql;
}
Expand Down Expand Up @@ -214,7 +214,7 @@ internal string GetUpdateSql(object whereObj)
{
continue;//跳过自增或主键列。
}

if (cell.cellValue.State > 1 && (cell.Struct.IsCanNull || !cell.IsNull))
{
if (cell.Struct.SqlType == SqlDbType.Timestamp && (_action.DalType == DalType.MsSql || _action.DalType == DalType.Sybase))
Expand Down Expand Up @@ -578,7 +578,7 @@ internal static string FormatWhere(string where, MDataColumn mdc, DalType dalTyp
{
//只处理单个值的情况
int primaryGroupID = DataType.GetGroup(ms.SqlType);//优先匹配主键
// int uniqueGroupID = DataType.GetGroup(mdc.FirstUnique.SqlType);
// int uniqueGroupID = DataType.GetGroup(mdc.FirstUnique.SqlType);
switch (primaryGroupID)
{
case 4:
Expand Down Expand Up @@ -609,7 +609,7 @@ internal static string FormatWhere(string where, MDataColumn mdc, DalType dalTyp
}

string columnName = SqlFormat.Keyword(ms.ColumnName, dalType);
where = GetWhereEqual(DataType.GetGroup(ms.SqlType), columnName, where,dalType);
where = GetWhereEqual(DataType.GetGroup(ms.SqlType), columnName, where, dalType);
}
else
{
Expand All @@ -621,7 +621,7 @@ internal static string FormatWhere(string where, MDataColumn mdc, DalType dalTyp

return where;
}
private static string GetWhereEqual(int groupID, string columnName, string where,DalType dalType)
private static string GetWhereEqual(int groupID, string columnName, string where, DalType dalType)
{
if (groupID != 0)
{
Expand Down Expand Up @@ -649,7 +649,7 @@ private static string GetWhereEqual(int groupID, string columnName, string where
return where;
}



internal static string RemoveOrderBy(string where)
{
Expand Down Expand Up @@ -791,10 +791,10 @@ internal static object SqlToViewSql(object sqlObj)
{
if (sqlObj is String)
{
string sql = Convert.ToString(sqlObj);
if (sql.Contains(" ") && sql.IndexOf('(') == -1)
string sql = Convert.ToString(sqlObj).ToLower().Trim();
if (sql.StartsWith("select ") || (sql.Contains(" ") && sql.IndexOf('(') == -1))
{
sqlObj = "(" + sql + ") v";
sqlObj = "(" + sqlObj + ") v";
}
}
return sqlObj;
Expand Down

0 comments on commit a813c99

Please sign in to comment.