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 | |
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/MSSQL/MSSQLUserData.cs | 7 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLUserData.cs | 6 | ||||
-rw-r--r-- | OpenSim/Data/NHibernate/NHibernateUserData.cs | 18 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteUserData.cs | 8 | ||||
-rw-r--r-- | OpenSim/Data/UserDataBase.cs | 2 |
5 files changed, 26 insertions, 15 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLUserData.cs b/OpenSim/Data/MSSQL/MSSQLUserData.cs index a4c5068..d54af82 100644 --- a/OpenSim/Data/MSSQL/MSSQLUserData.cs +++ b/OpenSim/Data/MSSQL/MSSQLUserData.cs | |||
@@ -55,10 +55,11 @@ namespace OpenSim.Data.MSSQL | |||
55 | /// <summary> | 55 | /// <summary> |
56 | /// Loads and initialises the MySQL storage plugin | 56 | /// Loads and initialises the MySQL storage plugin |
57 | /// </summary> | 57 | /// </summary> |
58 | override public void Initialise() | 58 | override public void Initialise(string connect) |
59 | { | 59 | { |
60 | // Load from an INI file connection details | 60 | // TODO: do something with the connect string instead of |
61 | // TODO: move this to XML? | 61 | // ignoring it. |
62 | |||
62 | IniFile iniFile = new IniFile("mssql_connection.ini"); | 63 | IniFile iniFile = new IniFile("mssql_connection.ini"); |
63 | string settingDataSource = iniFile.ParseFileReadValue("data_source"); | 64 | string settingDataSource = iniFile.ParseFileReadValue("data_source"); |
64 | string settingInitialCatalog = iniFile.ParseFileReadValue("initial_catalog"); | 65 | string settingInitialCatalog = iniFile.ParseFileReadValue("initial_catalog"); |
diff --git a/OpenSim/Data/MySQL/MySQLUserData.cs b/OpenSim/Data/MySQL/MySQLUserData.cs index c374bf2..b448715 100644 --- a/OpenSim/Data/MySQL/MySQLUserData.cs +++ b/OpenSim/Data/MySQL/MySQLUserData.cs | |||
@@ -55,10 +55,10 @@ namespace OpenSim.Data.MySQL | |||
55 | /// <summary> | 55 | /// <summary> |
56 | /// Loads and initialises the MySQL storage plugin | 56 | /// Loads and initialises the MySQL storage plugin |
57 | /// </summary> | 57 | /// </summary> |
58 | override public void Initialise() | 58 | override public void Initialise(string connect) |
59 | { | 59 | { |
60 | // Load from an INI file connection details | 60 | // TODO: actually do something with our connect string |
61 | // TODO: move this to XML? Yes, PLEASE! | 61 | // instead of loading the second config |
62 | 62 | ||
63 | IniFile iniFile = new IniFile("mysql_connection.ini"); | 63 | IniFile iniFile = new IniFile("mysql_connection.ini"); |
64 | string settingHostname = iniFile.ParseFileReadValue("hostname"); | 64 | string settingHostname = iniFile.ParseFileReadValue("hostname"); |
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; |
diff --git a/OpenSim/Data/SQLite/SQLiteUserData.cs b/OpenSim/Data/SQLite/SQLiteUserData.cs index bca5401..aa7a849 100644 --- a/OpenSim/Data/SQLite/SQLiteUserData.cs +++ b/OpenSim/Data/SQLite/SQLiteUserData.cs | |||
@@ -64,9 +64,13 @@ namespace OpenSim.Data.SQLite | |||
64 | private SqliteDataAdapter daf; | 64 | private SqliteDataAdapter daf; |
65 | SqliteConnection g_conn; | 65 | SqliteConnection g_conn; |
66 | 66 | ||
67 | override public void Initialise() | 67 | override public void Initialise(string connect) |
68 | { | 68 | { |
69 | SqliteConnection conn = new SqliteConnection("URI=file:userprofiles.db,version=3"); | 69 | // default to something sensible |
70 | if (connect == "") | ||
71 | connect = "URI=file:userprofiles.db,version=3"; | ||
72 | |||
73 | SqliteConnection conn = new SqliteConnection(connect); | ||
70 | TestTables(conn); | 74 | TestTables(conn); |
71 | 75 | ||
72 | // This sucks, but It doesn't seem to work with the dataset Syncing :P | 76 | // This sucks, but It doesn't seem to work with the dataset Syncing :P |
diff --git a/OpenSim/Data/UserDataBase.cs b/OpenSim/Data/UserDataBase.cs index fc33376..2ddeccf 100644 --- a/OpenSim/Data/UserDataBase.cs +++ b/OpenSim/Data/UserDataBase.cs | |||
@@ -51,7 +51,7 @@ namespace OpenSim.Data | |||
51 | public abstract bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID inventory); | 51 | public abstract bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID inventory); |
52 | public abstract string Version {get;} | 52 | public abstract string Version {get;} |
53 | public abstract string Name {get;} | 53 | public abstract string Name {get;} |
54 | public abstract void Initialise(); | 54 | public abstract void Initialise(string connect); |
55 | public abstract List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query); | 55 | public abstract List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query); |
56 | public abstract UserAppearance GetUserAppearance(LLUUID user); | 56 | public abstract UserAppearance GetUserAppearance(LLUUID user); |
57 | public abstract void UpdateUserAppearance(LLUUID user, UserAppearance appearance); | 57 | public abstract void UpdateUserAppearance(LLUUID user, UserAppearance appearance); |