diff options
Diffstat (limited to 'OpenGrid.Framework.Data.MySQL/MySQLManager.cs')
-rw-r--r-- | OpenGrid.Framework.Data.MySQL/MySQLManager.cs | 53 |
1 files changed, 53 insertions, 0 deletions
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 | } |