コード例 #1
0
ファイル: SqlMetaData.cs プロジェクト: emtees/old-code
		public MetaViewCollection GetViews (bool includeSystem) 
		{
			if (con.State != ConnectionState.Open)
				con.Open();

			MetaViewCollection views = new MetaViewCollection ();

			string where = "'V'";

			string sql = 
				"SELECT su.name AS owner, so.name as table_name, so.id as table_id, " +
				" so.crdate as created_date, so.xtype as table_type " +
				"FROM dbo.sysobjects so, dbo.sysusers su " +
				"WHERE xtype IN (" + where + ") " +
				"AND su.uid = so.uid " +
				"ORDER BY 1, 2";

			IDbCommand cmd = con.CreateCommand ();
			cmd.CommandText = sql;

			IDataReader reader = cmd.ExecuteReader ();
			while (reader.Read ()) {
				MetaView view = new MetaView (reader.GetString (0),
					reader.GetString (1));
				views.Add (view);
			}
			reader.Close ();
			reader = null;

			return views;
		}
コード例 #2
0
ファイル: OracleMetaData.cs プロジェクト: emtees/old-code
		public MetaViewCollection GetViews (bool includeSystem) 
		{
			if (con.State != ConnectionState.Open)
				con.Open();

			MetaViewCollection views = new MetaViewCollection ();

			string where = "";
			if (includeSystem == true)
				where = "";
			else
				where = "WHERE OWNER NOT IN ('SYS','SYSTEM','MDSYS','CTXSYS','WMSYS','WKSYS')";

			string sql = "SELECT OWNER, VIEW_NAME " +
				"FROM ALL_VIEWS " +
				where +
				" ORDER BY 1, 2";

			IDbCommand cmd = con.CreateCommand ();
			cmd.CommandText = sql;

			IDataReader reader = cmd.ExecuteReader ();
			while (reader.Read ()) {
				MetaView view = new MetaView (reader.GetString (0),
					reader.GetString (1));
				views.Add (view);
			}
			reader.Close ();
			reader = null;
			
			return views;
		}
コード例 #3
0
        public MetaViewCollection GetViews(bool includeSystem)
        {
            if (con.State != ConnectionState.Open)
            {
                con.Open();
            }

            MetaViewCollection views = new MetaViewCollection();

            string sql =
                "select schemaname, viewname " +
                "from pg_views";

            sql = sql + " ORDER BY 1,2";

            IDbCommand cmd = con.CreateCommand();

            cmd.CommandText = sql;

            IDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                MetaView view = new MetaView(reader.GetString(0), reader.GetString(1));
                views.Add(view);
            }
            reader.Close();
            reader = null;

            return(views);
        }
コード例 #4
0
ファイル: SybaseMetaData.cs プロジェクト: retahc/old-code
        public MetaViewCollection GetViews(bool includeSystem)
        {
            if (con.State != ConnectionState.Open)
            {
                con.Open();
            }

            MetaViewCollection views = new MetaViewCollection();

            string sql =
                "SELECT su.name AS owner, so.name as table_name, so.id as table_id, " +
                " so.crdate as created_date, so.type as table_type " +
                "FROM dbo.sysobjects so, dbo.sysusers su " +
                "WHERE type = 'V' " +
                "AND su.uid = so.uid " +
                "ORDER BY 1, 2";

            IDbCommand cmd = con.CreateCommand();

            cmd.CommandText = sql;

            IDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                MetaView view = new MetaView(reader.GetString(0),
                                             reader.GetString(1));
                views.Add(view);
            }
            reader.Close();
            reader = null;

            return(views);
        }
コード例 #5
0
ファイル: PostgreSqlMetaData.cs プロジェクト: emtees/old-code
		public MetaViewCollection GetViews (bool includeSystem) 
		{
			if (con.State != ConnectionState.Open)
				con.Open ();

			MetaViewCollection views = new MetaViewCollection ();

			string sql = 
				"select schemaname, viewname " +
				"from pg_views";

			sql = sql + " ORDER BY 1,2";

			IDbCommand cmd = con.CreateCommand ();
			cmd.CommandText = sql;

			IDataReader reader = cmd.ExecuteReader ();
			while (reader.Read ()) {
				MetaView view = new MetaView (reader.GetString (0), reader.GetString (1));
				views.Add (view);
			}
			reader.Close ();
			reader = null;
			
			return views;
		}
