diff options
author | Adam Frisby | 2007-06-01 23:53:02 +0000 |
---|---|---|
committer | Adam Frisby | 2007-06-01 23:53:02 +0000 |
commit | 14babaaeceded845f7dc88c03b145a43c799d47a (patch) | |
tree | 23345f630ac0cfe3510e7a64ccf13c65cf17282f /OpenGridServices/OpenGrid.Framework.Data.MSSQL/MSSQLManager.cs | |
parent | * DB4o Storage provider is now well documented (diff) | |
download | opensim-SC-14babaaeceded845f7dc88c03b145a43c799d47a.zip opensim-SC-14babaaeceded845f7dc88c03b145a43c799d47a.tar.gz opensim-SC-14babaaeceded845f7dc88c03b145a43c799d47a.tar.bz2 opensim-SC-14babaaeceded845f7dc88c03b145a43c799d47a.tar.xz |
* MS-SQL Interface is now well documented (and probably defunct)
Diffstat (limited to '')
-rw-r--r-- | OpenGridServices/OpenGrid.Framework.Data.MSSQL/MSSQLManager.cs | 88 |
1 files changed, 62 insertions, 26 deletions
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MSSQL/MSSQLManager.cs b/OpenGridServices/OpenGrid.Framework.Data.MSSQL/MSSQLManager.cs index 12c166c..36d5744 100644 --- a/OpenGridServices/OpenGrid.Framework.Data.MSSQL/MSSQLManager.cs +++ b/OpenGridServices/OpenGrid.Framework.Data.MSSQL/MSSQLManager.cs | |||
@@ -1,3 +1,29 @@ | |||
1 | /* | ||
2 | * Copyright (c) OpenSim project, http://sim.opensecondlife.org/ | ||
3 | * | ||
4 | * Redistribution and use in source and binary forms, with or without | ||
5 | * modification, are permitted provided that the following conditions are met: | ||
6 | * * Redistributions of source code must retain the above copyright | ||
7 | * notice, this list of conditions and the following disclaimer. | ||
8 | * * Redistributions in binary form must reproduce the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer in the | ||
10 | * documentation and/or other materials provided with the distribution. | ||
11 | * * Neither the name of the <organization> nor the | ||
12 | * names of its contributors may be used to endorse or promote products | ||
13 | * derived from this software without specific prior written permission. | ||
14 | * | ||
15 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
16 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
18 | * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY | ||
19 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
25 | * | ||
26 | */ | ||
1 | using System; | 27 | using System; |
2 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
3 | using System.Text; | 29 | using System.Text; |
@@ -63,57 +89,67 @@ namespace OpenGrid.Framework.Data.MSSQL | |||
63 | return (IDbCommand)dbcommand; | 89 | return (IDbCommand)dbcommand; |
64 | } | 90 | } |
65 | 91 | ||
92 | /// <summary> | ||
93 | /// Runs a database reader object and returns a region row | ||
94 | /// </summary> | ||
95 | /// <param name="reader">An active database reader</param> | ||
96 | /// <returns>A region row</returns> | ||
66 | public SimProfileData getRow(IDataReader reader) | 97 | public SimProfileData getRow(IDataReader reader) |
67 | { | 98 | { |
68 | SimProfileData retval = new SimProfileData(); | 99 | SimProfileData regionprofile = new SimProfileData(); |
69 | 100 | ||
70 | if (reader.Read()) | 101 | if (reader.Read()) |
71 | { | 102 | { |
72 | // Region Main | 103 | // Region Main |
73 | retval.regionHandle = (ulong)reader["regionHandle"]; | 104 | regionprofile.regionHandle = (ulong)reader["regionHandle"]; |
74 | retval.regionName = (string)reader["regionName"]; | 105 | regionprofile.regionName = (string)reader["regionName"]; |
75 | retval.UUID = new libsecondlife.LLUUID((string)reader["uuid"]); | 106 | regionprofile.UUID = new libsecondlife.LLUUID((string)reader["uuid"]); |
76 | 107 | ||
77 | // Secrets | 108 | // Secrets |
78 | retval.regionRecvKey = (string)reader["regionRecvKey"]; | 109 | regionprofile.regionRecvKey = (string)reader["regionRecvKey"]; |
79 | retval.regionSecret = (string)reader["regionSecret"]; | 110 | regionprofile.regionSecret = (string)reader["regionSecret"]; |
80 | retval.regionSendKey = (string)reader["regionSendKey"]; | 111 | regionprofile.regionSendKey = (string)reader["regionSendKey"]; |
81 | 112 | ||
82 | // Region Server | 113 | // Region Server |
83 | retval.regionDataURI = (string)reader["regionDataURI"]; | 114 | regionprofile.regionDataURI = (string)reader["regionDataURI"]; |
84 | retval.regionOnline = false; // Needs to be pinged before this can be set. | 115 | regionprofile.regionOnline = false; // Needs to be pinged before this can be set. |
85 | retval.serverIP = (string)reader["serverIP"]; | 116 | regionprofile.serverIP = (string)reader["serverIP"]; |
86 | retval.serverPort = (uint)reader["serverPort"]; | 117 | regionprofile.serverPort = (uint)reader["serverPort"]; |
87 | retval.serverURI = (string)reader["serverURI"]; | 118 | regionprofile.serverURI = (string)reader["serverURI"]; |
88 | 119 | ||
89 | // Location | 120 | // Location |
90 | retval.regionLocX = (uint)((int)reader["locX"]); | 121 | regionprofile.regionLocX = (uint)((int)reader["locX"]); |
91 | retval.regionLocY = (uint)((int)reader["locY"]); | 122 | regionprofile.regionLocY = (uint)((int)reader["locY"]); |
92 | retval.regionLocZ = (uint)((int)reader["locZ"]); | 123 | regionprofile.regionLocZ = (uint)((int)reader["locZ"]); |
93 | 124 | ||
94 | // Neighbours - 0 = No Override | 125 | // Neighbours - 0 = No Override |
95 | retval.regionEastOverrideHandle = (ulong)reader["eastOverrideHandle"]; | 126 | regionprofile.regionEastOverrideHandle = (ulong)reader["eastOverrideHandle"]; |
96 | retval.regionWestOverrideHandle = (ulong)reader["westOverrideHandle"]; | 127 | regionprofile.regionWestOverrideHandle = (ulong)reader["westOverrideHandle"]; |
97 | retval.regionSouthOverrideHandle = (ulong)reader["southOverrideHandle"]; | 128 | regionprofile.regionSouthOverrideHandle = (ulong)reader["southOverrideHandle"]; |
98 | retval.regionNorthOverrideHandle = (ulong)reader["northOverrideHandle"]; | 129 | regionprofile.regionNorthOverrideHandle = (ulong)reader["northOverrideHandle"]; |
99 | 130 | ||
100 | // Assets | 131 | // Assets |
101 | retval.regionAssetURI = (string)reader["regionAssetURI"]; | 132 | regionprofile.regionAssetURI = (string)reader["regionAssetURI"]; |
102 | retval.regionAssetRecvKey = (string)reader["regionAssetRecvKey"]; | 133 | regionprofile.regionAssetRecvKey = (string)reader["regionAssetRecvKey"]; |
103 | retval.regionAssetSendKey = (string)reader["regionAssetSendKey"]; | 134 | regionprofile.regionAssetSendKey = (string)reader["regionAssetSendKey"]; |
104 | 135 | ||
105 | // Userserver | 136 | // Userserver |
106 | retval.regionUserURI = (string)reader["regionUserURI"]; | 137 | regionprofile.regionUserURI = (string)reader["regionUserURI"]; |
107 | retval.regionUserRecvKey = (string)reader["regionUserRecvKey"]; | 138 | regionprofile.regionUserRecvKey = (string)reader["regionUserRecvKey"]; |
108 | retval.regionUserSendKey = (string)reader["regionUserSendKey"]; | 139 | regionprofile.regionUserSendKey = (string)reader["regionUserSendKey"]; |
109 | } | 140 | } |
110 | else | 141 | else |
111 | { | 142 | { |
112 | throw new Exception("No rows to return"); | 143 | throw new Exception("No rows to return"); |
113 | } | 144 | } |
114 | return retval; | 145 | return regionprofile; |
115 | } | 146 | } |
116 | 147 | ||
148 | /// <summary> | ||
149 | /// Creates a new region in the database | ||
150 | /// </summary> | ||
151 | /// <param name="profile">The region profile to insert</param> | ||
152 | /// <returns>Successful?</returns> | ||
117 | public bool insertRow(SimProfileData profile) | 153 | public bool insertRow(SimProfileData profile) |
118 | { | 154 | { |
119 | string sql = "REPLACE INTO regions VALUES (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, "; | 155 | string sql = "REPLACE INTO regions VALUES (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, "; |