Skip to content

Instantly share code, notes, and snippets.

View saurabh500's full-sized avatar
Working !

Saurabh Singh saurabh500

Working !
  • Microsoft Corp
View GitHub Profile
@saurabh500
saurabh500 / Cargo.toml
Last active August 16, 2026 20:19
mssql-rs: making decimal/numeric decode faster on top of PR #311 — six recommendations, measured (5.2x text path, 9.5x binary path)
[package]
name = "tds-numeric-bench"
version = "0.1.0"
edition = "2021"
[dependencies]
byteorder = "1"
[dev-dependencies]
criterion = "0.5"
@saurabh500
saurabh500 / README.md
Created August 16, 2026 05:51
FDW-like mssql-tds Criterion benchmark: POC vs PR stack through #299

FDW-like mssql-tds Criterion comparison

This gist compares the exact mssql-tds revisions used by:

  • the pg_fabric branch poc/tds-decode-fdw-usage: NivasSA/mssql-rs@9df51f01fc85f89d56f03fd3fd64d4a15c01ce60
  • the Microsoft mssql-rs PR stack ending in PR #299: microsoft/mssql-rs@2bfac1d4c284f565dc4269e9b1cf7bacbb63d4c8

It runs entirely from an mssql-rs clone. pg_fabric_fdw and PostgreSQL are

@saurabh500
saurabh500 / sql-server-docker.md
Last active May 9, 2026 14:10
SQL Server in Docker — quick start with sqlcmd, Azure Data Studio & DBeaver

SQL Server in Docker — Quick Start 🐳

Launch Microsoft SQL Server in Docker and connect to it using sqlcmd.

1. Pull & Run SQL Server

docker run -d \
  --name sqlserver \
 -e "ACCEPT_EULA=Y" \

Check TLS Protocol and Driver Version for SQL Server Connections Using Extended Events

This guide shows how to use SQL Server Extended Events to determine the TLS protocol version and driver version used by client connections.

Prerequisites

  • SQL Server 2016 or later
  • Permissions: ALTER ANY EVENT SESSION and VIEW SERVER STATE
  • A query tool such as SSMS or sqlcmd

A Stored proc for testing input and output param. Whatever is sent in, is sent back.

CREATE PROCEDURE #test_proc 
        @paramIn int, 
        @paramOut int output 
        AS 
        set @paramOut = @paramIn
@saurabh500
saurabh500 / Build.md
Created September 5, 2024 18:10
Building and testing .Net core driver on linux

Requires Ubuntu 22.04

  1. Install dotnet sdk 8.0
  2. Install pwsh
dotnet build -p:OSGroup=Unix -t:BuildNetCore
dotnet build -p:OSGroup=Unix -t:BuildTestsNetCore	
@saurabh500
saurabh500 / DiscussionClientXIO.md
Last active July 19, 2024 23:14
Streams in SQL Client

Purpose:

Starting this discussion thread to brainstorm the future of SqlClientX I/O to be performant, while adhering to the various requirements

Transport requirements

  1. Named Pipes
  2. Shared Memory (it is essentially Named pipe with a special NP path)
  3. TCP

Nothing to see here.

@saurabh500
saurabh500 / SqlDbType and SqlTypes.md
Last active July 12, 2024 20:34
Json Type support in SQL Server

Any datatype support in SqlClient depends on System.Data.SqlDbType being enhanced to provide the enum for the datatype being added. At the same time, a SqlType needs to be exposed which will allows the clients to represent the internals of the JSON datatype.

SqlDbType is an enum which is shipped as part of System.Data.Common.dll in dotnet/runtime and in netfx, the type is shipped from System.Data.dll

Typically all the drivers like Npgsql and Oracle's data provider for ADO.Net have their own Types enum, which ships with the driver. NpgSqlDbType and OracleDbType

However there are implementations in dotnet/runtime which depend on SqlDbType. These implementations were ported from .Net framework and to light up the implementation, the SqlDbType had to be shipped with dotnet/runtime.

@saurabh500
saurabh500 / Chain of responsibilities.md
Last active July 1, 2024 17:02
Explanation of Chain of handlers

Chain of handlers in Sql Connection open.

The following handlers are used during connection establishment.

graph LR
    A[DataSourceHandler] --> B[TransportHandler]
    B --> C[PreLoginHandler]
 C --> D[LoginHandler]