示例#1
0
        private static CSqlOptions CreateCSqlOptions(DbConnectionParameter dbConnectionParameter, ScriptParameter csqlParameter, Document activeDocument)
        {
            CSqlOptions csqlOptions = new CSqlOptions();

            DocumentEnvironment environment = new DocumentEnvironment(activeDocument);
            VariableSubstitutor substitutor = new VariableSubstitutor(environment);

            csqlOptions.ScriptFile = activeDocument.FullName;
            if (csqlParameter.IsOutputFileEnabled)
            {
                string file = substitutor.Substitute(csqlParameter.OutputFile);
                csqlOptions.DistributionFile = file;
            }
            else
            {
                csqlOptions.DistributionFile = null;
            }

            if (csqlParameter.IsTemporaryFileEnabled)
            {
                string file = substitutor.Substitute(csqlParameter.TemporaryFile);
                csqlOptions.TempFile = file;
            }
            else
            {
                csqlOptions.TempFile = null;
            }

            csqlOptions.BreakOnError        = csqlParameter.IsBreakOnErrorEnabled;
            csqlOptions.UsePreprocessor     = csqlParameter.IsPreprocessorEnabled;
            csqlOptions.ConnectionParameter = dbConnectionParameter;
            csqlOptions.PreprocessorOptions = CreatePreprocessorArguments(substitutor, csqlParameter);
            csqlOptions.AddPreprocessorMacros();

            csqlOptions.Verbosity.Level = csqlParameter.Verbosity;

            csqlOptions.NoLogo = false;
            csqlOptions.MaxResultColumnWidth = csqlParameter.MaxResultColumnWidth;

            return(csqlOptions);
        }