SqlServerSupport
class in package klyn.databases.sql.sqlserver

    public class SqlServerSupport:

SqlServerSupport

Protocol helpers for Microsoft SQL Server TDS (Tabular Data Stream).

TDS is the application-layer protocol used by SQL Server for all client-server communication. This implementation focuses on TDS 7.4 (SQL Server 2012+) with support for:

- Pre-login handshake with TLS negotiation
- Login with SQL Server authentication
- Simple query execution
- Result set parsing

    import klyn.databases.sql.sqlserver

    # TDS packet types
    print(SqlServerSupport.TDS_QUERY)  # 1

Fields

Modifier and Type | Member | Description
--- | --- | ---
public static readonly | DRIVER_NAME `DRIVER_NAME as String = "Klyn SQL Server Driver"` | No summary.
public static readonly | DRIVER_VERSION `DRIVER_VERSION as String = "0.1"` | No summary.
public static readonly | ENCRYPT_NOT_SUP `ENCRYPT_NOT_SUP as Int = 2` | No summary.
public static readonly | ENCRYPT_OFF `ENCRYPT_OFF as Int = 0` | No summary.
public static readonly | ENCRYPT_ON `ENCRYPT_ON as Int = 1` | No summary.
public static readonly | ENCRYPT_REQ `ENCRYPT_REQ as Int = 3` | No summary.
public static readonly | PRELOGIN_ENCRYPTION `PRELOGIN_ENCRYPTION as Int = 1` | No summary.
public static readonly | PRELOGIN_FEDAUTHREQUIRED `PRELOGIN_FEDAUTHREQUIRED as Int = 6` | No summary.
public static readonly | PRELOGIN_INSTOPT `PRELOGIN_INSTOPT as Int = 2` | No summary.
public static readonly | PRELOGIN_MARS `PRELOGIN_MARS as Int = 4` | No summary.
public static readonly | PRELOGIN_NONCEOPT `PRELOGIN_NONCEOPT as Int = 7` | No summary.
public static readonly | PRELOGIN_TERMINATOR `PRELOGIN_TERMINATOR as Int = 255` | No summary.
public static readonly | PRELOGIN_THREADID `PRELOGIN_THREADID as Int = 3` | No summary.
public static readonly | PRELOGIN_TRACEID `PRELOGIN_TRACEID as Int = 5` | No summary.
public static readonly | PRELOGIN_VERSION `PRELOGIN_VERSION as Int = 0` | No summary.
public static readonly | PRODUCT_NAME `PRODUCT_NAME as String = "Microsoft SQL Server"` | No summary.
public static readonly | SQLTYPE_BIGINT `SQLTYPE_BIGINT as Int = 127` | No summary.
public static readonly | SQLTYPE_BINARY `SQLTYPE_BINARY as Int = 173` | No summary.
public static readonly | SQLTYPE_BINARY_LEGACY `SQLTYPE_BINARY_LEGACY as Int = 45` | No summary.
public static readonly | SQLTYPE_BIT `SQLTYPE_BIT as Int = 104` | No summary.
public static readonly | SQLTYPE_BITN `SQLTYPE_BITN as Int = 104` | No summary.
public static readonly | SQLTYPE_CHAR `SQLTYPE_CHAR as Int = 175` | No summary.
public static readonly | SQLTYPE_CHAR_LEGACY `SQLTYPE_CHAR_LEGACY as Int = 47` | No summary.
public static readonly | SQLTYPE_DATE `SQLTYPE_DATE as Int = 40` | No summary.
public static readonly | SQLTYPE_DATETIME `SQLTYPE_DATETIME as Int = 61` | No summary.
public static readonly | SQLTYPE_DATETIME2 `SQLTYPE_DATETIME2 as Int = 42` | No summary.
public static readonly | SQLTYPE_DATETIMEOFFSET `SQLTYPE_DATETIMEOFFSET as Int = 43` | No summary.
public static readonly | SQLTYPE_DATETIMN `SQLTYPE_DATETIMN as Int = 111` | No summary.
public static readonly | SQLTYPE_DECIMAL `SQLTYPE_DECIMAL as Int = 106` | No summary.
public static readonly | SQLTYPE_FLOAT `SQLTYPE_FLOAT as Int = 62` | No summary.
public static readonly | SQLTYPE_FLTN `SQLTYPE_FLTN as Int = 109` | No summary.
public static readonly | SQLTYPE_IMAGE `SQLTYPE_IMAGE as Int = 241` | No summary.
public static readonly | SQLTYPE_INT `SQLTYPE_INT as Int = 56` | No summary.
public static readonly | SQLTYPE_INTN `SQLTYPE_INTN as Int = 38` | No summary.
public static readonly | SQLTYPE_MONEY `SQLTYPE_MONEY as Int = 60` | No summary.
public static readonly | SQLTYPE_MONEYN `SQLTYPE_MONEYN as Int = 110` | No summary.
public static readonly | SQLTYPE_NCHAR `SQLTYPE_NCHAR as Int = 239` | No summary.
public static readonly | SQLTYPE_NTEXT `SQLTYPE_NTEXT as Int = 99` | No summary.
public static readonly | SQLTYPE_NUMERIC `SQLTYPE_NUMERIC as Int = 108` | No summary.
public static readonly | SQLTYPE_NVARCHAR `SQLTYPE_NVARCHAR as Int = 231` | No summary.
public static readonly | SQLTYPE_REAL `SQLTYPE_REAL as Int = 59` | No summary.
public static readonly | SQLTYPE_SMALLDATETIME `SQLTYPE_SMALLDATETIME as Int = 58` | No summary.
public static readonly | SQLTYPE_SMALLINT `SQLTYPE_SMALLINT as Int = 52` | No summary.
public static readonly | SQLTYPE_SMALLMONEY `SQLTYPE_SMALLMONEY as Int = 122` | No summary.
public static readonly | SQLTYPE_TEXT `SQLTYPE_TEXT as Int = 35` | No summary.
public static readonly | SQLTYPE_TIME `SQLTYPE_TIME as Int = 41` | No summary.
public static readonly | SQLTYPE_TIMESTAMP `SQLTYPE_TIMESTAMP as Int = 80` | No summary.
public static readonly | SQLTYPE_TINYINT `SQLTYPE_TINYINT as Int = 48` | No summary.
public static readonly | SQLTYPE_UNIQUEIDENTIFIER `SQLTYPE_UNIQUEIDENTIFIER as Int = 36` | No summary.
public static readonly | SQLTYPE_VARBINARY `SQLTYPE_VARBINARY as Int = 165` | No summary.
public static readonly | SQLTYPE_VARBINARY_LEGACY `SQLTYPE_VARBINARY_LEGACY as Int = 37` | No summary.
public static readonly | SQLTYPE_VARCHAR `SQLTYPE_VARCHAR as Int = 167` | No summary.
public static readonly | SQLTYPE_VARCHAR_LEGACY `SQLTYPE_VARCHAR_LEGACY as Int = 39` | No summary.
public static readonly | SQLTYPE_XML `SQLTYPE_XML as Int = 241` | No summary.
public static readonly | TDS_CLOSE `TDS_CLOSE as Int = 21` | No summary.
public static readonly | TDS_LOGIN7 `TDS_LOGIN7 as Int = 16` | No summary.
public static readonly | TDS_PRELOGIN `TDS_PRELOGIN as Int = 18` | No summary.
public static readonly | TDS_QUERY `TDS_QUERY as Int = 1` | No summary.
public static readonly | TDS_RPC `TDS_RPC as Int = 3` | No summary.
public static readonly | TDS_SSPI `TDS_SSPI as Int = 17` | No summary.
public static readonly | TDS_TOKENS `TDS_TOKENS as Int = 4` | No summary.
public static readonly | TDS_TOKEN_ALTMETADATA `TDS_TOKEN_ALTMETADATA as Int = 160` | No summary.
public static readonly | TDS_TOKEN_ALTROW `TDS_TOKEN_ALTROW as Int = 161` | No summary.
public static readonly | TDS_TOKEN_COLINFO `TDS_TOKEN_COLINFO as Int = 165` | No summary.
public static readonly | TDS_TOKEN_COLMETADATA `TDS_TOKEN_COLMETADATA as Int = 129` | No summary.
public static readonly | TDS_TOKEN_DONE `TDS_TOKEN_DONE as Int = 253` | No summary.
public static readonly | TDS_TOKEN_DONEINSTREAM `TDS_TOKEN_DONEINSTREAM as Int = 255` | No summary.
public static readonly | TDS_TOKEN_DONEPROC `TDS_TOKEN_DONEPROC as Int = 254` | No summary.
public static readonly | TDS_TOKEN_ENVCHANGE `TDS_TOKEN_ENVCHANGE as Int = 227` | No summary.
public static readonly | TDS_TOKEN_ERROR `TDS_TOKEN_ERROR as Int = 170` | No summary.
public static readonly | TDS_TOKEN_FEATUREEXTACK `TDS_TOKEN_FEATUREEXTACK as Int = 174` | No summary.
public static readonly | TDS_TOKEN_INFO `TDS_TOKEN_INFO as Int = 171` | No summary.
public static readonly | TDS_TOKEN_LOGINACK `TDS_TOKEN_LOGINACK as Int = 173` | No summary.
public static readonly | TDS_TOKEN_NBCROW `TDS_TOKEN_NBCROW as Int = 210` | No summary.
public static readonly | TDS_TOKEN_ORDERBY `TDS_TOKEN_ORDERBY as Int = 169` | No summary.
public static readonly | TDS_TOKEN_RETURNSTATUS `TDS_TOKEN_RETURNSTATUS as Int = 121` | No summary.
public static readonly | TDS_TOKEN_RETURNVALUE `TDS_TOKEN_RETURNVALUE as Int = 172` | No summary.
public static readonly | TDS_TOKEN_ROW `TDS_TOKEN_ROW as Int = 209` | No summary.
public static readonly | TDS_TOKEN_SSPI `TDS_TOKEN_SSPI as Int = 237` | No summary.
public static readonly | TDS_TOKEN_TABNAME `TDS_TOKEN_TABNAME as Int = 164` | No summary.
public static readonly | TDS_VERSION_7_4 `TDS_VERSION_7_4 as Int = 0x74000004` | No summary.

