public DirectToDbApplier(QueryExecuter queryExecuter, IDatabaseSchemaVersionManager schemaVersionManager, QueryStatementSplitter splitter, IDbmsSyntax dbmsSyntax, string changeLogTableName, TextWriter infoTextWriter) { if (queryExecuter == null) throw new ArgumentNullException("queryExecuter"); if (schemaVersionManager == null) throw new ArgumentNullException("schemaVersionManager"); if (splitter == null) throw new ArgumentNullException("splitter"); if (infoTextWriter == null) throw new ArgumentNullException("infoTextWriter"); this.queryExecuter = queryExecuter; this.schemaVersionManager = schemaVersionManager; this.splitter = splitter; this.dbmsSyntax = dbmsSyntax; this.changeLogTableName = changeLogTableName; this.infoTextWriter = infoTextWriter; }
public void Go() { this.Validate(); this.InfoWriter.WriteLine(this.GenerateWelcomeString()); var factory = new DbmsFactory(this.Dbms, this.ConnectionString); var dbmsSyntax = factory.CreateDbmsSyntax(); QueryExecuter queryExecuter = new QueryExecuter(factory); var databaseSchemaVersionManager = new DatabaseSchemaVersionManager(queryExecuter, dbmsSyntax, this.ChangeLogTableName); var scanner = new DirectoryScanner(this.InfoWriter, this.Encoding); var changeScriptRepository = new ChangeScriptRepository(scanner.GetChangeScriptsForDirectory(this.ScriptDirectory)); IChangeScriptApplier doScriptApplier; TextWriter doWriter = null; if (this.OutputFile != null) { doWriter = new StreamWriter(this.OutputFile.OpenWrite(), this.Encoding); doScriptApplier = new TemplateBasedApplier( doWriter, this.Dbms, this.ChangeLogTableName, this.Delimiter, this.DelimiterType, this.TemplateDir); } else { QueryStatementSplitter splitter = new QueryStatementSplitter { Delimiter = this.Delimiter, DelimiterType = this.DelimiterType, LineEnding = this.LineEnding, }; doScriptApplier = new DirectToDbApplier( queryExecuter, databaseSchemaVersionManager, splitter, this.InfoWriter); } IChangeScriptApplier undoScriptApplier = null; TextWriter undoWriter = null; if (this.UndoOutputFile != null) { undoWriter = new StreamWriter(this.UndoOutputFile.OpenWrite(), this.Encoding); undoScriptApplier = new UndoTemplateBasedApplier( undoWriter, this.Dbms, this.ChangeLogTableName, this.Delimiter, this.DelimiterType, this.TemplateDir); } try { Controller controller = new Controller( changeScriptRepository, databaseSchemaVersionManager, doScriptApplier, undoScriptApplier, this.InfoWriter); controller.ProcessChangeScripts(this.LastChangeToApply); queryExecuter.Close(); } finally { if (doWriter != null) { doWriter.Dispose(); } if (undoWriter != null) { undoWriter.Dispose(); } } }
public UserRepository(QueryExecuter queryExecuter) { this.queryExecuter = queryExecuter; }
private void manageModeloFlujo(CentroCostos centroCostos, Empresa empresa, DateTime fechaactual) { StopWatch swGral = new StopWatch($"manageModeloFlujo cc={centroCostos.desc_id} emp={empresa.desc_id} fec={fechaactual}"); swGral.start(); int numInserts = 0; Int64 modeloId = centroCostos.modelo_negocio_flujo_id; Modelo_Negocio mn = new ModeloNegocioDataAccessLayer().GetModelo(modeloId.ToString()); if (!mn.activo) { return; } List <Rubros> rubrosDeModelo = GetRubrosFromModeloId(modeloId); Int64 numRegistrosExistentes = getNumMontosOfTipoCaptura(TipoCapturaFlujo); ConcurrentQueue <Rubros> rubrosSinMontos = new ConcurrentQueue <Rubros>(); ConcurrentDictionary <Int32, byte> aniosDefault = new ConcurrentDictionary <Int32, byte>(); Parallel.ForEach(rubrosDeModelo, (rubro) => { StopWatch sw = new StopWatch( $"consulta_flujo cc.id='{centroCostos.id}',empr.id='{centroCostos.empresa_id}',proy.id='{centroCostos.proyecto_id}',modelo.id='{centroCostos.modelo_negocio_flujo_id}',rubro.id='{rubro.id}'"); sw.start("getQuerySemanalSums"); GeneraQry qry = new GeneraQry("semanal", "itm::text", 2); String consulta = qry.getQuerySemanalSums(rubro, centroCostos, empresa, numRegistrosExistentes); logger.Debug( "consulta_flujo cc.id='{0}',empr.id='{1}',proy.id='{2}',modelo.id='{3}',rubro.id='{4}', ===>> '{5}'", centroCostos.id, centroCostos.empresa_id, centroCostos.proyecto_id, centroCostos.modelo_negocio_flujo_id, rubro.id, consulta); DataTable sumaMontos = new QueryExecuter().ExecuteQuery(consulta); sw.stop(); sw.start("BuildMontosFujo"); if (sumaMontos.Rows.Count > 0) { BuildMontosFujo(sumaMontos, centroCostos, modeloId, rubro.id, fechaactual, aniosDefault); } else { rubrosSinMontos.Enqueue(rubro); } sw.stop(); logger.Info(sw.prettyPrint()); }); foreach (var rubro in rubrosSinMontos) { foreach (var anio in aniosDefault.Keys) { MontosConsolidados montos = new MontosConsolidados(); montos.anio = anio; montos.activo = true; montos.fecha = fechaactual; montos.mes = fechaactual.Month; montos.centro_costo_id = centroCostos.id; montos.empresa_id = centroCostos.empresa_id; montos.modelo_negocio_id = modeloId; montos.proyecto_id = centroCostos.proyecto_id; montos.rubro_id = rubro.id; montos.tipo_captura_id = TipoCapturaFlujo; insertarMontos(montos); } } swGral.stop(); logger.Info(swGral.prettyPrint()); }
public ReportTaskRepository(QueryExecuter queryExecuter) { this.queryExecuter = queryExecuter; }
private void manageModeloContable(CentroCostos centroCostos, Empresa empresa, DateTime fechaactual) { StopWatch swGral = new StopWatch($"manageModeloContable cc={centroCostos.desc_id} emp={empresa.desc_id} fec={fechaactual}"); swGral.start(); int numInserts = 0; Int64 modeloId = centroCostos.modelo_negocio_id; Modelo_Negocio mn = new ModeloNegocioDataAccessLayer().GetModelo(modeloId.ToString()); if (!mn.activo) { return; } List <Rubros> rubrosDeModelo = GetRubrosFromModeloId(modeloId); Int64 numRegistrosExistentes = getNumMontosOfTipoCaptura(TipoCapturaContable); GeneraQry qry = new GeneraQry("balanza", "cuenta_unificada", 12); ConcurrentDictionary <Int32, byte> aniosDefecto = new ConcurrentDictionary <Int32, byte>(); ConcurrentQueue <Rubros> rubrosSinMontos = new ConcurrentQueue <Rubros>(); Parallel.ForEach(rubrosDeModelo, (rubro) => { StopWatch sw = new StopWatch( $"consulta_contables cc.id='{centroCostos.id}',empr.id='{centroCostos.empresa_id}',proy.id='{centroCostos.proyecto_id}',modelo.id='{centroCostos.modelo_negocio_flujo_id}',rubro.id='{rubro.id}'"); sw.start("getQuerySums"); String consulta = qry.getQuerySums(rubro, centroCostos, empresa, numRegistrosExistentes); logger.Debug( "consulta_contables cc.id='{0}',empr.id='{1}',proy.id='{2}',modelo.id='{3}',rubro.id='{4}', ===>> '{5}'", centroCostos.id, centroCostos.empresa_id, centroCostos.proyecto_id, centroCostos.modelo_negocio_id, rubro.id, consulta); DataTable sumaMontosDt = new QueryExecuter().ExecuteQuery(consulta); sw.stop(); sw.start("BuildMontosConsolContable"); if (sumaMontosDt.Rows.Count > 0) { foreach (DataRow rubroMontosRow in sumaMontosDt.Rows) { BuildMontosConsolContable(rubroMontosRow, centroCostos, modeloId, rubro.id, fechaactual); aniosDefecto.TryAdd(ToInt32(rubroMontosRow["year"]), 1); } } else { rubrosSinMontos.Enqueue(rubro); } sw.stop(); logger.Info(sw.prettyPrint()); }); foreach (var rubro in rubrosSinMontos) { foreach (var anio in aniosDefecto.Keys) { BuildMontosConsolContable(centroCostos, modeloId, rubro.id, fechaactual, anio); } } swGral.stop(); logger.Info(swGral.prettyPrint()); }
public QueryExecuterBenchmarkBase(int cacheSize) { _schema = SchemaFactory.Create(); _queryExecuter = new QueryExecuter(_schema, cacheSize); }
public void AccounLoad() { try { string accountUser = string.Empty; string accountPass = string.Empty; string niches = string.Empty; string proxyAddress = string.Empty; string proxyPort = string.Empty; string proxyUserName = string.Empty; string proxyPassword = string.Empty; //string Useragent = string.Empty; string BoardsName = string.Empty; string ScreenName = string.Empty; string LoginStatus = string.Empty; string Followers = string.Empty; string Following = string.Empty; QueryExecuter QME = new QueryExecuter(); DataSet ds = QME.getAccount(); this.Dispatcher.Invoke(new Action(delegate { AccountViewModel._listOfAccount.Clear(); })); if (ds.Tables[0].Rows.Count != 0) { PDGlobals.listAccounts.Clear(); for (int noRow = 0; noRow < ds.Tables[0].Rows.Count; noRow++) { string account = ds.Tables[0].Rows[noRow].ItemArray[0].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[1].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[2].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[3].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[4].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[5].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[6].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[7].ToString(); PDGlobals.listAccounts.Add(account); // dv.AllowNew = false; accountUser = ds.Tables[0].Rows[noRow].ItemArray[0].ToString(); accountPass = ds.Tables[0].Rows[noRow].ItemArray[1].ToString(); niches = ds.Tables[0].Rows[noRow].ItemArray[2].ToString(); proxyAddress = ds.Tables[0].Rows[noRow].ItemArray[3].ToString(); proxyPort = ds.Tables[0].Rows[noRow].ItemArray[4].ToString(); proxyUserName = ds.Tables[0].Rows[noRow].ItemArray[5].ToString(); proxyPassword = ds.Tables[0].Rows[noRow].ItemArray[6].ToString(); ScreenName = ds.Tables[0].Rows[noRow].ItemArray[9].ToString(); Followers = ds.Tables[0].Rows[noRow].ItemArray[7].ToString(); Following = ds.Tables[0].Rows[noRow].ItemArray[8].ToString(); LoginStatus = ds.Tables[0].Rows[noRow].ItemArray[10].ToString(); // Accounts objPinInterestUser = new Accounts(); PinInterestUser objPinInterestUser = new PinInterestUser("", "", "", ""); objPinInterestUser.Username = accountUser; objPinInterestUser.Password = accountPass; objPinInterestUser.Niches = niches; objPinInterestUser.ProxyAddress = proxyAddress; objPinInterestUser.ProxyPort = proxyPort; objPinInterestUser.ProxyUsername = proxyUserName; objPinInterestUser.ProxyPassword = proxyPassword; // objPinInterestUser.LoginStatus = LoginStatus; try { AccountNotifyPropertyChanged objAccountNotifyPropertyChanged = new AccountNotifyPropertyChanged(); objAccountNotifyPropertyChanged.Username = accountUser; objAccountNotifyPropertyChanged.Password = accountPass; objAccountNotifyPropertyChanged.Niche = niches; objAccountNotifyPropertyChanged.ScreenName = ScreenName; objAccountNotifyPropertyChanged.FollowerCount = Followers; objAccountNotifyPropertyChanged.FollowingCount = Following; objAccountNotifyPropertyChanged.ProxyAddress = proxyAddress; objAccountNotifyPropertyChanged.ProxyPassword = proxyPassword; objAccountNotifyPropertyChanged.ProxyPort = proxyPort; objAccountNotifyPropertyChanged.ProxyUserName = proxyUserName; if (LoginStatus.Contains("Success")) { objAccountNotifyPropertyChanged.LoginStatus = "Success"; objAccountNotifyPropertyChanged.BackgroundColor = "Green"; this.Dispatcher.Invoke(new Action(delegate { AccountViewModel._listOfAccount.Add(objAccountNotifyPropertyChanged); })); } else if (LoginStatus.Contains("Fail")) { objAccountNotifyPropertyChanged.LoginStatus = "Fail"; objAccountNotifyPropertyChanged.BackgroundColor = "Red"; this.Dispatcher.Invoke(new Action(delegate { AccountViewModel._listOfAccount.Add(objAccountNotifyPropertyChanged); })); } else if (LoginStatus.Contains("Not")) { objAccountNotifyPropertyChanged.LoginStatus = "Not Checked"; objAccountNotifyPropertyChanged.BackgroundColor = ""; this.Dispatcher.Invoke(new Action(delegate { AccountViewModel._listOfAccount.Add(objAccountNotifyPropertyChanged); })); } } catch (Exception ex) { GlobusLogHelper.log.Error(" Error :" + ex.StackTrace); } try { PDGlobals.loadedAccountsDictionary.Add(objPinInterestUser.Username, objPinInterestUser); try { this.Dispatcher.Invoke(new Action(delegate { // dgvAccounts.ItemsSource = ds.Tables[0].DefaultView; dgvAccounts.ItemsSource = AccountViewModel._listOfAccount; // AccountViewModel._listOfAccount.Clear(); })); } catch (Exception ex) { }; } catch (Exception ex) { }; } try { this.Dispatcher.Invoke(new Action(delegate { // dgvAccounts.ItemsSource = ds.Tables[0].DefaultView; dgvAccounts.ItemsSource = AccountViewModel._listOfAccount; //AccountViewModel._listOfAccount.Clear(); })); } catch { }; GlobusLogHelper.log.Info(" => [ " + PDGlobals.listAccounts.Count + " Accounts Loaded ]"); } else { this.Dispatcher.Invoke(new Action(delegate { //dgvAccounts.ItemsSource = ds.Tables[0].DefaultView; dgvAccounts.ItemsSource = AccountViewModel._listOfAccount; // AccountViewModel._listOfAccount.Clear(); })); GlobusLogHelper.log.Info(" [ No Accounts Loaded ]"); } } catch (Exception ex) { GlobusLogHelper.log.Error("Error : " + ex.StackTrace); } }
/// <summary> /// Executes the a database deployment with the specified config. /// </summary> /// <param name="config">The config.</param> /// <param name="infoWriter">The info writer.</param> /// <exception cref="System.InvalidOperationException">SQLCMD mode can only be applied against an mssql database.</exception> public void Execute(DbDeployConfig config, TextWriter infoWriter) { this.Validate(config, infoWriter); infoWriter.WriteLine(); infoWriter.WriteLine("=========================================================="); infoWriter.WriteLine(this.GenerateWelcomeString()); var factory = new DbmsFactory(config.Dbms, config.ConnectionString, config.DllPathConnector); var dbmsSyntax = factory.CreateDbmsSyntax(); var queryExecuter = new QueryExecuter(factory); var databaseSchemaVersionManager = new DatabaseSchemaVersionManager(queryExecuter, dbmsSyntax, config.ChangeLogTableName); IChangeScriptApplier doScriptApplier; TextWriter doWriter = null; QueryExecuter applierExecutor = null; if (config.OutputFile != null) { doWriter = new StreamWriter(config.OutputFile.OpenWrite(), config.Encoding); doScriptApplier = new TemplateBasedApplier( doWriter, dbmsSyntax, config.ChangeLogTableName, config.Delimiter, config.DelimiterType, config.TemplateDirectory); } else if (config.UseSqlCmd) { // Verify database is MSSQL. if (!string.Equals(config.Dbms, SupportedDbms.MSSQL, StringComparison.InvariantCultureIgnoreCase)) { throw new InvalidOperationException("SQLCMD mode can only be applied against an mssql database."); } doScriptApplier = new SqlCmdApplier( config.ConnectionString, databaseSchemaVersionManager, dbmsSyntax, config.ChangeLogTableName, infoWriter); } else { var splitter = new QueryStatementSplitter { Delimiter = config.Delimiter, DelimiterType = config.DelimiterType, LineEnding = config.LineEnding, }; // Do not share query executor between schema manager and applier, since a failure in one will effect the other. applierExecutor = new QueryExecuter(factory); doScriptApplier = new DirectToDbApplier( applierExecutor, databaseSchemaVersionManager, splitter, dbmsSyntax, config.ChangeLogTableName, infoWriter); } IChangeScriptApplier undoScriptApplier = null; TextWriter undoWriter = null; if (config.UndoOutputFile != null) { undoWriter = new StreamWriter(config.UndoOutputFile.OpenWrite(), config.Encoding); undoScriptApplier = new UndoTemplateBasedApplier( undoWriter, dbmsSyntax, config.ChangeLogTableName, config.Delimiter, config.DelimiterType, config.TemplateDirectory); } try { var changeScriptRepositoryFactory = new ChangeScriptRepositoryFactory(config, infoWriter); var changeScriptRepository = changeScriptRepositoryFactory.Obter(); var repositorioScripts = new RepositorioScripts(databaseSchemaVersionManager, changeScriptRepository); var controller = new Controller( repositorioScripts, databaseSchemaVersionManager, doScriptApplier, undoScriptApplier, config.AutoCreateChangeLogTable, infoWriter); controller.ProcessChangeScripts(config.LastChangeToApply, config.ForceUpdate); queryExecuter.Close(); if (applierExecutor != null) { applierExecutor.Close(); } } finally { if (doWriter != null) { doWriter.Dispose(); } if (undoWriter != null) { undoWriter.Dispose(); } } }
public string Follow(string UserName, ref InstagramAccountManager accountManager) { NameValueCollection nameval = new NameValueCollection(); //ChilkatHttpHelpr chilaktHttpHelper = new ChilkatHttpHelpr(); if (!UserName.Contains("http://websta.me/n/")) { UserName = "******" + UserName + "/"; } string UserPageContent = string.Empty; if (!string.IsNullOrEmpty(accountManager.proxyAddress) && !string.IsNullOrEmpty(accountManager.proxyPort)) { try { UserPageContent = accountManager.httpHelper.getHtmlfromUrlProxy(new Uri(UserName), accountManager.proxyAddress, Convert.ToInt32(accountManager.proxyPort), accountManager.proxyUsername, accountManager.proxyPassword); } catch (Exception ex) { } if (string.IsNullOrEmpty(UserPageContent)) { Thread.Sleep(1000); try { UserPageContent = accountManager.httpHelper.getHtmlfromUrlProxy(new Uri(UserName), accountManager.proxyAddress, Convert.ToInt32(accountManager.proxyPort), accountManager.proxyUsername, accountManager.proxyPassword); } catch (Exception ex) { } } } else { try { UserPageContent = accountManager.httpHelper.getHtmlfromUrlProxy(new Uri(UserName), "", 80, "", ""); } catch { }; if (string.IsNullOrEmpty(UserPageContent)) { Thread.Sleep(1000); try { UserPageContent = accountManager.httpHelper.getHtmlfromUrlProxy(new Uri(UserName), "", 80, "", ""); } catch { }; } } try { //if (UserPageContent.Contains("This user is private.")) //{ // return "private"; //} string PK = string.Empty; if (UserPageContent.Contains("")) { PK = getBetween(UserPageContent, "id=\"follow_btn_wrapper\"", ">").Replace("data-target=", "").Replace("\"", "").Trim(); } if (string.IsNullOrEmpty(PK)) { PK = getBetween(UserPageContent, "id=\"message_user_id", ">").Replace(">", "").Replace("value=", string.Empty).Replace("\"", string.Empty).Trim();//.Replace("\"", "").Trim(); } string PostData = "action=follow";//"&pk=" + PK + "&t=9208"; string FollowedPageSource = string.Empty; if (!string.IsNullOrEmpty(PK)) { try { FollowedPageSource = accountManager.httpHelper.postFormData(new Uri("http://websta.me/api/relationships/" + PK), PostData, UserName, "http://websta.me"); } catch { } } if (string.IsNullOrEmpty(FollowedPageSource)) { } nameval.Add("Origin", "http://web.stagram.com"); nameval.Add("X-Requested-With", "XMLHttpRequest"); if (FollowedPageSource.Contains("OK")) { //return "Followed"; string status = string.Empty; try { status = QueryExecuter.getFollowStatus(accountManager.Username, UserName); } catch { } switch (status) { case "Followed": status = "Already Followed"; break; case "Unfollowed": status = "Unfollowed"; QueryExecuter.updateFollowStatus(accountManager.Username, UserName, "Followed"); break; default: status = "Followed"; try { QueryExecuter.insertFollowInfo(accountManager.Username, UserName, "Followed"); } catch { } break; } return(status); } else { return("UnFollowed"); } } catch (Exception) { return("Follow option is not available In page...!!"); } }
protected virtual String GetCellSetDescription(String query) { System.Diagnostics.Trace.TraceInformation("Ranet.Olap.Core.Providers.OlapProvider execute MDX query: {0} \r\n", query); return(QueryExecuter.GetCellSetDescription(query)); }
public void loaddatafmdb() { try { DataTable NewDt2 = CreateUrltable(); QueryExecuter Qm = new QueryExecuter(); DataSet ds = Qm.getAccount(); DataTable dt = ds.Tables[0]; List<string> BunchList = new List<string>(); int itemCounter = 0; foreach (DataRow item in dt.Rows) { try { DataRow newdr = NewDt2.NewRow(); string Username = item["Username"].ToString(); string Password = item["Password"].ToString(); string proxyAddress = item["IPAddress"].ToString(); string proxyPort = item["IPPort"].ToString(); string proxyUsername = item["IPUsername"].ToString(); string proxyPassword = item["IPPassword"].ToString(); string Path = item["Path"].ToString(); newdr["Username"] = Username; newdr["Password"] = Password; newdr["IPAddress"] = proxyAddress; newdr["IPPort"] = proxyPort; newdr["IPUsername"] = proxyUsername; newdr["IPPassword"] = proxyPassword; newdr["Path"] = Path; ClGlobul.lstUrls.Add(Username); ClGlobul.lstUrls.Add(Password); ClGlobul.lstUrls.Add(proxyAddress); ClGlobul.lstUrls.Add(proxyPort); ClGlobul.lstUrls.Add(proxyUsername); ClGlobul.lstUrls.Add(proxyPassword); ClGlobul.lstUrls.Add(Path); NewDt2.Rows.Add(newdr); } catch { }; } if (this.InvokeRequired) { this.Invoke(new MethodInvoker(delegate { dgvAccount.DataSource = NewDt2; })); } else { dgvAccount.DataSource = NewDt2; } } catch { }; }
public void loadAccount() { string path = string.Empty; try { QueryExecuter qm1 = new QueryExecuter(); DataSet ds = qm1.getAccount(); if (ds.Tables[0].Rows.Count != 0) { try { path = ds.Tables[0].Rows[0].ItemArray[6].ToString(); if (!string.IsNullOrEmpty(path)) { try { txtAddAccounts1.Text = path; } catch { }; } } catch { } for (int noRow = 0; noRow < ds.Tables[0].Rows.Count; noRow++) { string account = ds.Tables[0].Rows[noRow].ItemArray[0].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[1].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[2].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[3].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[4].ToString() + ":" + ds.Tables[0].Rows[noRow].ItemArray[5].ToString(); ClGlobul.accountList.Add(account); } AddToLogger("[ " + DateTime.Now + " ] => [ " + ClGlobul.accountList.Count + " Accounts Loaded ]"); } else { AddToLogger("[ " + DateTime.Now + " ] => [ No Accounts Loaded ]"); } } catch (Exception ex) { AddToLogger("[ " + DateTime.Now + " ] => [ No Accounts Loaded ]"); } DataTable dt = new DataTable(); dt.Columns.Add("Username"); dt.Columns.Add("Password"); dt.Columns.Add("proxyAddress"); dt.Columns.Add("proxyPort"); dt.Columns.Add("proxyUsername"); dt.Columns.Add("proxyPassword"); dt.Columns.Add("Path"); }
public TeamRepository(QueryExecuter queryExecuter) { this.queryExecuter = queryExecuter; }
public DBManagerTest() { exe = new QueryExecuter(DB_INFO[0], DB_INFO[1], DB_INFO[2], DB_INFO[3], DB_INFO[4]); dbManager = new DBManager(exe); }
/// <summary> /// Executes the a database deployment with the specified config. /// </summary> /// <param name="config">The config.</param> /// <param name="infoWriter">The info writer.</param> /// <exception cref="System.InvalidOperationException">SQLCMD mode can only be applied against an mssql database.</exception> public void Execute(DbDeployConfig config, TextWriter infoWriter) { this.Validate(config, infoWriter); infoWriter.WriteLine(); infoWriter.WriteLine("=========================================================="); infoWriter.WriteLine(this.GenerateWelcomeString()); var factory = new DbmsFactory(config.Dbms, config.ConnectionString); var dbmsSyntax = factory.CreateDbmsSyntax(); var queryExecuter = new QueryExecuter(factory); var databaseSchemaVersionManager = new DatabaseSchemaVersionManager(queryExecuter, dbmsSyntax, config.ChangeLogTableName, config.AutoCreateChangeLogTable); var scanner = new DirectoryScanner(infoWriter, config.Encoding); var changeScriptRepository = new ChangeScriptRepository(scanner.GetChangeScriptsForDirectory(config.ScriptDirectory)); IChangeScriptApplier doScriptApplier; TextWriter doWriter = null; QueryExecuter applierExecutor = null; if (config.OutputFile != null) { doWriter = new StreamWriter(config.OutputFile.OpenWrite(), config.Encoding); doScriptApplier = new TemplateBasedApplier( doWriter, config.Dbms, config.ChangeLogTableName, config.Delimiter, config.DelimiterType, config.TemplateDirectory); } else if (config.UseSqlCmd) { // Verify database is MSSQL. if (!string.Equals(config.Dbms, "mssql", StringComparison.InvariantCultureIgnoreCase)) { throw new InvalidOperationException("SQLCMD mode can only be applied against an mssql database."); } doScriptApplier = new SqlCmdApplier(config.ConnectionString, databaseSchemaVersionManager, infoWriter); } else { var splitter = new QueryStatementSplitter { Delimiter = config.Delimiter, DelimiterType = config.DelimiterType, LineEnding = config.LineEnding, }; // Do not share query executor between schema manager and applier, since a failure in one will effect the other. applierExecutor = new QueryExecuter(factory); doScriptApplier = new DirectToDbApplier( applierExecutor, databaseSchemaVersionManager, splitter, infoWriter); } IChangeScriptApplier undoScriptApplier = null; TextWriter undoWriter = null; if (config.UndoOutputFile != null) { undoWriter = new StreamWriter(config.UndoOutputFile.OpenWrite(), config.Encoding); undoScriptApplier = new UndoTemplateBasedApplier( undoWriter, config.Dbms, config.ChangeLogTableName, config.Delimiter, config.DelimiterType, config.TemplateDirectory); } try { var controller = new Controller( changeScriptRepository, databaseSchemaVersionManager, doScriptApplier, undoScriptApplier, infoWriter); controller.ProcessChangeScripts(config.LastChangeToApply, config.ForceUpdate); queryExecuter.Close(); if (applierExecutor != null) { applierExecutor.Close(); } } finally { if (doWriter != null) { doWriter.Dispose(); } if (undoWriter != null) { undoWriter.Dispose(); } } }
void RunPhase1() { MainIndex = new PositionalIndex(); IndexEnglishFiles(); //IndexPersianFiles(); var tokenRepeats = MainIndex.GetAllTokensRepeats() .OrderByDescending(x => x.repeatCount) .ToList(); Console.WriteLine(string.Join(",", tokenRepeats)); Console.WriteLine("Unique Token count is: " + tokenRepeats.Count); WriteInFile(MainIndex, "MainIndex"); GenerateBiword(); while (true) { Console.WriteLine("Enter your command: [query|proximity(windowSize)|and|compress|decompress|info(word)]"); var command = Console.ReadLine(); var commandWords = command.Split(' '); if (command == "and" || command == "a" || command == "q" || command == "query" || commandWords.First() == "p" || commandWords.First() == "proximity") { Console.WriteLine("Enter your query: "); var query = Console.ReadLine(); if (string.IsNullOrEmpty(query)) { Console.WriteLine("Your query is empty."); continue; } var queryExecuter = new QueryExecuter(query, MainIndex); List <SearchResult> result = null; if (command == "and" || command == "a") { result = queryExecuter.ExecuteAndSearch(); } else { if (commandWords.First() == "p" || commandWords.First() == "proximity") { result = queryExecuter.ExecuteTfIdfSearch(Convert.ToInt32(commandWords[1])); } else { result = queryExecuter.ExecuteTfIdfSearch(); } } Console.WriteLine("Query after preprocess: " + JsonConvert.SerializeObject(queryExecuter.Query)); Console.WriteLine(string.Join(Environment.NewLine, result)); Console.WriteLine("---------------------------------" + Environment.NewLine); Console.WriteLine("Enter classification filter: [1|2|3|4|no filter(Enter)]"); var classFilterLine = Console.ReadLine(); byte classFilter = Convert.ToByte(classFilterLine); queryExecuter = new QueryExecuter(query, MainIndex); result = queryExecuter.ExecuteTfIdfSearch(null, classFilter); Console.WriteLine(string.Join(Environment.NewLine, result)); Console.WriteLine("---------------------------------" + Environment.NewLine); } else if (command.StartsWith("info")) { var word = command.Split(' ')[1]; Console.WriteLine(MainIndex.GetWordInfo(word)); } else if (command.Contains("compress")) { Console.WriteLine("Enter compress mode: [gamma|varbyte]"); var modeStr = Console.ReadLine(); CompressUtility.Mode = (CompressMode)Enum.Parse(typeof(CompressMode), modeStr); if (command.StartsWith("de")) { Decompress(); } else { Compress(); } } } }