aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/NHibernate
diff options
context:
space:
mode:
authorSean Dague2008-04-23 20:48:23 +0000
committerSean Dague2008-04-23 20:48:23 +0000
commit3dd98a112f4308532d768943690b13c403dff68b (patch)
tree6c33ceb05d8c431720ffca11be2d025a1782fc78 /OpenSim/Data/NHibernate
parentchanges to allow asset_source to be specified in the opensim.ini (diff)
downloadopensim-SC_OLD-3dd98a112f4308532d768943690b13c403dff68b.zip
opensim-SC_OLD-3dd98a112f4308532d768943690b13c403dff68b.tar.gz
opensim-SC_OLD-3dd98a112f4308532d768943690b13c403dff68b.tar.bz2
opensim-SC_OLD-3dd98a112f4308532d768943690b13c403dff68b.tar.xz
allow for Inventory database source to be specified in main
configs. This works with sqlite and nhibernate backends, and stays with default seperate ini files for mysql and mssql until someone writes those.
Diffstat (limited to 'OpenSim/Data/NHibernate')
-rw-r--r--OpenSim/Data/NHibernate/NHibernateAssetData.cs10
-rw-r--r--OpenSim/Data/NHibernate/NHibernateInventoryData.cs26
2 files changed, 20 insertions, 16 deletions
diff --git a/OpenSim/Data/NHibernate/NHibernateAssetData.cs b/OpenSim/Data/NHibernate/NHibernateAssetData.cs
index 7bd4a0b..beac693 100644
--- a/OpenSim/Data/NHibernate/NHibernateAssetData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateAssetData.cs
@@ -55,11 +55,11 @@ namespace OpenSim.Data.NHibernate
55 55
56 public override void Initialise(string connect) 56 public override void Initialise(string connect)
57 { 57 {
58 // TODO: hard coding for sqlite based stuff to begin with, just making it easier to test 58 // Split out the dialect, driver, and connect string
59 char[] split = {';'}; 59 char[] split = {';'};
60 string[] parts = connect.Split(split); 60 string[] parts = connect.Split(split);
61 61
62 // This is stubbing for now, it will become dynamic later and support different db backends 62 // NHibernate setup
63 cfg = new Configuration(); 63 cfg = new Configuration();
64 cfg.SetProperty(Environment.ConnectionProvider, 64 cfg.SetProperty(Environment.ConnectionProvider,
65 "NHibernate.Connection.DriverConnectionProvider"); 65 "NHibernate.Connection.DriverConnectionProvider");
@@ -74,7 +74,11 @@ namespace OpenSim.Data.NHibernate
74 using ( MemoryStream stream = 74 using ( MemoryStream stream =
75 HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly())) 75 HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly()))
76 cfg.AddInputStream(stream); 76 cfg.AddInputStream(stream);
77 77
78 // If uncommented this will auto create tables, but it
79 // does drops of the old tables, so we need a smarter way
80 // to acturally manage this.
81
78 // new SchemaExport(cfg).Create(true, true); 82 // new SchemaExport(cfg).Create(true, true);
79 83
80 factory = cfg.BuildSessionFactory(); 84 factory = cfg.BuildSessionFactory();
diff --git a/OpenSim/Data/NHibernate/NHibernateInventoryData.cs b/OpenSim/Data/NHibernate/NHibernateInventoryData.cs
index 1ac0f0c..938f47c 100644
--- a/OpenSim/Data/NHibernate/NHibernateInventoryData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateInventoryData.cs
@@ -50,25 +50,21 @@ namespace OpenSim.Data.NHibernate
50 /// <summary> 50 /// <summary>
51 /// Initialises the interface 51 /// Initialises the interface
52 /// </summary> 52 /// </summary>
53 public void Initialise() 53 public void Initialise(string connect)
54 { 54 {
55 Initialise("Inventory.db", "Inventory"); 55 // Split out the dialect, driver, and connect string
56 } 56 char[] split = {';'};
57 57 string[] parts = connect.Split(split);
58 public void Initialise(string dbfile, string dbname) 58
59 { 59 // Establish NHibernate Connection
60 // TODO: hard coding for sqlite based stuff to begin with, just making it easier to test
61
62 // This is stubbing for now, it will become dynamic later and support different db backends
63 cfg = new Configuration(); 60 cfg = new Configuration();
64 cfg.SetProperty(Environment.ConnectionProvider, 61 cfg.SetProperty(Environment.ConnectionProvider,
65 "NHibernate.Connection.DriverConnectionProvider"); 62 "NHibernate.Connection.DriverConnectionProvider");
66 cfg.SetProperty(Environment.Dialect, 63 cfg.SetProperty(Environment.Dialect,
67 "NHibernate.Dialect.SQLiteDialect"); 64 "NHibernate.Dialect." + parts[0]);
68 cfg.SetProperty(Environment.ConnectionDriver, 65 cfg.SetProperty(Environment.ConnectionDriver,
69 "NHibernate.Driver.SqliteClientDriver"); 66 "NHibernate.Driver." + parts[1]);
70 cfg.SetProperty(Environment.ConnectionString, 67 cfg.SetProperty(Environment.ConnectionString, parts[2]);
71 "URI=file:" + dbfile + ",version=3");
72 cfg.AddAssembly("OpenSim.Data.NHibernate"); 68 cfg.AddAssembly("OpenSim.Data.NHibernate");
73 69
74 HbmSerializer.Default.Validate = true; 70 HbmSerializer.Default.Validate = true;
@@ -76,6 +72,10 @@ namespace OpenSim.Data.NHibernate
76 HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly())) 72 HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly()))
77 cfg.AddInputStream(stream); 73 cfg.AddInputStream(stream);
78 74
75 // If uncommented this will auto create tables, but it
76 // does drops of the old tables, so we need a smarter way
77 // to acturally manage this.
78
79 // new SchemaExport(cfg).Create(true, true); 79 // new SchemaExport(cfg).Create(true, true);
80 80
81 factory = cfg.BuildSessionFactory(); 81 factory = cfg.BuildSessionFactory();