Methods

Modifier and Type | Member | Description
--- | --- | ---
public static | _ubyte `_ubyte(value as Byte) as Int:` | No summary.
public static | buildLogin7Packet `buildLogin7Packet(options as SqlServerOptions) as Byte[]:` | Builds a TDS login7 packet.
public static | buildPreLoginPacket `buildPreLoginPacket(options as SqlServerOptions) as Byte[]:` | Builds a TDS pre-login packet.
public static | byteToHex `byteToHex(value as Int) as String:` | No summary.
public static | convertValue `convertValue(raw as String, sqlType as Int) as Object:` | Converts a raw string value to the appropriate Klyn type based on SQL type.
public static | decodeUtf16Le `decodeUtf16Le(data as Byte[]) as String:` | No summary.
public static | encodeUrlComponent `encodeUrlComponent(input as String) as String:` | Encodes a string for URL usage.
public static | isDoneToken `isDoneToken(tokenType as Int) as Boolean:` | Checks if a token indicates end of results.
public static | obfuscatePassword `obfuscatePassword(password as String) as Byte[]:` | No summary.
public static | parseExecutionResponse `parseExecutionResponse(payload as Byte[], statement as Statement = null, resultSetType as ResultSetType = ResultSetType.FORWARD_ONLY, concurrency as ResultSetConcurrency = ResultSetConcurrency.READ_ONLY, holdability as ResultSetHoldability = ResultSetHoldability.CLOSE_CURSORS_AT_COMMIT) as SqlServerExecutionResult throws SQLException:` | Parses a SQL execution response token stream.
public static | parseLoginResponse `parseLoginResponse(payload as Byte[]) as Map<String, Object> throws SQLException:` | Parses a login response token stream.
public static | parsePreLoginResponse `parsePreLoginResponse(data as Byte[]) as Map<String, Object>:` | Parses a pre-login response packet.
public static | parseUrl `parseUrl(url as String, properties as Map<String, String> = null) as SqlServerOptions throws SQLException:` | Parses a connection URL into SqlServerOptions.
public static | sqlTypeToKlynType `sqlTypeToKlynType(sqlType as Int) as Int:` | Converts a SQL Server type code to Klyn Types constant.
public static | stringToUtf16LeBytes `stringToUtf16LeBytes(text as String) as Byte[]:` | Converts a String to UTF-16LE bytes.
public static | stringToUtf8Bytes `stringToUtf8Bytes(text as String) as Byte[]:` | Converts a String to UTF-8 bytes.