public override DatabaseSchemaCollection GetDatabases() { DatabaseSchemaCollection databases = new DatabaseSchemaCollection(); using (IPooledDbConnection conn = connectionPool.Request()) { //we don't have to change it back afterwards, since the connectionpool will do this for us conn.DbConnection.ChangeDatabase("master"); using (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); } finally { conn.Release(); } } } return(databases); }
public override DatabaseSchemaCollection GetDatabases () { DatabaseSchemaCollection databases = new DatabaseSchemaCollection (); using (IPooledDbConnection conn = connectionPool.Request ()) { using (IDbCommand command = conn.CreateCommand ("SHOW DATABASES;")) { try { 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); } finally { conn.Release (); } } } return databases; }
public override DatabaseSchemaCollection GetDatabases() { DatabaseSchemaCollection databases = new DatabaseSchemaCollection(); using (IPooledDbConnection conn = connectionPool.Request()) { using (IDbCommand command = conn.CreateCommand("SHOW DATABASES;")) { try { 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); } finally { conn.Release(); } } } return(databases); }
public override DatabaseSchemaCollection GetDatabases() { Console.WriteLine("GetDatabases :D"); DatabaseSchemaCollection databases = new DatabaseSchemaCollection (); using (IPooledDbConnection conn = connectionPool.Request ()) { Console.WriteLine("conn:"+conn.ToString()); MongoDbConnection connection = (MongoDbConnection) conn.DbConnection; Console.WriteLine("connection:"+connection.ToString()); foreach(string dbName in connection.getDatabases()){ DatabaseSchema db = new DatabaseSchema(this); Console.WriteLine("db add:"+dbName); db.Name = dbName; databases.Add(db); } } return databases; }
public override DatabaseSchemaCollection GetDatabases () { DatabaseSchemaCollection databases = new DatabaseSchemaCollection (); using (IPooledDbConnection conn = connectionPool.Request ()) { //we don't have to change it back afterwards, since the connectionpool will do this for us conn.DbConnection.ChangeDatabase ("master"); using (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); } finally { 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; }