Пример #1
0
        protected internal TableCollection GetTables(Database database)
        {
            TableCollection tables = new TableCollection();
            DataAccessProviderFactory dataAccessProviderFactory = new DataAccessProviderFactory(Server.ProviderType);
            IDbConnection connection = dataAccessProviderFactory.CreateConnection(Server.ConnectionString);
            if(connection.State == ConnectionState.Closed)
            {
                connection.Open();
            }
            connection.ChangeDatabase(database.Name);
            DataSet ds;
            if (Server.ProviderType != DataProviderType.Oracle)
            {
                connection.ChangeDatabase(database.Name);
                ds = TableSchema(dataAccessProviderFactory, connection);
            }
            else
            {
                ds = TableSchema(dataAccessProviderFactory, connection, database);
            }

            connection.Close();

            /* Changed by Ferhat */
            if (ds.Tables.Count > 0)
            {
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    tables.Add(CreateTable(database, row));
                }
            }
            return tables;
        }
Пример #2
0
		/* Add by Ferhat */
		protected internal TableCollection GetViews(Database database)
		{
			var tables = new TableCollection();
			var dataAccessProviderFactory = new DataAccessProviderFactory(Server.ProviderType);
			var connection = dataAccessProviderFactory.CreateConnection(Server.ConnectionString);
			if (connection.State == ConnectionState.Closed)
			{
				connection.Open();
			}
			connection.ChangeDatabase(database.Name);
			var ds = ViewSchema(dataAccessProviderFactory, connection);
			connection.Close();
			if (ds.Tables.Count > 0)
			{
				foreach (DataRow row in ds.Tables[0].Rows)
				{
					tables.Add(CreateTable(database, row));
				}
			}
			return tables;
		}