EFIngresProvider/SqlGen/SqlGenerator.cs
/// <summary>
/// General purpose static function that can be called from System.Data assembly
/// </summary>
/// <param name="tree">command tree</param>
/// <param name="version">version</param>
/// <param name="parameters">Parameters to add to the command tree corresponding
/// to constants in the command tree. Used only in ModificationCommandTrees.</param>
/// <returns>The string representing the SQL to be executed.</returns>
General purpose static function that can be called from System.Data assembly
General purpose static function that can be called from System . Data assembly
internal static string GenerateSql(DbCommandTree tree, EFIngresStoreVersion version, out List<DbParameter> parameters, out CommandType commandType)
        {
            commandType = CommandType.Text;
            DbQueryCommandTree queryCommandTree = tree as DbQueryCommandTree;
            if (queryCommandTree != null)
            {
                SqlGenerator sqlGen = new SqlGenerator(version);
                parameters = null;
                return sqlGen.GenerateSql((DbQueryCommandTree)tree);
            }
            DbFunctionCommandTree DbFunctionCommandTree = tree as DbFunctionCommandTree;
            if (DbFunctionCommandTree != null)
            {
                SqlGenerator sqlGen = new SqlGenerator(version);
                parameters = null;
                string sql = sqlGen.GenerateFunctionSql(DbFunctionCommandTree, out commandType);
                return sql;
            }
            DbInsertCommandTree insertCommandTree = tree as DbInsertCommandTree;
            if (insertCommandTree != null)
            {
                return DmlSqlGenerator.GenerateInsertSql(insertCommandTree, out parameters);
            }
            DbDeleteCommandTree deleteCommandTree = tree as DbDeleteCommandTree;
            if (deleteCommandTree != null)
            {
                return DmlSqlGenerator.GenerateDeleteSql(deleteCommandTree, out parameters);
            }
            DbUpdateCommandTree updateCommandTree = tree as DbUpdateCommandTree;
            if (updateCommandTree != null)
            {
                return DmlSqlGenerator.GenerateUpdateSql(updateCommandTree, out parameters);
            }
            throw new NotSupportedException("Unrecognized command tree type");
        }
internal static string GenerateSql ( DbCommandTree tree , EFIngresStoreVersion version , out List < DbParameter > parameters , out CommandType commandType ) { commandType = CommandType . Text ; DbQueryCommandTree queryCommandTree = tree as DbQueryCommandTree ; if ( queryCommandTree != null ) { SqlGenerator sqlGen = new SqlGenerator ( version ) ; parameters = null ; return sqlGen . GenerateSql ( ( DbQueryCommandTree ) tree ) ; } DbFunctionCommandTree DbFunctionCommandTree = tree as DbFunctionCommandTree ; if ( DbFunctionCommandTree != null ) { SqlGenerator sqlGen = new SqlGenerator ( version ) ; parameters = null ; string sql = sqlGen . GenerateFunctionSql ( DbFunctionCommandTree , out commandType ) ; return sql ; } DbInsertCommandTree insertCommandTree = tree as DbInsertCommandTree ; if ( insertCommandTree != null ) { return DmlSqlGenerator . GenerateInsertSql ( insertCommandTree , out parameters ) ; } DbDeleteCommandTree deleteCommandTree = tree as DbDeleteCommandTree ; if ( deleteCommandTree != null ) { return DmlSqlGenerator . GenerateDeleteSql ( deleteCommandTree , out parameters ) ; } DbUpdateCommandTree updateCommandTree = tree as DbUpdateCommandTree ; if ( updateCommandTree != null ) { return DmlSqlGenerator . GenerateUpdateSql ( updateCommandTree , out parameters ) ; } throw new NotSupportedException ( " " ) ; }
General purpose static function that can be called from System.Data assembly
General purpose static function that can be called from System . Data assembly
//Handle Query //Handle Function //Handle Insert //Handle Delete //Handle Update
The string representing the SQL to be executed.
The string representing the SQL to be executed .
tree
DbCommandTree
None
version
EFIngresStoreVersion
None
List<DbParameter>
out
CommandType
out
parameters
Parameters to add to the command tree corresponding
to constants in the command tree. Used only in ModificationCommandTrees.
Parameters to add to the command tree corresponding to constants in the command tree . Used only in ModificationCommandTrees .