aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs
diff options
context:
space:
mode:
authorAdam Frisby2007-05-13 14:59:24 +0000
committerAdam Frisby2007-05-13 14:59:24 +0000
commitb1101797307504cfc2eea6317d4c4dc2b5964480 (patch)
tree35d7ec88ff9ce0171260ba7166bc6cb3c1fcbb4d /OpenGrid.Framework.Data.MySQL/MySQLGridData.cs
parentInventory should be working again in sandbox mode (diff)
downloadopensim-SC_OLD-b1101797307504cfc2eea6317d4c4dc2b5964480.zip
opensim-SC_OLD-b1101797307504cfc2eea6317d4c4dc2b5964480.tar.gz
opensim-SC_OLD-b1101797307504cfc2eea6317d4c4dc2b5964480.tar.bz2
opensim-SC_OLD-b1101797307504cfc2eea6317d4c4dc2b5964480.tar.xz
* Fixed MySQL Grid Manager
* Added preliminary support for DB UserServer (incomplete) * Added better handling of defaults to Grid Manager. * Renamed SQL/regions.sql to SQL/mysql-regions.sql.
Diffstat (limited to 'OpenGrid.Framework.Data.MySQL/MySQLGridData.cs')
-rw-r--r--OpenGrid.Framework.Data.MySQL/MySQLGridData.cs71
1 files changed, 48 insertions, 23 deletions
diff --git a/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs b/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs
index 4404a16..3dceff6 100644
--- a/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs
+++ b/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs
@@ -14,7 +14,7 @@ namespace OpenGrid.Framework.Data.MySQL
14 /// </summary> 14 /// </summary>
15 public void Initialise() 15 public void Initialise()
16 { 16 {
17 database = new MySQLManager("localhost", "db", "user", "password", "false"); 17 database = new MySQLManager("server", "database", "username", "password", "false");
18 } 18 }
19 19
20 /// <summary> 20 /// <summary>
@@ -42,17 +42,28 @@ namespace OpenGrid.Framework.Data.MySQL
42 /// <returns>Sim profile</returns> 42 /// <returns>Sim profile</returns>
43 public SimProfileData GetProfileByHandle(ulong handle) 43 public SimProfileData GetProfileByHandle(ulong handle)
44 { 44 {
45 Dictionary<string,string> param = new Dictionary<string,string>(); 45 try
46 param["handle"] = handle.ToString(); 46 {
47 lock (database)
48 {
49 Dictionary<string, string> param = new Dictionary<string, string>();
50 param["?handle"] = handle.ToString();
47 51
48 System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE handle = @handle", param); 52 System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE regionHandle = ?handle", param);
49 System.Data.IDataReader reader = result.ExecuteReader(); 53 System.Data.IDataReader reader = result.ExecuteReader();
50 54
51 SimProfileData row = database.getRow( reader ); 55 SimProfileData row = database.getSimRow(reader);
52 reader.Close(); 56 reader.Close();
53 result.Dispose(); 57 result.Dispose();
54 58
55 return row; 59 return row;
60 }
61 }
62 catch (Exception e)
63 {
64 Console.WriteLine(e.ToString());
65 return null;
66 }
56 } 67 }
57 68
58 /// <summary> 69 /// <summary>
@@ -62,28 +73,42 @@ namespace OpenGrid.Framework.Data.MySQL
62 /// <returns>The sim profile</returns> 73 /// <returns>The sim profile</returns>
63 public SimProfileData GetProfileByLLUUID(libsecondlife.LLUUID uuid) 74 public SimProfileData GetProfileByLLUUID(libsecondlife.LLUUID uuid)
64 { 75 {
65 Dictionary<string, string> param = new Dictionary<string, string>(); 76 try
66 param["uuid"] = uuid.ToStringHyphenated(); 77 {
78 lock (database)
79 {
80 Dictionary<string, string> param = new Dictionary<string, string>();
81 param["?uuid"] = uuid.ToStringHyphenated();
67 82
68 System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = @uuid", param); 83 System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = ?uuid", param);
69 System.Data.IDataReader reader = result.ExecuteReader(); 84 System.Data.IDataReader reader = result.ExecuteReader();
70 85
71 SimProfileData row = database.getRow(reader); 86 SimProfileData row = database.getSimRow(reader);
72 reader.Close(); 87 reader.Close();
73 result.Dispose(); 88 result.Dispose();
74 89
75 return row; 90 return row;
91 }
92 }
93 catch (Exception e)
94 {
95 Console.WriteLine(e.ToString());
96 return null;
97 }
76 } 98 }
77 99
78 public DataResponse AddProfile(SimProfileData profile) 100 public DataResponse AddProfile(SimProfileData profile)
79 { 101 {
80 if (database.insertRow(profile)) 102 lock (database)
81 {
82 return DataResponse.RESPONSE_OK;
83 }
84 else
85 { 103 {
86 return DataResponse.RESPONSE_ERROR; 104 if (database.insertRow(profile))
105 {
106 return DataResponse.RESPONSE_OK;
107 }
108 else
109 {
110 return DataResponse.RESPONSE_ERROR;
111 }
87 } 112 }
88 } 113 }
89 114