internal override string CreateSqlString (CommandFactory factory, bool isFullName, CreateSqlState state) { string sql = state.GetDataSql (this, isFullName); if (sql != null) { return sql; } string query = _query.CreateSqlString (factory, isFullName, state); object ifTrue; object ifFalse; DataFieldInfo ifTrueInfo = _ifTrue as DataFieldInfo; DataFieldInfo ifFalseInfo = _ifFalse as DataFieldInfo; if (!Object.Equals (ifTrueInfo, null) && !Object.Equals (ifFalseInfo, null)) { ifTrue = ifTrueInfo.CreateSqlString (factory, isFullName, state); ifFalse = ifFalseInfo.CreateSqlString (factory, isFullName, state); } else if (!Object.Equals (ifTrueInfo, null)) { ifTrue = ifTrueInfo.CreateSqlString (factory, isFullName, state); object ifFalseObject = LambdaExpressionExtend.ConvertLambdaObject (_ifFalse); ifFalse = state.AddDataParameter (factory, ifFalseObject); } else if (!Object.Equals (ifFalseInfo, null)) { ifFalse = ifFalseInfo.CreateSqlString (factory, isFullName, state); object ifTrueObject = LambdaExpressionExtend.ConvertLambdaObject (_ifTrue); ifTrue = state.AddDataParameter (factory, ifTrueObject); } else { object ifTrueObject = LambdaExpressionExtend.ConvertLambdaObject (_ifTrue); object ifFalseObject = LambdaExpressionExtend.ConvertLambdaObject (_ifFalse); ifTrue = state.AddDataParameter (factory, ifTrueObject); ifFalse = state.AddDataParameter (factory, ifFalseObject); } sql = factory.CreateConditionSql (query, ifTrue, ifFalse); state.SetDataSql (this, isFullName, sql); return sql; }
internal override string CreateSqlString(CommandFactory factory, out DataParameter[] dataParameters) { DataParameter[] dp1 = null; string expressionString1 = _expression1.CreateSqlString(factory, out dp1); DataParameter[] dp2 = null; string expressionString2 = _expression2.CreateSqlString(factory, out dp2); //dataParameters = new DataParameter[dp1.Length + dp2.Length]; //dp1.CopyTo(dataParameters, 0); //dp2.CopyTo(dataParameters, dp1.Length); if (dp1 == null && dp2 == null) { dataParameters = null; } else { List <DataParameter> list = new List <DataParameter> (); list.AddRange(dp1); list.AddRange(dp2); dataParameters = list.ToArray(); } return(factory.CreateCatchExpressionSql(expressionString1, expressionString2, _operatorType)); }