Subversion Repository Public Repository

ConnectionOdbcSdk

Diff Revisions 10 vs 11 for /trunk/ConnectionServer/ConnectionServerOdbc.cs

Diff revisions: vs.
  @@ -85,6 +85,11 @@
85 85 }
86 86 }
87 87
88 + public int UnityVersionEs
89 + {
90 + get { return _unityVersion.EsInt; }
91 + }
92 +
88 93 public bool UnityVersionIsCoRes
89 94 {
90 95 get
  @@ -93,6 +98,8 @@
93 98 }
94 99 }
95 100
101 +
102 +
96 103 //Details from the Connection database that are often needed for common function calls.
97 104 public string PrimaryLocationDisplayName { get; private set; }
98 105 public string PrimaryLocationServerAddress { get; private set; }
  @@ -304,10 +311,11 @@
304 311 DataTable oTableLocations;
305 312
306 313 //there should only ever be one row returned from this query - if not we have a problem
307 - DbFetchResult ret = DatabaseFunctions.FillDataTableBlocking("SELECT * FROM vw_LocalVMS", out oTableLocations,true,null);
314 + DbFetchResult ret = DatabaseFunctions.FillDataTableBlocking("SELECT * FROM vw_LocalVMS", out oTableLocations,false,null);
308 315 if (ret.Successful == false)
309 316 {
310 317 RaiseErrorEvent("(error) fetching location properties in FillLocationProperties on ConnectionServerOdbc.cs:" + ret.ErrorDetails);
318 + return;
311 319 }
312 320
313 321 if ((oTableLocations != null) && oTableLocations.Rows.Count==1)
  @@ -460,6 +468,8 @@
460 468 DatabaseLoginPassword = pPassword;
461 469 DatabaseServerName = pServerName;
462 470
471 + NeighborLocations = new List<string>();
472 +
463 473 DbFetchResult res = new DbFetchResult();
464 474 res.SQLQuery = "Logging into server";
465 475
  @@ -489,9 +499,23 @@
489 499 //get version information for the server we've attached to
490 500 InitVersionInfo();
491 501
502 + if (this.UnityVersionMajor == 0)
503 + {
504 + res.Successful = false;
505 + res.ErrorDetails = "Version parsing failed";
506 + return res;
507 + }
508 +
492 509 //fill in the properties for this location
493 510 FillLocationProperties();
494 511
512 + if (string.IsNullOrEmpty(this.PrimaryLocationObjectId))
513 + {
514 + res.Successful = false;
515 + res.ErrorDetails = "Location details parsing failed";
516 + return res;
517 + }
518 +
495 519 return res;
496 520 }
497 521
  @@ -525,7 +549,8 @@
525 549 }
526 550
527 551 //now fetch the version string from the schema information
528 - DbFetchResult ret = DatabaseFunctions.FillDataTableBlocking("SELECT * FROM vw_Schemainformation WHERE IsCurrent=1", out dtTemp,false,null);
552 + DbFetchResult ret = DatabaseFunctions.FillDataTableBlocking("SELECT * FROM vw_Schemainformation WHERE IsCurrent=1", out dtTemp,
553 + false,null);
529 554 if (ret.Successful == false)
530 555 {
531 556 RaiseErrorEvent("Unable to pull SchemaInformation data in InitVersionInfo - cannot fetch version.");
  @@ -693,12 +718,13 @@
693 718
694 719 DatabaseFunctions.Disconnect();
695 720
696 - var res=DatabaseFunctions.AttachToDatabase(this.DatabaseServerIpAddress, this.DatabaseLoginName,this.DatabaseLoginPassword);
721 + var res=DatabaseFunctions.AttachToDatabase(this.DatabaseServerIpAddress, this.DatabaseLoginName,this.DatabaseLoginPassword,pNewDbName);
697 722
698 723 if (res.Successful == false)
699 724 {
700 725 DatabaseConnectionStatus = ConnectionStatus.LoginFailed;
701 726 RaiseErrorEvent("(error) while changing databases in ChangeActiveDatabase: " + res);
727 + return false;
702 728 }
703 729
704 730 //update the status to show connected status
  @@ -721,38 +747,41 @@
721 747 /// When restoring hot mode systems you do not want to pause networking functions, otherwise you want to stop them in addition to
722 748 /// the grammar compiles when doing large numbers of edits.
723 749 /// </param>
724 - public void LargeDbOperationPause(bool pPauseNetworking)
750 + public bool LargeDbOperationPause(bool pPauseNetworking)
725 751 {
726 752 RaiseDebugEvent("[DEBUG] entering LargeDbOperationPause on ConnectionServerOdbc.cs");
727 753
728 - if (DatabaseFunctions.StartNewCommand("csp_grammarcompilepause") == false)
754 + if (DatabaseFunctions.StartNewCommand("csp_grammarcompilepause",true) == false)
729 755 {
730 - return;
756 + return false;
731 757 }
732 758
733 759 DbFetchResult res = DatabaseFunctions.ExecuteProc();
734 760 if (res.Successful == false)
735 761 {
736 762 RaiseErrorEvent("(error) in LargeDbOperationPause pausing grammar compiles on ConnectionServerOdbc.cs:"+res);
763 + return false;
737 764 }
738 765
739 766
740 767 if (pPauseNetworking)
741 768 {
742 - if (DatabaseFunctions.StartNewCommand("csp_networkreplicationpause") == false)
769 + if (DatabaseFunctions.StartNewCommand("csp_networkreplicationpause",true) == false)
743 770 {
744 - return;
771 + return false;
745 772 }
746 773 res = DatabaseFunctions.ExecuteProc();
747 774 if (res.Successful == false)
748 775 {
749 - RaiseErrorEvent("(error) in LargeDbOperationPause pausing networking replication on ConnectionServerOdbc.cs:" +
750 - res);
776 + RaiseErrorEvent("(error) in LargeDbOperationPause pausing networking replication on ConnectionServerOdbc.cs:" +res);
777 + return false;
751 778 }
779 +
752 780 }
753 781
754 782 //'make a note off the time we called these pauses - we'll need to call this again if the import takes more than 10 minutes.
755 783 TimeOfLastLargeOperationsPause = DateTime.Now;
784 + return true;
756 785 }
757 786
758 787