aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data
diff options
context:
space:
mode:
authorCharles Krinke2008-07-20 22:16:50 +0000
committerCharles Krinke2008-07-20 22:16:50 +0000
commit681433c4b75b30ddd5299b23a56fb706f1edb7ae (patch)
tree2c0fc53a151123447cead4b7320c70df41789746 /OpenSim/Data
parentChange the OopenSim.ini default to 256m for nonphysical prims, to (diff)
downloadopensim-SC-681433c4b75b30ddd5299b23a56fb706f1edb7ae.zip
opensim-SC-681433c4b75b30ddd5299b23a56fb706f1edb7ae.tar.gz
opensim-SC-681433c4b75b30ddd5299b23a56fb706f1edb7ae.tar.bz2
opensim-SC-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 'OpenSim/Data')
-rw-r--r--OpenSim/Data/MSSQL/MSSQLManager.cs60
-rw-r--r--OpenSim/Data/MSSQL/MSSQLUserData.cs9
2 files changed, 67 insertions, 2 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>