mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-31 01:25:42 -05:00
Added missing properties for databases and server (#373)
* added get database info to admin service * refactored code to be inline with standard * added comments to utils functions * added comments to public classes * added machine name to serverinfo from connection; added last backupdate and last log backup date to database info * removed camelcase from request type * removed the wrapper for the generic dictionary * removed unnecessary imports * merged master * changed datetime compare to equality operator * added database compatability level to info * renamed field * fixed CompatibilityLevel string typo, added bakcup dates to capabilities list
This commit is contained in:
@@ -38,6 +38,8 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin
|
||||
public string collation;
|
||||
|
||||
public RecoveryModel recoveryModel;
|
||||
public DateTime lastBackupDate;
|
||||
public DateTime lastLogBackupDate;
|
||||
public DatabaseUserAccess restrictAccess;
|
||||
public DatabaseStatus databaseState;
|
||||
public DefaultCursor defaultCursor;
|
||||
@@ -373,6 +375,16 @@ WHERE do.database_id = @DbID
|
||||
this.recoveryModel = db.DatabaseOptions.RecoveryModel;
|
||||
}
|
||||
|
||||
if (db.IsSupportedProperty("LastBackupDate"))
|
||||
{
|
||||
this.lastBackupDate = db.LastBackupDate;
|
||||
}
|
||||
|
||||
if (db.IsSupportedProperty("LastLogBackupDate"))
|
||||
{
|
||||
this.lastLogBackupDate = db.LastLogBackupDate;
|
||||
}
|
||||
|
||||
if (Utils.IsSql12OrLater(context.Server.Information.Version.Major))
|
||||
{
|
||||
this.autoCreateStatisticsIncremental = db.DatabaseOptions.AutoCreateStatisticsIncremental;
|
||||
@@ -651,6 +663,8 @@ WHERE do.database_id = @DbID
|
||||
this.name = other.name;
|
||||
this.collation = other.collation;
|
||||
this.recoveryModel = other.recoveryModel;
|
||||
this.lastBackupDate = other.lastBackupDate;
|
||||
this.lastLogBackupDate = other.lastLogBackupDate;
|
||||
this.restrictAccess = other.restrictAccess;
|
||||
this.databaseState = other.databaseState;
|
||||
this.defaultCursor = other.defaultCursor;
|
||||
@@ -730,6 +744,8 @@ WHERE do.database_id = @DbID
|
||||
{
|
||||
bool result =
|
||||
(this.recoveryModel == other.recoveryModel) &&
|
||||
(this.lastBackupDate == other.lastBackupDate) &&
|
||||
(this.lastLogBackupDate == other.lastLogBackupDate) &&
|
||||
(this.restrictAccess == other.restrictAccess) &&
|
||||
(this.databaseState == other.databaseState) &&
|
||||
(this.defaultCursor == other.defaultCursor) &&
|
||||
@@ -891,6 +907,40 @@ WHERE do.database_id = @DbID
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The last backup date for the database
|
||||
/// </summary>
|
||||
[Browsable(false)]
|
||||
public DateTime LastBackupDate
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.currentState.lastBackupDate;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.currentState.lastBackupDate = value;
|
||||
this.NotifyObservers();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The last log backup date for the database
|
||||
/// </summary>
|
||||
[Browsable(false)]
|
||||
public DateTime LastLogBackupDate
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.currentState.lastLogBackupDate;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.currentState.lastLogBackupDate = value;
|
||||
this.NotifyObservers();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The collation for the database
|
||||
/// </summary>
|
||||
|
||||
@@ -108,6 +108,9 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin
|
||||
databaseInfo.Options.Add(AdminServicesProviderOptionsHelper.RecoveryModel, prototype.RecoveryModel.ToString());
|
||||
databaseInfo.Options.Add(AdminServicesProviderOptionsHelper.IsSystemDB, prototype.IsSystemDB.ToString());
|
||||
databaseInfo.Options.Add(AdminServicesProviderOptionsHelper.AnsiNulls, prototype.AnsiNulls.ToString());
|
||||
databaseInfo.Options.Add(AdminServicesProviderOptionsHelper.CompatibilityLevel, prototype.DatabaseCompatibilityLevel.ToString());
|
||||
databaseInfo.Options.Add(AdminServicesProviderOptionsHelper.LastBackupDate, prototype.LastBackupDate.ToString());
|
||||
databaseInfo.Options.Add(AdminServicesProviderOptionsHelper.LastLogBackupDate, prototype.LastLogBackupDate.ToString());
|
||||
|
||||
databaseInfo.Options.Add(
|
||||
AdminServicesProviderOptionsHelper.FileGroups + "Count",
|
||||
|
||||
Reference in New Issue
Block a user