public void SetDatabaseOptions(NpgsqlDatabaseSchema schema)
        {
            TreeIter iter;

            if (comboOwner.GetActiveIter(out iter))
            {
                schema.Owner = (UserSchema)ownersStore.GetValue(iter, 1);
            }
            else if (comboOwner.ActiveText != String.Empty)
            {
                Console.WriteLine("Elegido");
                UserSchema user = new UserSchema(schema.SchemaProvider);
                user.Name = comboOwner.ActiveText;
            }

            if (comboTemplate.GetActiveIter(out iter))
            {
                schema.Template = (DatabaseSchema)templatesStore.GetValue(iter, 1);
            }
            else if (comboTemplate.ActiveText != string.Empty)
            {
                DatabaseSchema db = new DatabaseSchema(schema.SchemaProvider);
                db.Name = comboTemplate.ActiveText;
            }

            if (comboEncoding.GetActiveIter(out iter))
            {
                schema.Encoding = (NpgsqlEncoding)encodingsStore.GetValue(iter, 1);
            }
            else if (comboEncoding.ActiveText != string.Empty)
            {
                NpgsqlEncoding enc = new  NpgsqlEncoding(schema.SchemaProvider);
                enc.Name = comboEncoding.ActiveText;
            }

            if (comboTablespace.GetActiveIter(out iter))
            {
                schema.Tablespace = (NpgsqlTablespace)tablespacesStore.GetValue(iter, 1);
            }
            else if (comboTablespace.ActiveText != string.Empty)
            {
                NpgsqlTablespace ts = new NpgsqlTablespace(schema.SchemaProvider);
                ts.Name = comboTablespace.ActiveText;
            }
        }
		public NpgsqlTablespaceCollection GetTablespaces()
		{
			NpgsqlTablespaceCollection tables = new NpgsqlTablespaceCollection ();
			using (IPooledDbConnection conn = connectionPool.Request ()) {
				using (IDbCommand command = conn.CreateCommand ("select * from pg_tablespace")) {
					using (IDataReader r = command.ExecuteReader()) {
						while (r.Read ()) {
							NpgsqlTablespace ts = new NpgsqlTablespace (this);
							ts.Name = r.GetString (r.GetOrdinal ("spcname"));
							ts.Oid = Convert.ToInt32 (r.GetValue (r.GetOrdinal ("spcowner")));
							tables.Add (ts);
						}
					}
				}
			}
			return tables;
		public void SetDatabaseOptions (NpgsqlDatabaseSchema schema)
		{
			TreeIter iter;
			
			if (comboOwner.GetActiveIter (out iter))
				schema.Owner = (UserSchema)ownersStore.GetValue (iter,1);
			else if (comboOwner.ActiveText != String.Empty) {
				Console.WriteLine ("Elegido");
				UserSchema user = new UserSchema (schema.SchemaProvider);
				user.Name = comboOwner.ActiveText;
			}
			
			if (comboTemplate.GetActiveIter (out iter))
				schema.Template = (DatabaseSchema)templatesStore.GetValue (iter,1);
			else if (comboTemplate.ActiveText != string.Empty) {
				DatabaseSchema db = new DatabaseSchema (schema.SchemaProvider);
				db.Name = comboTemplate.ActiveText;
			}
			
			if (comboEncoding.GetActiveIter (out iter))
				schema.Encoding = (NpgsqlEncoding)encodingsStore.GetValue (iter, 1);
			else if (comboEncoding.ActiveText != string.Empty) {
				NpgsqlEncoding enc = new  NpgsqlEncoding (schema.SchemaProvider);
				enc.Name = comboEncoding.ActiveText;
			}
			
			if (comboTablespace.GetActiveIter (out iter))
				schema.Tablespace = (NpgsqlTablespace)tablespacesStore.GetValue (iter, 1);
			else if (comboTablespace.ActiveText != string.Empty) {
				NpgsqlTablespace ts = new NpgsqlTablespace (schema.SchemaProvider);
				ts.Name = comboTablespace.ActiveText;
			}
		}