コード例 #6
0
ファイル: MySqlMetaData.cs プロジェクト: emtees/old-code
		public MetaViewCollection GetViews (bool includeSystem) 
		{
			if(con.State != ConnectionState.Open)
				con.Open();

			MetaViewCollection views = new MetaViewCollection ();

			if (!infoSchemaExists)
				return views;

			string sql = "select table_schema, table_name, " +
					" view_definition from INFORMATION_SCHEMA.VIEWS;";

			IDbCommand cmd = con.CreateCommand ();
			cmd.CommandText = sql;

			IDataReader reader = cmd.ExecuteReader ();
			while (reader.Read ()) {
				MetaView view = new MetaView (reader.GetString (0),
					reader.GetString (1));
				views.Add (view);
			}
			reader.Close ();
			reader = null;
			
			return views;


		}
コード例 #7
0
        public MetaViewCollection GetViews(bool includeSystem)
        {
            if (con.State != ConnectionState.Open)
            {
                con.Open();
            }

            MetaViewCollection views = new MetaViewCollection();

            if (!infoSchemaExists)
            {
                return(views);
            }

            string sql = "select table_schema, table_name, " +
                         " view_definition from INFORMATION_SCHEMA.VIEWS;";

            IDbCommand cmd = con.CreateCommand();

            cmd.CommandText = sql;

            IDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                MetaView view = new MetaView(reader.GetString(0),
                                             reader.GetString(1));
                views.Add(view);
            }
            reader.Close();
            reader = null;

            return(views);
        }
コード例 #8
0
ファイル: OracleMetaData.cs プロジェクト: retahc/old-code
        public MetaViewCollection GetViews(bool includeSystem)
        {
            if (con.State != ConnectionState.Open)
            {
                con.Open();
            }

            MetaViewCollection views = new MetaViewCollection();

            string where = "";
            if (includeSystem == true)
            {
                where = "";
            }
            else
            {
                where = "WHERE OWNER NOT IN ('SYS','SYSTEM','MDSYS','CTXSYS','WMSYS','WKSYS')";
            }

            string sql = "SELECT OWNER, VIEW_NAME " +
                         "FROM ALL_VIEWS " +
                         where +
                         " ORDER BY 1, 2";

            IDbCommand cmd = con.CreateCommand();

            cmd.CommandText = sql;

            IDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                MetaView view = new MetaView(reader.GetString(0),
                                             reader.GetString(1));
                views.Add(view);
            }
            reader.Close();
            reader = null;

            return(views);
        }
コード例 #9
0
        public MetaViewCollection GetViews(bool includeSystem)
        {
            if (con.State != ConnectionState.Open)
            {
                con.Open();
            }

            MetaViewCollection views = new MetaViewCollection();

            DataTable table2 = GetSchema("Views", new string[] { null, null, null });

            for (int r = 0; r < table2.Rows.Count; r++)
            {
                DataRow  row2     = table2.Rows[r];
                string   viewName = row2["VIEW_NAME"].ToString();
                MetaView view     = new MetaView(viewName);
                views.Add(view);
            }

            return(views);
        }
コード例 #10
0
ファイル: FirebirdMetaData.cs プロジェクト: emtees/old-code
		public MetaViewCollection GetViews (bool includeSystem) 
		{
			if (con.State != ConnectionState.Open)
				con.Open();

			MetaViewCollection views = new MetaViewCollection ();

			DataTable table2 = GetSchema ("Views", new string[] {null, null, null});
			for (int r = 0; r < table2.Rows.Count; r++) {
				DataRow row2 = table2.Rows[r];
				string viewName = row2["VIEW_NAME"].ToString();
				MetaView view = new MetaView (viewName);
				views.Add (view);
			}

			return views;
		}