|
| 1 | +using System.Globalization; |
| 2 | + |
| 3 | +namespace SqlServerSimulator; |
| 4 | + |
| 5 | +/// <summary> |
| 6 | +/// Single source of truth for the SQL Server reference build the simulator |
| 7 | +/// emulates. Every version-bearing surface derives from here — the |
| 8 | +/// <c>SERVERPROPERTY</c> version family, <c>@@VERSION</c> / |
| 9 | +/// <c>@@MICROSOFTVERSION</c>, <c>xp_msver</c>, |
| 10 | +/// <c>SimulatedDbConnection.ServerVersion</c>, and the TDS LOGINACK / |
| 11 | +/// prelogin VERSION bytes — so a reference-build refresh is a one-file bump. |
| 12 | +/// The graduated tests pin the derived literals independently |
| 13 | +/// (<c>ServerPropertyTests</c>, <c>XpMsverTests</c>), so a typo here fails |
| 14 | +/// the suite rather than propagating silently. |
| 15 | +/// </summary> |
| 16 | +internal static class ReferenceBuild |
| 17 | +{ |
| 18 | + /// <summary> |
| 19 | + /// SQL Server 2025 RTM-CU7 — the live reference instance behavior probes |
| 20 | + /// run against. SSMS gates report viewers and Activity Monitor on |
| 21 | + /// per-build client feature checks, so a real build number is |
| 22 | + /// load-bearing, not cosmetic. |
| 23 | + /// </summary> |
| 24 | + public static readonly Version Version = new(17, 0, 4065, 4); |
| 25 | + |
| 26 | + /// <summary>Servicing level paired with <see cref="Version"/> (<c>SERVERPROPERTY('ProductUpdateLevel')</c>).</summary> |
| 27 | + public const string UpdateLevel = "CU7"; |
| 28 | + |
| 29 | + /// <summary>Servicing KB paired with <see cref="Version"/> (<c>SERVERPROPERTY('ProductUpdateReference')</c>).</summary> |
| 30 | + public const string UpdateReference = "KB5096981"; |
| 31 | + |
| 32 | + /// <summary>"17.0.4065.4" — <c>SERVERPROPERTY('ProductVersion')</c> and the <c>xp_msver</c> ProductVersion row.</summary> |
| 33 | + public static readonly string ProductVersion = Version.ToString(); |
| 34 | + |
| 35 | + /// <summary>"17" — <c>SERVERPROPERTY('ProductMajorVersion')</c>.</summary> |
| 36 | + public static readonly string ProductMajorVersion = Version.Major.ToString(CultureInfo.InvariantCulture); |
| 37 | + |
| 38 | + /// <summary>"0" — <c>SERVERPROPERTY('ProductMinorVersion')</c>.</summary> |
| 39 | + public static readonly string ProductMinorVersion = Version.Minor.ToString(CultureInfo.InvariantCulture); |
| 40 | + |
| 41 | + /// <summary>"4065" — <c>SERVERPROPERTY('ProductBuild')</c>.</summary> |
| 42 | + public static readonly string ProductBuild = Version.Build.ToString(CultureInfo.InvariantCulture); |
| 43 | + |
| 44 | + /// <summary> |
| 45 | + /// "17.00.4065" (two-digit minor) — <c>SERVERPROPERTY('ResourceVersion')</c>, |
| 46 | + /// and the string real SqlClient computes from the LOGINACK version bytes, |
| 47 | + /// which <c>SimulatedDbConnection.ServerVersion</c> mirrors in-process. |
| 48 | + /// </summary> |
| 49 | + public static readonly string MajorMinorBuild = string.Create(CultureInfo.InvariantCulture, $"{Version.Major}.{Version.Minor:00}.{Version.Build}"); |
| 50 | + |
| 51 | + /// <summary> |
| 52 | + /// <c>@@MICROSOFTVERSION</c>: <c>(major << 24) | (minor << 16) | build</c> |
| 53 | + /// = 285216737 (0x11000FE1), matching the reference instance. |
| 54 | + /// </summary> |
| 55 | + public static readonly int MicrosoftVersion = (Version.Major << 24) | (Version.Minor << 16) | Version.Build; |
| 56 | + |
| 57 | + /// <summary> |
| 58 | + /// The <c>@@VERSION</c> banner: real's multi-line shape and build-date |
| 59 | + /// line, with the simulator's own identity standing in for the host-OS |
| 60 | + /// line. |
| 61 | + /// </summary> |
| 62 | + public static readonly string Banner = |
| 63 | + $"Microsoft SQL Server 2025 (RTM-{UpdateLevel}) ({UpdateReference}) - {ProductVersion} (X64) \n" + |
| 64 | + "\tJul 8 2026 23:26:08 \n" + |
| 65 | + "\tCopyright (C) 2025 Microsoft Corporation\n" + |
| 66 | + "\tDeveloper Edition (64-bit) on SQL Server Simulator"; |
| 67 | + |
| 68 | + /// <summary> |
| 69 | + /// The <c>xp_msver</c> FileVersion row. The encoding (product year, |
| 70 | + /// zero-padded major ×10, zero-padded revision, servicing-branch tag, |
| 71 | + /// build-date stamp) is the reference binary's literal file-version |
| 72 | + /// resource — not derivable, so bump it together with <see cref="Version"/>. |
| 73 | + /// </summary> |
| 74 | + public const string FileVersion = "2025.0170.4065.04 ((sql2025_rtm_qfe-cu7).260709-0512)"; |
| 75 | +} |
0 commit comments