aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorCharles Krinke2008-07-20 22:16:50 +0000
committerCharles Krinke2008-07-20 22:16:50 +0000
commit681433c4b75b30ddd5299b23a56fb706f1edb7ae (patch)
tree2c0fc53a151123447cead4b7320c70df41789746
parentChange the OopenSim.ini default to 256m for nonphysical prims, to (diff)
downloadopensim-SC_OLD-681433c4b75b30ddd5299b23a56fb706f1edb7ae.zip
opensim-SC_OLD-681433c4b75b30ddd5299b23a56fb706f1edb7ae.tar.gz
opensim-SC_OLD-681433c4b75b30ddd5299b23a56fb706f1edb7ae.tar.bz2
opensim-SC_OLD-681433c4b75b30ddd5299b23a56fb706f1edb7ae.tar.xz
Mantis#1796. Thank you kindly, StrawberryFride for a patch that:
Agent table code (INSERT / UPDATE, etc) now added to MSSQL provider.
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/MSSQL/MSSQLManager.cs60
-rw-r--r--OpenSim/Data/MSSQL/MSSQLUserData.cs9
-rw-r--r--OpenSim/Grid/UserServer/UserManager.cs25
3 files changed, 73 insertions, 21 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLManager.cs b/OpenSim/Data/MSSQL/MSSQLManager.cs
index fe4ca77..9cd9eca 100644
--- a/OpenSim/Data/MSSQL/MSSQLManager.cs
+++ b/OpenSim/Data/MSSQL/MSSQLManager.cs
@@ -354,7 +354,7 @@ namespace OpenSim.Data.MSSQL
354 // Agent Who? 354 // Agent Who?
355 retval.AgentIP = (string)reader["agentIP"]; 355 retval.AgentIP = (string)reader["agentIP"];
356 retval.AgentPort = Convert.ToUInt32(reader["agentPort"].ToString()); 356 retval.AgentPort = Convert.ToUInt32(reader["agentPort"].ToString());
357 retval.AgentOnline = Convert.ToBoolean(reader["agentOnline"].ToString()); 357 retval.AgentOnline = Convert.ToInt32(reader["agentOnline"].ToString()) != 0;
358 358
359 // Login/Logout times (UNIX Epoch) 359 // Login/Logout times (UNIX Epoch)
360 retval.LoginTime = Convert.ToInt32(reader["loginTime"].ToString()); 360 retval.LoginTime = Convert.ToInt32(reader["loginTime"].ToString());
@@ -528,5 +528,63 @@ namespace OpenSim.Data.MSSQL
528 string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build, 528 string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build,
529 dllVersion.Revision); 529 dllVersion.Revision);
530 } 530 }
531
532 public bool insertAgentRow(UserAgentData agentdata)
533 {
534 string sql = @"
535
536IF EXISTS (SELECT * FROM agents WHERE UUID = @UUID)
537 BEGIN
538 UPDATE agents SET UUID = @UUID, sessionID = @sessionID, secureSessionID = @secureSessionID, agentIP = @agentIP, agentPort = @agentPort, agentOnline = @agentOnline, loginTime = @loginTime, logoutTime = @logoutTime, currentRegion = @currentRegion, currentHandle = @currentHandle, currentPos = @currentPos
539 WHERE UUID = @UUID
540 END
541ELSE
542 BEGIN
543 INSERT INTO
544 agents (UUID, sessionID, secureSessionID, agentIP, agentPort, agentOnline, loginTime, logoutTime, currentRegion, currentHandle, currentPos) VALUES
545 (@UUID, @sessionID, @secureSessionID, @agentIP, @agentPort, @agentOnline, @loginTime, @logoutTime, @currentRegion, @currentHandle, @currentPos)
546 END
547";
548
549 Dictionary<string, string> parameters = new Dictionary<string, string>();
550
551 parameters["@UUID"] = agentdata.ProfileID.ToString();
552 parameters["@sessionID"] = agentdata.SessionID.ToString();
553 parameters["@secureSessionID"] = agentdata.SecureSessionID.ToString();
554 parameters["@agentIP"] = agentdata.AgentIP.ToString();
555 parameters["@agentPort"] = agentdata.AgentPort.ToString();
556 parameters["@agentOnline"] = (agentdata.AgentOnline == true) ? "1" : "0";
557 parameters["@loginTime"] = agentdata.LoginTime.ToString();
558 parameters["@logoutTime"] = agentdata.LogoutTime.ToString();
559 parameters["@currentRegion"] = agentdata.Region.ToString();
560 parameters["@currentHandle"] = agentdata.Handle.ToString();
561 parameters["@currentPos"] = "<" + ((int)agentdata.Position.X).ToString() + "," + ((int)agentdata.Position.Y).ToString() + "," + ((int)agentdata.Position.Z).ToString() + ">";
562
563
564 using (IDbCommand result = Query(sql, parameters))
565 {
566 result.Transaction = result.Connection.BeginTransaction(IsolationLevel.Serializable);
567 try
568 {
569 if (result.ExecuteNonQuery() > 0)
570 {
571 result.Transaction.Commit();
572 return true;
573 }
574 else
575 {
576 result.Transaction.Rollback();
577 return false;
578 }
579 }
580 catch (Exception e)
581 {
582 result.Transaction.Rollback();
583 m_log.Error(e.ToString());
584 return false;
585 }
586 }
587
588 }
531 } 589 }
532} 590}
diff --git a/OpenSim/Data/MSSQL/MSSQLUserData.cs b/OpenSim/Data/MSSQL/MSSQLUserData.cs
index 20c3acd..0593c62 100644
--- a/OpenSim/Data/MSSQL/MSSQLUserData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLUserData.cs
@@ -610,7 +610,14 @@ namespace OpenSim.Data.MSSQL
610 /// <param name="agent">The agent to create</param> 610 /// <param name="agent">The agent to create</param>
611 override public void AddNewUserAgent(UserAgentData agent) 611 override public void AddNewUserAgent(UserAgentData agent)
612 { 612 {
613 // Do nothing. 613 try
614 {
615 database.insertAgentRow(agent);
616 }
617 catch (Exception e)
618 {
619 m_log.Error(e.ToString());
620 }
614 } 621 }
615 622
616 /// <summary> 623 /// <summary>
diff --git a/OpenSim/Grid/UserServer/UserManager.cs b/OpenSim/Grid/UserServer/UserManager.cs
index d4fb187..b48f20e 100644
--- a/OpenSim/Grid/UserServer/UserManager.cs
+++ b/OpenSim/Grid/UserServer/UserManager.cs
@@ -190,28 +190,15 @@ namespace OpenSim.Grid.UserServer
190 { 190 {
191 // ulong cregionhandle = 0; 191 // ulong cregionhandle = 0;
192 LLUUID regionUUID = LLUUID.Zero; 192 LLUUID regionUUID = LLUUID.Zero;
193 LLUUID AvatarID = LLUUID.Zero; 193 LLUUID avatarUUID = LLUUID.Zero;
194 194
195 Helpers.TryParse((string)requestData["avatar_id"], out AvatarID); 195 Helpers.TryParse((string)requestData["avatar_id"], out avatarUUID);
196 Helpers.TryParse((string)requestData["region_uuid"], out regionUUID); 196 Helpers.TryParse((string)requestData["region_uuid"], out regionUUID);
197 // try 197
198 // { 198 if (avatarUUID != LLUUID.Zero)
199 // cregionhandle = (ulong)Convert.ToInt64((string)requestData["region_handle"]);
200 // }
201 // catch (ArgumentException)
202 // {
203 // }
204 // catch (OverflowException)
205 // {
206 // }
207 // catch (FormatException)
208 // {
209 // }
210
211 if (AvatarID != LLUUID.Zero)
212 { 199 {
213 UserProfileData userProfile = GetUserProfile(new LLUUID((string)requestData["avatar_id"])); 200 UserProfileData userProfile = GetUserProfile(avatarUUID);
214 userProfile.CurrentAgent.Region = new LLUUID((string)requestData["region_uuid"]); 201 userProfile.CurrentAgent.Region = regionUUID;
215 userProfile.CurrentAgent.Handle = (ulong)Convert.ToInt64((string)requestData["region_handle"]); 202 userProfile.CurrentAgent.Handle = (ulong)Convert.ToInt64((string)requestData["region_handle"]);
216 //userProfile.CurrentAgent. 203 //userProfile.CurrentAgent.
217 CommitAgent(ref userProfile); 204 CommitAgent(ref userProfile);