diff options
author | Adam Frisby | 2007-05-05 23:04:47 +0000 |
---|---|---|
committer | Adam Frisby | 2007-05-05 23:04:47 +0000 |
commit | 6d6117e0196e8aabccee2a8879b0b6ad950ab3ab (patch) | |
tree | 61d8e736ebd1a407010900d2839fbfdf83ea37d7 /OpenGrid.Framework.Data.MySQL | |
parent | Grid Framework for DB4o - supports all framework.data interfaces. (diff) | |
download | opensim-SC_OLD-6d6117e0196e8aabccee2a8879b0b6ad950ab3ab.zip opensim-SC_OLD-6d6117e0196e8aabccee2a8879b0b6ad950ab3ab.tar.gz opensim-SC_OLD-6d6117e0196e8aabccee2a8879b0b6ad950ab3ab.tar.bz2 opensim-SC_OLD-6d6117e0196e8aabccee2a8879b0b6ad950ab3ab.tar.xz |
You can now save profiles to a database. (Zomg!)
Diffstat (limited to 'OpenGrid.Framework.Data.MySQL')
-rw-r--r-- | OpenGrid.Framework.Data.MySQL/MySQLGridData.cs | 12 | ||||
-rw-r--r-- | OpenGrid.Framework.Data.MySQL/MySQLManager.cs | 53 |
2 files changed, 65 insertions, 0 deletions
diff --git a/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs b/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs index 0a84cdb..4404a16 100644 --- a/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs +++ b/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs | |||
@@ -75,6 +75,18 @@ namespace OpenGrid.Framework.Data.MySQL | |||
75 | return row; | 75 | return row; |
76 | } | 76 | } |
77 | 77 | ||
78 | public DataResponse AddProfile(SimProfileData profile) | ||
79 | { | ||
80 | if (database.insertRow(profile)) | ||
81 | { | ||
82 | return DataResponse.RESPONSE_OK; | ||
83 | } | ||
84 | else | ||
85 | { | ||
86 | return DataResponse.RESPONSE_ERROR; | ||
87 | } | ||
88 | } | ||
89 | |||
78 | /// <summary> | 90 | /// <summary> |
79 | /// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret. | 91 | /// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret. |
80 | /// </summary> | 92 | /// </summary> |
diff --git a/OpenGrid.Framework.Data.MySQL/MySQLManager.cs b/OpenGrid.Framework.Data.MySQL/MySQLManager.cs index 057cd42..d3bfa18 100644 --- a/OpenGrid.Framework.Data.MySQL/MySQLManager.cs +++ b/OpenGrid.Framework.Data.MySQL/MySQLManager.cs | |||
@@ -117,5 +117,58 @@ namespace OpenGrid.Framework.Data.MySQL | |||
117 | } | 117 | } |
118 | return retval; | 118 | return retval; |
119 | } | 119 | } |
120 | |||
121 | public bool insertRow(SimProfileData profile) { | ||
122 | string sql = "REPLACE INTO regions VALUES (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, "; | ||
123 | sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, "; | ||
124 | sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey) VALUES "; | ||
125 | |||
126 | sql += "(@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, "; | ||
127 | sql += "@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, "; | ||
128 | sql += "@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey);"; | ||
129 | |||
130 | Dictionary<string, string> parameters = new Dictionary<string,string>(); | ||
131 | |||
132 | parameters["regionHandle"] = profile.regionHandle.ToString(); | ||
133 | parameters["regionName"] = profile.regionName; | ||
134 | parameters["uuid"] = profile.UUID.ToString(); | ||
135 | parameters["regionRecvKey"] = profile.regionRecvKey; | ||
136 | parameters["regionSendKey"] = profile.regionSendKey; | ||
137 | parameters["regionDataURI"] = profile.regionDataURI; | ||
138 | parameters["serverIP"] = profile.serverIP; | ||
139 | parameters["serverPort"] = profile.serverPort.ToString(); | ||
140 | parameters["serverURI"] = profile.serverURI; | ||
141 | parameters["locX"] = profile.regionLocX.ToString(); | ||
142 | parameters["locY"] = profile.regionLocY.ToString(); | ||
143 | parameters["locZ"] = profile.regionLocZ.ToString(); | ||
144 | parameters["eastOverrideHandle"] = profile.regionEastOverrideHandle.ToString(); | ||
145 | parameters["westOverrideHandle"] = profile.regionWestOverrideHandle.ToString(); | ||
146 | parameters["northOverrideHandle"] = profile.regionNorthOverrideHandle.ToString(); | ||
147 | parameters["southOverrideHandle"] = profile.regionSouthOverrideHandle.ToString(); | ||
148 | parameters["regionAssetURI"] = profile.regionAssetURI; | ||
149 | parameters["regionAssetRecvKey"] = profile.regionAssetRecvKey; | ||
150 | parameters["regionAssetSendKey"] = profile.regionAssetSendKey; | ||
151 | parameters["regionUserURI"] = profile.regionUserURI; | ||
152 | parameters["regionUserRecvKey"] = profile.regionUserRecvKey; | ||
153 | parameters["regionUserSendKey"] = profile.regionUserSendKey; | ||
154 | |||
155 | bool returnval = false; | ||
156 | |||
157 | try | ||
158 | { | ||
159 | IDbCommand result = Query(sql, parameters); | ||
160 | |||
161 | if (result.ExecuteNonQuery() == 1) | ||
162 | returnval = true; | ||
163 | |||
164 | result.Dispose(); | ||
165 | } | ||
166 | catch (Exception e) | ||
167 | { | ||
168 | return false; | ||
169 | } | ||
170 | |||
171 | return returnval; | ||
172 | } | ||
120 | } | 173 | } |
121 | } | 174 | } |