Ejemplo n.º 1
0
 public NpgsqlEncoding(NpgsqlEncoding encoding) : base(encoding)
 {
     this.Name        = encoding.Name;
     this.Aliases     = encoding.Aliases;
     this.BytesChar   = encoding.BytesChar;
     this.Description = encoding.Description;
     this.Language    = encoding.Language;
     this.Server      = encoding.Server;
 }
        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;
            }
        }
Ejemplo n.º 3
0
		public NpgsqlEncodingCollection GetEncodings ()
		{
			NpgsqlEncodingCollection coll = new NpgsqlEncodingCollection ();
			using (System.IO.Stream stream = Assembly.GetExecutingAssembly ().GetManifestResourceStream ("Encoding.xml")) {
				XmlDocument doc = new XmlDocument ();
				doc.Load (stream);
				var encodings = doc.GetElementsByTagName ("Encoding");
				foreach (var enc in encodings) {
					NpgsqlEncoding newEnc = new NpgsqlEncoding (this);
					newEnc.Server = Convert.ToBoolean (((XmlNode)enc).Attributes["Server"].Value);
					newEnc.Name = ((XmlNode)enc).ChildNodes[0].InnerText;
					newEnc.Description = ((XmlNode)enc).ChildNodes[1].InnerText;
					newEnc.Language = ((XmlNode)enc).ChildNodes[2].InnerText;
					newEnc.BytesChar = ((XmlNode)enc).ChildNodes[3].InnerText;
					newEnc.Aliases = ((XmlNode)enc).ChildNodes[4].InnerText;
					coll.Add (newEnc);
				}
					
				// This doesn't work until this bug isn't fixed 
				// 
//				XmlTextReader reader = new XmlTextReader (stream);
//				XDocument encodingsDoc = XDocument.Load (reader, LoadOptions.None);
//				
//				var encodings = from enc in encodingsDoc.Descendants ("Encodings")
//					select new {
//						IsServer = Convert.ToBoolean(enc.Attribute("Server").Value),
//						Name = enc.Element("Name").Value,
//						Description = enc.Element("Description").Value,
//						Language = enc.Element("Language").Value,
//						BytesChar = enc.Element("BytesChar").Value,
//						Aliases = enc.Element("Aliases").Value
//					};
//				
//				foreach (var enc in encodings) {
//					NpgsqlEncoding newEnc = new NpgsqlEncoding (this);
//					newEnc.Server = enc.IsServer;
//					newEnc.Name = enc.Name;
//					newEnc.Description = enc.Description;
//					newEnc.Language = enc.Language;
//					newEnc.BytesChar = enc.BytesChar;
//					newEnc.Aliases = enc.Aliases;
//					coll.Add (newEnc);
//				}
			}
			return coll;
Ejemplo n.º 4
0
		public NpgsqlEncoding (NpgsqlEncoding encoding):base(encoding)
		{
			this.Name = encoding.Name;
			this.Aliases = encoding.Aliases;
			this.BytesChar = encoding.BytesChar;
			this.Description = encoding.Description;
			this.Language = encoding.Language;
			this.Server = encoding.Server;
			
		}
		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;
			}
		}