public virtual TriggerSchemaCollection GetTableTriggers(TableSchema table)
        {
            TriggerSchemaCollection collection = new TriggerSchemaCollection();

            IPooledDbConnection conn = connectionPool.Request();

            try {
                //restrictions: database, schema, name, EventObjectTable
                DataTable dt = conn.GetSchema(triggersCollectionString, null, table.SchemaName, null, table.Name);
                for (int r = 0; r < dt.Rows.Count; r++)
                {
                    DataRow row = dt.Rows[r];
                    collection.Add(GetTableTrigger(row, table));
                }
            } catch (Exception e) {
                QueryService.RaiseException(e);
            }
            conn.Release();

            return(collection);
        }
        public virtual UserSchemaCollection GetUsers()
        {
            UserSchemaCollection collection = new UserSchemaCollection();

            IPooledDbConnection conn = connectionPool.Request();

            try {
                //restrictions: name
                DataTable dt = conn.GetSchema(usersCollectionString);
                for (int r = 0; r < dt.Rows.Count; r++)
                {
                    DataRow row = dt.Rows[r];
                    collection.Add(GetUser(row));
                }
            } catch (Exception e) {
                QueryService.RaiseException(e);
            }
            conn.Release();

            return(collection);
        }
        public virtual ColumnSchemaCollection GetTableIndexColumns(TableSchema table, IndexSchema index)
        {
            ColumnSchemaCollection collection = new ColumnSchemaCollection();

            IPooledDbConnection conn = connectionPool.Request();

            try {
                //restrictions: database, schema, table, ConstraintName, column
                DataTable dt = conn.GetSchema(indexColumnsCollectionString, null, table.SchemaName, table.Name, index.Name);
                for (int r = 0; r < dt.Rows.Count; r++)
                {
                    DataRow row = dt.Rows[r];
                    collection.Add(GetTableIndexColumn(row, table, index));
                }
            } catch (Exception e) {
                QueryService.RaiseException(e);
            }
            conn.Release();

            return(collection);
        }
        public virtual ConstraintSchemaCollection GetTableConstraints(TableSchema table)
        {
            ConstraintSchemaCollection collection = new ConstraintSchemaCollection();

            IPooledDbConnection conn = connectionPool.Request();

            try {
                //restrictions: database, schema, table, name
                DataTable dt = conn.GetSchema(foreignKeysCollectionString, null, connectionPool.ConnectionContext.ConnectionSettings.Database);
                for (int r = 0; r < dt.Rows.Count; r++)
                {
                    DataRow row = dt.Rows[r];
                    collection.Add(GetTableConstraint(row, table));
                }
            } catch (Exception e) {
                QueryService.RaiseException(e);
            }
            conn.Release();

            return(collection);
        }
        public virtual ParameterSchemaCollection GetProcedureParameters(ProcedureSchema procedure)
        {
            ParameterSchemaCollection collection = new ParameterSchemaCollection();

            IPooledDbConnection conn = connectionPool.Request();

            try {
                //restrictions: database, schema, name, type, parameter
                DataTable dt = conn.GetSchema(procedureParametersCollectionString, null, procedure.SchemaName, procedure.Name);
                for (int r = 0; r < dt.Rows.Count; r++)
                {
                    DataRow row = dt.Rows[r];
                    collection.Add(GetProcedureParameter(row, procedure));
                }
            } catch (Exception e) {
                QueryService.RaiseException(e);
            }
            conn.Release();

            return(collection);
        }
        public virtual ProcedureSchemaCollection GetProcedures()
        {
            ProcedureSchemaCollection collection = new ProcedureSchemaCollection();

            IPooledDbConnection conn = connectionPool.Request();

            try {
                //restrictions: database, schema, name, type
                DataTable dt = conn.GetSchema(proceduresCollectionString, null, connectionPool.ConnectionContext.ConnectionSettings.Database);
                for (int r = 0; r < dt.Rows.Count; r++)
                {
                    DataRow row = dt.Rows[r];
                    collection.Add(GetProcedure(row));
                }
            } catch (Exception e) {
                QueryService.RaiseException(e);
            }
            conn.Release();

            return(collection);
        }
Exemple #7
0
        public virtual TableSchemaCollection GetTables()
        {
            TableSchemaCollection collection = new TableSchemaCollection();

            IPooledDbConnection conn = connectionPool.Request();

            try {
                //restrictions: database, schema, table, table type
                DataTable dt = conn.GetSchema(tablesCollectionString, null, connectionPool.ConnectionContext.ConnectionSettings.Database);
                for (int r = 0; r < dt.Rows.Count; r++)
                {
                    DataRow row = dt.Rows[r];
                    collection.Add(GetTable(row));
                }
            } catch (Exception e) {
                // Don't raise error, if the triggers doesn't exists return an empty collection
            }
            conn.Release();

            return(collection);
        }
        public virtual DataTypeSchema GetDataType(string name)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }

            DataTypeSchema      schema = null;
            IPooledDbConnection conn   = connectionPool.Request();

            try {
                //restrictions: name
                DataTable dt = conn.GetSchema(dataTypesCollectionString, name);
                if (dt.Rows.Count > 0)
                {
                    schema = GetDataType(dt.Rows[0]);
                }
            } catch (Exception e) {
                QueryService.RaiseException(e);
            }
            conn.Release();

            return(schema);
        }