private void SetViewExists(string name, IGNQueriable queriable, ExistsEnum existsFunc) { var checkQuery = $"SELECT * FROM `INFORMATION_SCHEMA`.`VIEWS` WHERE `TABLE_SCHEMA` = database() AND `TABLE_NAME` = '{name}'"; var query = IGNQueriable.FromQueryString(checkQuery, this.email, this); var result = ReadDataWithParameters(query, new List <IGNParameterValue>()); IGNQueriable.SetExists(result.Rows.Count > 0, queriable); IGNQueriable.SetCanExecute(existsFunc, queriable); }
private void SetStoresProcedureExists(string name, IGNQueriable queriable, ExistsEnum existsFunc) { var checkQuery = $"SELECT * FROM [INFORMATION_SCHEMA].[ROUTINES] WHERE [ROUTINE_NAME] = '{name}'"; var query = IGNQueriable.FromQueryString(checkQuery, this.email, this); var result = ReadDataWithParameters(query, new List <IGNParameterValue>()); IGNQueriable.SetExists(result.Rows.Count > 0, queriable); IGNQueriable.SetCanExecute(existsFunc, queriable); }
public static void SetCanExecute(ExistsEnum existsFunc, IGNQueriable queriable) { switch (existsFunc) { case ExistsEnum.Exists: queriable.canExecute = queriable.exists; break; case ExistsEnum.NotExists: queriable.canExecute = !queriable.exists; break; default: queriable.canExecute = true; break; } }
private void SetColumnExists(string name, string table, IGNQueriable queriable, ExistsEnum existsFunc) { var checkQuery = $"SELECT * FROM [INFORMATION_SCHEMA].[COLUMNS] WHERE [TABLE_CATALOG] = DB_NAME() AND [TABLE_NAME] = '{table}' AND [COLUMN_NAME] = '{name}'"; var query = IGNQueriable.FromQueryString(checkQuery, this.email, this); var result = ReadDataWithParameters(query, new List <IGNParameterValue>()); IGNQueriable.SetExists(result.Rows.Count > 0, queriable); IGNQueriable.SetCanExecute(existsFunc, queriable); }
private void SetIndexExists(string name, string table, IGNQueriable queriable, ExistsEnum existsFunc) { var checkQuery = $"SELECT * FROM sysindexes WHERE name='{name}'"; var query = IGNQueriable.FromQueryString(checkQuery, this.email, this); var result = ReadDataWithParameters(query, new List <IGNParameterValue>()); IGNQueriable.SetExists(result.Rows.Count > 0, queriable); IGNQueriable.SetCanExecute(existsFunc, queriable); }