public override DatabaseSchemaCollection GetDatabases() { DatabaseSchemaCollection databases = new DatabaseSchemaCollection(); IPooledDbConnection conn = connectionPool.Request(); conn.DbConnection.ChangeDatabase("master"); //we don't have to change it back afterwards, since the connectionpool will do this for us IDbCommand command = conn.CreateCommand("select name from sysdatabases"); try { using (command) { using (IDataReader r = command.ExecuteReader()) { while (r.Read()) { DatabaseSchema db = new DatabaseSchema(this); db.Name = r.GetString(0); databases.Add(db); } r.Close(); } } } catch (Exception e) { QueryService.RaiseException(e); } conn.Release(); return(databases); }
public override DatabaseSchemaCollection GetDatabases() { DatabaseSchemaCollection databases = new DatabaseSchemaCollection(); IPooledDbConnection conn = connectionPool.Request(); IDbCommand command = conn.CreateCommand("SHOW DATABASES;"); try { using (command) { using (IDataReader r = command.ExecuteReader()) { while (r.Read()) { DatabaseSchema db = new DatabaseSchema(this); db.Name = r.GetString(0); databases.Add(db); } r.Close(); } } } catch (Exception e) { QueryService.RaiseException(e); } conn.Release(); return(databases); }
public virtual DatabaseSchemaCollection GetDatabases() { DatabaseSchemaCollection collection = new DatabaseSchemaCollection(); IPooledDbConnection conn = connectionPool.Request(); try { //restrictions: name DataTable dt = conn.GetSchema(databasesCollectionString); for (int r = 0; r < dt.Rows.Count; r++) { DataRow row = dt.Rows[r]; collection.Add(GetDatabase(row)); } } catch (Exception e) { QueryService.RaiseException(e); } conn.Release(); return(collection); }
public DatabaseSchemaCollection(DatabaseSchemaCollection collection) : base(collection, true) { }