Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        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;
            }
        }
Exemple #4
0
        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);
        }
Exemple #5
0
        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);
        }