//*********************************************************************************** static public void MYSQL_MAKE_QUERY() { using (XwDbCommand sql = new XwDbCommand("DBCONN_MYTEST")) { sql.Make(MakeType.UPSERT, "Tester"); sql.AddParameter("ID", 12); sql.AddParameter("@Name", "POIS"); sql.ExecuteMK(); Console.WriteLine(sql.GetDebugCommand()); } }
//************************************************************************************************************* public void SaveServer(Server server) { using (XwDbCommand sql = new XwDbCommand(Config.GetConnectionString(), "Data.SQLite")) { sql.AddParameter("Name", server.Name); sql.AddParameter("Host", server.Host); sql.AddParameter("Username", server.Username); sql.AddParameter("Password", server.Password); sql.AddParameter("Favorite", server.IsFavorite); sql.AddParameter("ServerType", (int)server.Type); sql.AddParameter("GroupID", server.GroupID); sql.AddParameter("Color", server.Color); sql.AddParameter("SendKeys", server.SendKeys); sql.AddParameter("Sound", server.UseSound); sql.AddParameter("Drives", server.ConnectDrives); sql.AddParameter("Port", server.Port); sql.AddParameter("X", server.Width); sql.AddParameter("Y", server.Height); sql.AddParameter("AutoScale", server.AutoScale); sql.AddParameter("SSH1", server.SSH1); sql.AddParameter("Passive", server.Passive); sql.AddParameter("Themes", server.Themes); sql.AddParameter("Certificates", server.Certificates); sql.AddParameter("UseHtmlLogin", server.UseHtmlLogin); sql.AddParameter("HtmlUserBox", server.HtmlUserBox); sql.AddParameter("HtmlPassBox", server.HtmlPassBox); sql.AddParameter("HtmlLoginBtn", server.HtmlLoginBtn); sql.AddParameter("TabColor", server.TabColor); sql.AddParameter("Notes", server.Notes); sql.AddParameter("SshTerminal", server.SshTerminal); sql.AddParameter("Encryption", server.Encryption); sql.AddParameter("SshKey", server.SshKey); sql.AddParameter("FtpDataType", server.FtpDataType); if (server.ID == 0) { sql.Make(MakeType.INSERT, "Servers"); } else { sql.AddParameter("ID", server.ID); sql.Make(MakeType.UPDATE, "Servers", "id=@ID"); } sql.ExecuteMK(); } Refresh(); }
//************************************************************************************************** public void SaveGroup(Group group) { using (XwDbCommand sql = new XwDbCommand(Config.GetConnectionString(), "Data.SQLite")) { sql.AddParameter("Name", (group.Name == null) ? "New Group" : group.Name); sql.AddParameter("Expanded", group.Expanded); if (group.ID == 0) { sql.Make(MakeType.INSERT, "Groups"); } else { sql.AddParameter("@ID", group.ID); sql.Make(MakeType.UPDATE, "Groups", "id=@ID"); } sql.ExecuteMK(); } Refresh(); }