diff options
author | Sean Dague | 2008-05-02 18:59:12 +0000 |
---|---|---|
committer | Sean Dague | 2008-05-02 18:59:12 +0000 |
commit | 1b7f1c956c86458bc0cee341ea95ee593be76703 (patch) | |
tree | ba16a52f1020567f61d8da08dd5b6e4c99697aa5 /OpenSim/Data/NHibernate/NHibernateUserData.cs | |
parent | added user appearance mapping in nhibernate (diff) | |
download | opensim-SC-1b7f1c956c86458bc0cee341ea95ee593be76703.zip opensim-SC-1b7f1c956c86458bc0cee341ea95ee593be76703.tar.gz opensim-SC-1b7f1c956c86458bc0cee341ea95ee593be76703.tar.bz2 opensim-SC-1b7f1c956c86458bc0cee341ea95ee593be76703.tar.xz |
plumb in connection string to the user database paths. mysql and mssql
just ignore this for now, but it lets us get connect strings to sqlite
and nhibernate.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/NHibernate/NHibernateUserData.cs | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/OpenSim/Data/NHibernate/NHibernateUserData.cs b/OpenSim/Data/NHibernate/NHibernateUserData.cs index 2e55e03..6a830f6 100644 --- a/OpenSim/Data/NHibernate/NHibernateUserData.cs +++ b/OpenSim/Data/NHibernate/NHibernateUserData.cs | |||
@@ -25,6 +25,7 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | ||
28 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
29 | using System.IO; | 30 | using System.IO; |
30 | using System.Reflection; | 31 | using System.Reflection; |
@@ -35,6 +36,7 @@ using NHibernate.Cfg; | |||
35 | using NHibernate.Expression; | 36 | using NHibernate.Expression; |
36 | using NHibernate.Mapping.Attributes; | 37 | using NHibernate.Mapping.Attributes; |
37 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
39 | using Environment=NHibernate.Cfg.Environment; | ||
38 | 40 | ||
39 | namespace OpenSim.Data.NHibernate | 41 | namespace OpenSim.Data.NHibernate |
40 | { | 42 | { |
@@ -48,20 +50,24 @@ namespace OpenSim.Data.NHibernate | |||
48 | private Configuration cfg; | 50 | private Configuration cfg; |
49 | private ISessionFactory factory; | 51 | private ISessionFactory factory; |
50 | 52 | ||
51 | public override void Initialise() | 53 | public override void Initialise(string connect) |
52 | { | 54 | { |
53 | // TODO: hard coding for sqlite based stuff to begin with, just making it easier to test | 55 | char[] split = {';'}; |
56 | string[] parts = connect.Split(split, 3); | ||
57 | if (parts.Length != 3) { | ||
58 | // TODO: make this a real exception type | ||
59 | throw new Exception("Malformed Inventory connection string '" + connect + "'"); | ||
60 | } | ||
54 | 61 | ||
55 | // This is stubbing for now, it will become dynamic later and support different db backends | 62 | // This is stubbing for now, it will become dynamic later and support different db backends |
56 | cfg = new Configuration(); | 63 | cfg = new Configuration(); |
57 | cfg.SetProperty(Environment.ConnectionProvider, | 64 | cfg.SetProperty(Environment.ConnectionProvider, |
58 | "NHibernate.Connection.DriverConnectionProvider"); | 65 | "NHibernate.Connection.DriverConnectionProvider"); |
59 | cfg.SetProperty(Environment.Dialect, | 66 | cfg.SetProperty(Environment.Dialect, |
60 | "NHibernate.Dialect.SQLiteDialect"); | 67 | "NHibernate.Dialect." + parts[0]); |
61 | cfg.SetProperty(Environment.ConnectionDriver, | 68 | cfg.SetProperty(Environment.ConnectionDriver, |
62 | "NHibernate.Driver.SqliteClientDriver"); | 69 | "NHibernate.Driver." + parts[1]); |
63 | cfg.SetProperty(Environment.ConnectionString, | 70 | cfg.SetProperty(Environment.ConnectionString, parts[2]); |
64 | "URI=file:User.db,version=3"); | ||
65 | cfg.AddAssembly("OpenSim.Data.NHibernate"); | 71 | cfg.AddAssembly("OpenSim.Data.NHibernate"); |
66 | 72 | ||
67 | HbmSerializer.Default.Validate = true; | 73 | HbmSerializer.Default.Validate = true; |