aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Data.MSSQL/MSSQLManager.cs')
-rw-r--r--OpenSim/Framework/Data.MSSQL/MSSQLManager.cs68
1 files changed, 36 insertions, 32 deletions
diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs b/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs
index 77d29f7..c0b2edf 100644
--- a/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs
+++ b/OpenSim/Framework/Data.MSSQL/MSSQLManager.cs
@@ -36,12 +36,12 @@ namespace OpenSim.Framework.Data.MSSQL
36 /// <summary> 36 /// <summary>
37 /// A management class for the MS SQL Storage Engine 37 /// A management class for the MS SQL Storage Engine
38 /// </summary> 38 /// </summary>
39 class MSSqlManager 39 internal class MSSqlManager
40 { 40 {
41 /// <summary> 41 /// <summary>
42 /// The database connection object 42 /// The database connection object
43 /// </summary> 43 /// </summary>
44 IDbConnection dbcon; 44 private IDbConnection dbcon;
45 45
46 /// <summary> 46 /// <summary>
47 /// Initialises and creates a new Sql connection and maintains it. 47 /// Initialises and creates a new Sql connection and maintains it.
@@ -55,7 +55,8 @@ namespace OpenSim.Framework.Data.MSSQL
55 { 55 {
56 try 56 try
57 { 57 {
58 string connectionString = "Server=" + hostname + ";Database=" + database + ";User ID=" + username + ";Password=" + password + ";Pooling=" + cpooling + ";"; 58 string connectionString = "Server=" + hostname + ";Database=" + database + ";User ID=" + username +
59 ";Password=" + password + ";Pooling=" + cpooling + ";";
59 dbcon = new SqlConnection(connectionString); 60 dbcon = new SqlConnection(connectionString);
60 61
61 dbcon.Open(); 62 dbcon.Open();
@@ -83,14 +84,14 @@ namespace OpenSim.Framework.Data.MSSQL
83 /// <returns>A Sql DB Command</returns> 84 /// <returns>A Sql DB Command</returns>
84 public IDbCommand Query(string sql, Dictionary<string, string> parameters) 85 public IDbCommand Query(string sql, Dictionary<string, string> parameters)
85 { 86 {
86 SqlCommand dbcommand = (SqlCommand)dbcon.CreateCommand(); 87 SqlCommand dbcommand = (SqlCommand) dbcon.CreateCommand();
87 dbcommand.CommandText = sql; 88 dbcommand.CommandText = sql;
88 foreach (KeyValuePair<string, string> param in parameters) 89 foreach (KeyValuePair<string, string> param in parameters)
89 { 90 {
90 dbcommand.Parameters.AddWithValue(param.Key, param.Value); 91 dbcommand.Parameters.AddWithValue(param.Key, param.Value);
91 } 92 }
92 93
93 return (IDbCommand)dbcommand; 94 return (IDbCommand) dbcommand;
94 } 95 }
95 96
96 /// <summary> 97 /// <summary>
@@ -105,42 +106,42 @@ namespace OpenSim.Framework.Data.MSSQL
105 if (reader.Read()) 106 if (reader.Read())
106 { 107 {
107 // Region Main 108 // Region Main
108 regionprofile.regionHandle = (ulong)reader["regionHandle"]; 109 regionprofile.regionHandle = (ulong) reader["regionHandle"];
109 regionprofile.regionName = (string)reader["regionName"]; 110 regionprofile.regionName = (string) reader["regionName"];
110 regionprofile.UUID = new LLUUID((string)reader["uuid"]); 111 regionprofile.UUID = new LLUUID((string) reader["uuid"]);
111 112
112 // Secrets 113 // Secrets
113 regionprofile.regionRecvKey = (string)reader["regionRecvKey"]; 114 regionprofile.regionRecvKey = (string) reader["regionRecvKey"];
114 regionprofile.regionSecret = (string)reader["regionSecret"]; 115 regionprofile.regionSecret = (string) reader["regionSecret"];
115 regionprofile.regionSendKey = (string)reader["regionSendKey"]; 116 regionprofile.regionSendKey = (string) reader["regionSendKey"];
116 117
117 // Region Server 118 // Region Server
118 regionprofile.regionDataURI = (string)reader["regionDataURI"]; 119 regionprofile.regionDataURI = (string) reader["regionDataURI"];
119 regionprofile.regionOnline = false; // Needs to be pinged before this can be set. 120 regionprofile.regionOnline = false; // Needs to be pinged before this can be set.
120 regionprofile.serverIP = (string)reader["serverIP"]; 121 regionprofile.serverIP = (string) reader["serverIP"];
121 regionprofile.serverPort = (uint)reader["serverPort"]; 122 regionprofile.serverPort = (uint) reader["serverPort"];
122 regionprofile.serverURI = (string)reader["serverURI"]; 123 regionprofile.serverURI = (string) reader["serverURI"];
123 124
124 // Location 125 // Location
125 regionprofile.regionLocX = (uint)((int)reader["locX"]); 126 regionprofile.regionLocX = (uint) ((int) reader["locX"]);
126 regionprofile.regionLocY = (uint)((int)reader["locY"]); 127 regionprofile.regionLocY = (uint) ((int) reader["locY"]);
127 regionprofile.regionLocZ = (uint)((int)reader["locZ"]); 128 regionprofile.regionLocZ = (uint) ((int) reader["locZ"]);
128 129
129 // Neighbours - 0 = No Override 130 // Neighbours - 0 = No Override
130 regionprofile.regionEastOverrideHandle = (ulong)reader["eastOverrideHandle"]; 131 regionprofile.regionEastOverrideHandle = (ulong) reader["eastOverrideHandle"];
131 regionprofile.regionWestOverrideHandle = (ulong)reader["westOverrideHandle"]; 132 regionprofile.regionWestOverrideHandle = (ulong) reader["westOverrideHandle"];
132 regionprofile.regionSouthOverrideHandle = (ulong)reader["southOverrideHandle"]; 133 regionprofile.regionSouthOverrideHandle = (ulong) reader["southOverrideHandle"];
133 regionprofile.regionNorthOverrideHandle = (ulong)reader["northOverrideHandle"]; 134 regionprofile.regionNorthOverrideHandle = (ulong) reader["northOverrideHandle"];
134 135
135 // Assets 136 // Assets
136 regionprofile.regionAssetURI = (string)reader["regionAssetURI"]; 137 regionprofile.regionAssetURI = (string) reader["regionAssetURI"];
137 regionprofile.regionAssetRecvKey = (string)reader["regionAssetRecvKey"]; 138 regionprofile.regionAssetRecvKey = (string) reader["regionAssetRecvKey"];
138 regionprofile.regionAssetSendKey = (string)reader["regionAssetSendKey"]; 139 regionprofile.regionAssetSendKey = (string) reader["regionAssetSendKey"];
139 140
140 // Userserver 141 // Userserver
141 regionprofile.regionUserURI = (string)reader["regionUserURI"]; 142 regionprofile.regionUserURI = (string) reader["regionUserURI"];
142 regionprofile.regionUserRecvKey = (string)reader["regionUserRecvKey"]; 143 regionprofile.regionUserRecvKey = (string) reader["regionUserRecvKey"];
143 regionprofile.regionUserSendKey = (string)reader["regionUserSendKey"]; 144 regionprofile.regionUserSendKey = (string) reader["regionUserSendKey"];
144 } 145 }
145 else 146 else
146 { 147 {
@@ -156,12 +157,15 @@ namespace OpenSim.Framework.Data.MSSQL
156 /// <returns>Successful?</returns> 157 /// <returns>Successful?</returns>
157 public bool insertRow(RegionProfileData profile) 158 public bool insertRow(RegionProfileData profile)
158 { 159 {
159 string sql = "REPLACE INTO regions VALUES (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, "; 160 string sql =
160 sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, "; 161 "REPLACE INTO regions VALUES (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, ";
162 sql +=
163 "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, ";
161 sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey) VALUES "; 164 sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey) VALUES ";
162 165
163 sql += "(@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, "; 166 sql += "(@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, ";
164 sql += "@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, "; 167 sql +=
168 "@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, ";
165 sql += "@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey);"; 169 sql += "@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey);";
166 170
167 Dictionary<string, string> parameters = new Dictionary<string, string>(); 171 Dictionary<string, string> parameters = new Dictionary<string, string>();
@@ -208,4 +212,4 @@ namespace OpenSim.Framework.Data.MSSQL
208 return returnval; 212 return returnval;
209 } 213 }
210 } 214 }
211} 215} \ No newline at end of file