Пример #1
0
        /// <summary>
        /// Get all the stored procedures (owner required for Oracle- otherwise null).
        /// </summary>
        /// <param name="connection">The connection.</param>
        /// <returns></returns>
        protected virtual DataTable StoredProcedures(DbConnection connection)
        {
            string collectionName = ProceduresCollectionName;

            if (!SchemaCollectionExists(connection, collectionName))
            {
                return(CreateDataTable(collectionName));
            }
            string[] restrictions = SchemaRestrictions.ForOwner(connection, collectionName);
            return(connection.GetSchema(collectionName, restrictions));
        }
Пример #2
0
        /// <summary>
        /// DataTable of all tables for a specific owner
        /// </summary>
        public DataTable Tables()
        {
            string collectionName = TablesCollectionName;

            using (DbConnection conn = Factory.CreateConnection())
            {
                conn.ConnectionString = ConnectionString;
                conn.Open();
                string[] restrictions = SchemaRestrictions.ForOwner(conn, collectionName);
                return(conn.GetSchema(collectionName, restrictions));
            }
        }
Пример #3
0
        /// <summary>
        /// DataTable of all tables for a specific owner
        /// </summary>
        /// <param name="tableName">Name of the table.</param>
        /// <returns></returns>
        public DataTable Tables(string tableName)
        {
            string collectionName = TablesCollectionName;

            using (DbConnection conn = Factory.CreateConnection())
            {
                conn.ConnectionString = ConnectionString;
                conn.Open();
                var restrictions = string.IsNullOrEmpty(tableName) ?
                                   SchemaRestrictions.ForOwner(conn, collectionName) :
                                   SchemaRestrictions.ForTable(conn, TablesCollectionName, tableName);
                return(conn.GetSchema(collectionName, restrictions));
            }
        }
Пример #4
0
 /// <summary>
 /// Get all the packages (Oracle only concept- returns empty DataTable for others)
 /// </summary>
 public DataTable Packages()
 {
     using (DbConnection conn = Factory.CreateConnection())
     {
         conn.ConnectionString = ConnectionString;
         conn.Open();
         string collectionName = PackagesCollectionName;
         if (!SchemaCollectionExists(conn, collectionName))
         {
             return(CreateDataTable(collectionName));
         }
         string[] restrictions = SchemaRestrictions.ForOwner(conn, collectionName);
         return(conn.GetSchema(collectionName, restrictions));
     }
 }
Пример #5
0
        /// <summary>
        /// Gets the sequences (if supported, eg Oracle)
        /// </summary>
        /// <param name="connection">The connection.</param>
        /// <returns></returns>
        protected virtual DataTable Sequences(DbConnection connection)
        {
            string collectionName = SequencesCollectionName;

            if (!SchemaCollectionExists(connection, collectionName))
            {
                collectionName = "Generators"; //Firebird calls sequences "Generators"
            }
            if (!SchemaCollectionExists(connection, collectionName))
            {
                return(CreateDataTable(SequencesCollectionName));
            }
            string[] restrictions = SchemaRestrictions.ForOwner(connection, collectionName);
            var      dt           = connection.GetSchema(collectionName, restrictions);

            dt.TableName = SequencesCollectionName;
            return(dt);
        }
Пример #6
0
 /// <summary>
 /// DataTable of all tables for a specific owner
 /// </summary>
 /// <returns>Datatable with columns OWNER, TABLE_NAME, TYPE</returns>
 public DataTable Views()
 {
     using (DbConnection conn = Factory.CreateConnection())
     {
         conn.ConnectionString = ConnectionString;
         conn.Open();
         string collectionName = ViewsCollectionName;
         if (!SchemaCollectionExists(conn, collectionName))
         {
             collectionName = TablesCollectionName;
         }
         if (!SchemaCollectionExists(conn, collectionName))
         {
             return(CreateDataTable(collectionName)); //doesn't exist in SqlServerCe
         }
         string[] restrictions = SchemaRestrictions.ForOwner(conn, collectionName);
         return(conn.GetSchema(collectionName, restrictions));
     }
 }