/// <summary> /// Creates the sql string. /// </summary> /// <returns>The sql string.</returns> /// <param name="factory">Factory.</param> /// <param name="isFullName">If set to <c>true</c> is full name.</param> /// <param name="state">State.</param> internal virtual string CreateSqlString(CommandFactory factory, bool isFullName, CreateSqlState state) { var expressionString1 = _expression1.CreateSqlString(factory, isFullName, state); var expressionString2 = _expression2.CreateSqlString(factory, isFullName, state); return(factory.CreateConcatQueryExpressionSql(expressionString1, expressionString2, _operatorType)); }
/// <summary> /// Creates the sql string. /// </summary> /// <returns>The sql string.</returns> /// <param name="factory">Factory.</param> /// <param name="isFullName">If set to <c>true</c> is full name.</param> /// <param name="state">State.</param> internal override string CreateSqlString(CommandFactory factory, bool isFullName, CreateSqlState state) { string expressionString1 = _expression1.CreateSqlString(factory, isFullName, state); string expressionString2 = _expression2.CreateSqlString(factory, isFullName, state); return(factory.CreateConcatExpressionSql(expressionString1, expressionString2, _operatorType)); }
internal override string CreateSqlString(CommandFactory factory, bool isFullName, CreateSqlState state) { var sql = state.GetDataSql(this, isFullName); if (sql != null) { return(sql); } var tableName = factory.CreateDataTableMappingSql(TableMapping, state); var selectField = _selectField.CreateSqlString(factory, true, state); var field = _field.CreateSqlString(factory, isFullName, state); string query = null; if (_expression != null) { query = _expression.CreateSqlString(factory, true, state); } sql = factory.CreateSubQuerySql(field, _predicate, selectField, tableName, query); state.SetDataSql(this, isFullName, sql); return(sql); }
internal override string CreateSqlString(CommandFactory factory, bool isFullName, CreateSqlState state) { string sql = state.GetDataSql(this, isFullName); if (sql != null) { return(sql); } string tableName = factory.CreateDataTableMappingSql(TableMapping, state); string selectField = _selectField.CreateSqlString(factory, true, state); string field = _field.CreateSqlString(factory, isFullName, state); string query = null; if (_expression != null) { query = _expression.CreateSqlString(factory, true, state); } QueryCollectionPredicate op = _isTrue ? QueryCollectionPredicate.In : QueryCollectionPredicate.NotIn; sql = factory.CreateSubQuerySql(field, op, selectField, tableName, query); state.SetDataSql(this, isFullName, sql); return(sql); }
internal override string CreateSqlString(CommandFactory factory, out DataParameter[] dataParameters) { string queryString = null; List <DataParameter> list = new List <DataParameter> (); DataParameter[] ps = null; string functionSql = _function.CreateSqlString(factory, out ps); list.AddRange(ps); DataParameter[] ps2 = null; queryString = _queryExpression.CreateSqlString(factory, out ps2); list.AddRange(ps2); dataParameters = list.ToArray(); return(factory.CreateSubQuerySql(functionSql, _predicate, _queryFieldInfo.FieldName, _queryFieldInfo.TableMapping.TableName, queryString)); }
internal override string CreateSqlString(CommandFactory factory, bool isFullName, CreateSqlState state) { string sql = state.GetDataSql(this, isFullName); if (sql != null) { return(sql); } sql = _query.CreateSqlString(factory, isFullName, state); state.SetDataSql(this, isFullName, sql); return(sql); }
internal override string CreateSqlString(CommandFactory factory, out DataParameter[] dataParameters) { string queryString = null; if (_queryExpression == null) { dataParameters = new DataParameter[0]; } else { queryString = _queryExpression.CreateSqlString(factory, out dataParameters); } return(factory.CreateSubQuerySql(_fieldInfo.CreateDataFieldSql(factory), _predicate, _queryFieldInfo.CreateDataFieldSql(factory), factory.CreateDataTableSql(_queryFieldInfo.TableMapping), queryString)); }
internal override string CreateSqlString(CommandFactory factory, bool isFullName, CreateSqlState state) { var sql = state.GetDataSql(this, isFullName); if (sql != null) { return(sql); } var query = _expression.CreateSqlString(factory, true, state); var tableName = factory.CreateDataTableMappingSql(TableMapping, state); sql = factory.CreateExistsQuerySql(tableName, query, !_isTrue); state.SetDataSql(this, isFullName, sql); return(sql); }
internal override string CreateSqlString(CommandFactory factory, bool isFullName, CreateSqlState state) { var sql = state.GetDataSql(this, isFullName); if (sql != null) { return(sql); } var query = _query.CreateSqlString(factory, isFullName, state); object ifTrue; object ifFalse; var ifTrueInfo = _ifTrue as DataFieldInfo; var ifFalseInfo = _ifFalse as DataFieldInfo; if (!Equals(ifTrueInfo, null) && !Equals(ifFalseInfo, null)) { ifTrue = ifTrueInfo.CreateSqlString(factory, isFullName, state); ifFalse = ifFalseInfo.CreateSqlString(factory, isFullName, state); } else if (!Equals(ifTrueInfo, null)) { ifTrue = ifTrueInfo.CreateSqlString(factory, isFullName, state); var ifFalseObject = LambdaExpressionExtend.ConvertLambdaObject(_ifFalse).AdjustValue(); ifFalse = state.AddDataParameter(factory, ifFalseObject); } else if (!Equals(ifFalseInfo, null)) { ifFalse = ifFalseInfo.CreateSqlString(factory, isFullName, state); var ifTrueObject = LambdaExpressionExtend.ConvertLambdaObject(_ifTrue).AdjustValue(); ifTrue = state.AddDataParameter(factory, ifTrueObject); } else { var ifTrueObject = LambdaExpressionExtend.ConvertLambdaObject(_ifTrue).AdjustValue(); var ifFalseObject = LambdaExpressionExtend.ConvertLambdaObject(_ifFalse).AdjustValue(); 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, bool isFullName, CreateSqlState state) { string sql = state.GetDataSql(this, isFullName); if (sql != null) { return(sql); } if (_expression == null) { sql = factory.CreateCountAllSql(); } else { string expressionSql = _expression.CreateSqlString(factory, isFullName, state); sql = factory.CreateCountAllSql(expressionSql); } state.SetDataSql(this, isFullName, sql); return(sql); }
internal override string CreateSqlString(CommandFactory factory, out DataParameter[] dataParameters) { string sql = _expression.CreateSqlString(factory, out dataParameters); return(factory.CreateConditionSumSql(sql, _fieldinfo.FieldName, _isDistinct)); }
internal override string CreateSqlString(CommandFactory factory, bool isFullName, CreateSqlState state) { var queryString = _queryExpression.CreateSqlString(factory, isFullName, state); return(factory.CreateNotQuerySql(queryString)); }
internal override string CreateSqlString(CommandFactory factory, out DataParameter[] dataParameters) { string sql = _expression.CreateSqlString(factory, out dataParameters); return(factory.CreateConditionCountSql(sql, !Object.Equals(this._fieldinfo, null) ? _fieldinfo.FieldName : null, _isDistinct)); }
internal override string CreateSqlString(CommandFactory factory, out DataParameter[] dataParameters) { string queryString = _queryExpression.CreateSqlString(factory, out dataParameters); return(factory.CreateExistsQuerySql(factory.CreateDataTableSql(_queryExpression.TableMapping), queryString, _isNot)); }