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; }
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; }
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); }
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); }
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; }
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; }
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); }
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); }
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); }
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; }