ApplyUpdateIfNotFound() публичный Метод

public ApplyUpdateIfNotFound ( string testQuery, string updateStatement, bool bIgnore ) : DatabaseUpdateResponse
testQuery string
updateStatement string
bIgnore bool
Результат DatabaseUpdateResponse
		public ActionResult CalendarDatabase() {
			List<string> lst = new List<string>();

			DatabaseUpdate du = new DatabaseUpdate();
			DatabaseUpdateResponse dbRes = new DatabaseUpdateResponse();

			string sqlUpdate = String.Empty;
			string sqlTest = String.Empty;

			try {
				sqlUpdate = WebHelper.ReadEmbededScript("CarrotCake.CMS.Plugins.CalendarModule.tblCalendar.sql");

				sqlTest = "select * from [INFORMATION_SCHEMA].[COLUMNS] where table_name in('tblCalendar')";
				dbRes = du.ApplyUpdateIfNotFound(sqlTest, sqlUpdate, false);

				if (dbRes.LastException != null && !string.IsNullOrEmpty(dbRes.LastException.Message)) {
					lst.Add(dbRes.LastException.Message);
				} else {
					lst.Add(dbRes.Response);
				}
			} catch (Exception ex) {
				lst.Add(ex.ToString());
			}

			return View(lst);
		}
		protected void Page_Load(object sender, EventArgs e) {
			DatabaseUpdate du = new DatabaseUpdate();
			DatabaseUpdateResponse dbRes = new DatabaseUpdateResponse();
			string sqlUpdate = "";
			string sqlTest = "";
			int iCt = 0;
			litMsg.Text = "";

			sqlUpdate = ReadEmbededScript("Carrotware.CMS.UI.Plugins.EventCalendarModule.carrot_CalendarEvent.sql");
			sqlTest = "select * from information_schema.columns where table_name = 'carrot_CalendarEventProfile' and column_name = 'RecursEvery'";
			dbRes = du.ApplyUpdateIfNotFound(sqlTest, sqlUpdate, false);
			iCt++;

			if (dbRes.LastException != null && !string.IsNullOrEmpty(dbRes.LastException.Message)) {
				litMsg.Text += iCt.ToString() + ")  " + dbRes.LastException.Message + "<br />";
			} else {
				litMsg.Text += iCt.ToString() + ")  " + dbRes.Response + "<br />";
			}
		}
        protected void Page_Load(object sender, EventArgs e)
        {
            DatabaseUpdate du = new DatabaseUpdate();
            DatabaseUpdateResponse dbRes = new DatabaseUpdateResponse();
            string sqlUpdate = "";
            string sqlTest = "";
            int iCt = 0;
            litMsg.Text = "";

            sqlUpdate = ReadEmbededScript("Carrotware.CMS.UI.Plugins.FAQ2Module.carrot_FaqItem.sql");
            sqlTest = "select * from [INFORMATION_SCHEMA].[COLUMNS] where table_name in('carrot_FaqItem')";
            dbRes = du.ApplyUpdateIfNotFound(sqlTest, sqlUpdate, false);
            iCt++;

            if (dbRes.LastException != null && !string.IsNullOrEmpty(dbRes.LastException.Message)) {
                litMsg.Text += iCt.ToString() + ")  " + dbRes.LastException.Message + "<br />";
            } else {
                litMsg.Text += iCt.ToString() + ")  " + dbRes.Response + "<br />";
            }
        }
		protected void Page_Load(object sender, EventArgs e) {
			DatabaseUpdate du = new DatabaseUpdate();
			DatabaseUpdateResponse dbRes = new DatabaseUpdateResponse();
			string sqlUpdate = "";
			string sqlTest = "";
			int iCt = 0;
			litMsg.Text = "";

			sqlUpdate = ReadEmbededScript("Carrotware.CMS.UI.Plugins.PhotoGallery.tblGallery.sql");

			sqlTest = "select * from [information_schema].[columns] where table_name in('tblGalleryImageMeta')";
			dbRes = du.ApplyUpdateIfNotFound(sqlTest, sqlUpdate, false);
			iCt++;

			if (dbRes.LastException != null && !string.IsNullOrEmpty(dbRes.LastException.Message)) {
				litMsg.Text += iCt.ToString() + ")  " + dbRes.LastException.Message + "<br />";
			} else {
				litMsg.Text += iCt.ToString() + ")  " + dbRes.Response + "<br />";
			}

		}
Пример #5
0
        public ActionResult GalleryDatabase()
        {
            List<string> lst = new List<string>();

            DatabaseUpdate du = new DatabaseUpdate();
            DatabaseUpdateResponse dbRes = new DatabaseUpdateResponse();
            string sqlUpdate = "";
            string sqlTest = "";
            try {
                sqlUpdate = GalleryHelper.ReadEmbededScript("CarrotCake.CMS.Plugins.PhotoGallery.tblGallery.sql");

                sqlTest = "select * from [information_schema].[columns] where table_name in('tblGalleryImageMeta')";
                dbRes = du.ApplyUpdateIfNotFound(sqlTest, sqlUpdate, false);

                if (dbRes.LastException != null && !string.IsNullOrEmpty(dbRes.LastException.Message)) {
                    lst.Add(dbRes.LastException.Message);
                } else {
                    lst.Add(dbRes.Response);
                }
            } catch (Exception ex) {
                lst.Add(ex.ToString());
            }

            return View(lst);
        }