Exemple #1
0
        public CSqlOptions CreateCsqlOptions()
        {
            DbConnectionParameter connectionParameter = new DbConnectionParameter();

            connectionParameter.Provider           = this.System;
            connectionParameter.DatasourceAddress  = this.Server;
            connectionParameter.DatasourcePort     = this.ServerPort;
            connectionParameter.Catalog            = this.Database;
            connectionParameter.UserId             = this.User;
            connectionParameter.Password           = this.Password;
            connectionParameter.IntegratedSecurity = string.IsNullOrEmpty(this.User);

            CSqlOptions csqlOptions = new CSqlOptions();

            csqlOptions.ConnectionParameter = connectionParameter;
            csqlOptions.ScriptFile          = this.ScriptFile;
            csqlOptions.TempFile            = this.TempFile;
            csqlOptions.DistributionFile    = this.DistFile;
            csqlOptions.UsePreprocessor     = this.UsePreprocessor;
            csqlOptions.BreakOnError        = this.BreakOnError;
            csqlOptions.NoLogo          = this.NoLogo;
            csqlOptions.Verbosity.Level = (TraceLevel)Verbose;
            csqlOptions.PreprocessorOptions.AdvancedArguments = this.PreprocessorArgs;


            csqlOptions.AddPreprocessorMacros();

            return(csqlOptions);
        }
Exemple #2
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);
        }