aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorSean Dague2008-05-02 19:39:27 +0000
committerSean Dague2008-05-02 19:39:27 +0000
commit17496f3edfd208378f781b3d65ec888ff3ca56a8 (patch)
treee427581450189109f4848d8e5f6e20a7ca8ecef0
parentmove it out of the Types namespace (diff)
downloadopensim-SC-17496f3edfd208378f781b3d65ec888ff3ca56a8.zip
opensim-SC-17496f3edfd208378f781b3d65ec888ff3ca56a8.tar.gz
opensim-SC-17496f3edfd208378f781b3d65ec888ff3ca56a8.tar.bz2
opensim-SC-17496f3edfd208378f781b3d65ec888ff3ca56a8.tar.xz
in theory fix the user table mapping
-rw-r--r--OpenSim/Data/NHibernate/NHibernateUserData.cs22
-rw-r--r--OpenSim/Data/NHibernate/Resources/UserAppearance.hbm.xml4
2 files changed, 24 insertions, 2 deletions
diff --git a/OpenSim/Data/NHibernate/NHibernateUserData.cs b/OpenSim/Data/NHibernate/NHibernateUserData.cs
index 87594db..8983753 100644
--- a/OpenSim/Data/NHibernate/NHibernateUserData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateUserData.cs
@@ -29,12 +29,14 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO; 30using System.IO;
31using System.Reflection; 31using System.Reflection;
32using System.Text.RegularExpressions;
32using libsecondlife; 33using libsecondlife;
33using log4net; 34using log4net;
34using NHibernate; 35using NHibernate;
35using NHibernate.Cfg; 36using NHibernate.Cfg;
36using NHibernate.Expression; 37using NHibernate.Expression;
37using NHibernate.Mapping.Attributes; 38using NHibernate.Mapping.Attributes;
39using NHibernate.Tool.hbm2ddl;
38using OpenSim.Framework; 40using OpenSim.Framework;
39using Environment=NHibernate.Cfg.Environment; 41using Environment=NHibernate.Cfg.Environment;
40 42
@@ -78,6 +80,26 @@ namespace OpenSim.Data.NHibernate
78 // new SchemaExport(cfg).Create(true, true); 80 // new SchemaExport(cfg).Create(true, true);
79 81
80 factory = cfg.BuildSessionFactory(); 82 factory = cfg.BuildSessionFactory();
83 InitDB();
84 }
85
86 private void InitDB()
87 {
88 string regex = @"no such table: Users";
89 Regex RE = new Regex(regex, RegexOptions.Multiline);
90 try {
91 using(ISession session = factory.OpenSession()) {
92 session.Load(typeof(InventoryItemBase), LLUUID.Zero);
93 }
94 } catch (ObjectNotFoundException e) {
95 // yes, we know it's not there, but that's ok
96 } catch (ADOException e) {
97 Match m = RE.Match(e.ToString());
98 if(m.Success) {
99 // We don't have this table, so create it.
100 new SchemaExport(cfg).Create(true, true);
101 }
102 }
81 } 103 }
82 104
83 private bool ExistsUser(LLUUID uuid) 105 private bool ExistsUser(LLUUID uuid)
diff --git a/OpenSim/Data/NHibernate/Resources/UserAppearance.hbm.xml b/OpenSim/Data/NHibernate/Resources/UserAppearance.hbm.xml
index ffb2199..0eabf0e 100644
--- a/OpenSim/Data/NHibernate/Resources/UserAppearance.hbm.xml
+++ b/OpenSim/Data/NHibernate/Resources/UserAppearance.hbm.xml
@@ -30,8 +30,8 @@
30 <property name="UnderPantsAsset" type="OpenSim.Data.NHibernate.LLUUIDUserType, OpenSim.Data.NHibernate" /> 30 <property name="UnderPantsAsset" type="OpenSim.Data.NHibernate.LLUUIDUserType, OpenSim.Data.NHibernate" />
31 <property name="SkirtItem" type="OpenSim.Data.NHibernate.LLUUIDUserType, OpenSim.Data.NHibernate" /> 31 <property name="SkirtItem" type="OpenSim.Data.NHibernate.LLUUIDUserType, OpenSim.Data.NHibernate" />
32 <property name="SkirtAsset" type="OpenSim.Data.NHibernate.LLUUIDUserType, OpenSim.Data.NHibernate" /> 32 <property name="SkirtAsset" type="OpenSim.Data.NHibernate.LLUUIDUserType, OpenSim.Data.NHibernate" />
33 <property name="Texture" type="byte[]" /> 33 <property name="Texture" type="binary" />
34 <property name="VisualParams" type="byte[]" /> 34 <property name="VisualParams" type="binary" />
35 <property name="Serial" type="int" /> 35 <property name="Serial" type="int" />
36 </class> 36 </class>
37</hibernate-mapping> \ No newline at end of file 37</hibernate-mapping> \ No newline at end of file