SQL Type Wrappers

class ctds.SqlBigInt(value)

SQL BIGINT type wrapper.

Parameters

value (int) – The integer value to wrap or None.

size

The size of the type. This will be -1 for fixed size values.

tdstype

The TDS type code.

value

The wrapped Python value.

class ctds.SqlBinary(value)

SQL BINARY type wrapper.

Parameters

value (object) – The value to wrap or None.

size

The size of the type. This will be -1 for fixed size values.

tdstype

The TDS type code.

value

The wrapped Python value.

class ctds.SqlChar(value)

SQL CHAR type wrapper. The value’s UTF-8-encoded length must be <= 8000.

Parameters

value (object) – The value to wrap or None.

size

The size of the type. This will be -1 for fixed size values.

tdstype

The TDS type code.

value

The wrapped Python value.

class ctds.SqlDate(value)

SQL DATE type wrapper.

Parameters

value (datetime.date) – The date value to wrap or None.

size

The size of the type. This will be -1 for fixed size values.

tdstype

The TDS type code.

value

The wrapped Python value.

class ctds.SqlDecimal(value, precision=18, scale=0)

SQL DECIMAL type wrapper.

Parameters
  • value (object) – The value to wrap or None.

  • precision (int) – The maximum number of total digits stored. This must be between 1 and 38.

  • scale (int) – The maximum number of digits stored to the right of the decimal point. 0 <= scale <= precision.

size

The size of the type. This will be -1 for fixed size values.

tdstype

The TDS type code.

value

The wrapped Python value.

class ctds.SqlInt(value)

SQL INT type wrapper.

Parameters

value (int) – The integer value to wrap or None.

size

The size of the type. This will be -1 for fixed size values.

tdstype

The TDS type code.

value

The wrapped Python value.

class ctds.SqlNVarChar(value, size=None)

SQL NVARCHAR type wrapper.

New in version 1.1.

Parameters
  • value (object) – The value to wrap or None.

  • size (int) – An optional size override. This value will be used for the output parameter buffer size. It can also be used to truncate the input parameter.

size

The size of the type. This will be -1 for fixed size values.

tdstype

The TDS type code.

value

The wrapped Python value.

class ctds.SqlSmallInt(value)

SQL SMALLINT type wrapper.

Parameters

value (int) – The integer value to wrap or None.

size

The size of the type. This will be -1 for fixed size values.

tdstype

The TDS type code.

value

The wrapped Python value.

class ctds.SqlTinyInt(value)

SQL TINYINT type wrapper.

Parameters

value (int) – The integer value to wrap or None.

size

The size of the type. This will be -1 for fixed size values.

tdstype

The TDS type code.

value

The wrapped Python value.

class ctds.SqlVarBinary(value, size=None)

SQL VARBINARY type wrapper.

Parameters
  • value (object) – The value to wrap or None.

  • size (int) – An optional size override. This value will be used for the output parameter buffer size. It can also be used to truncate the input parameter.

size

The size of the type. This will be -1 for fixed size values.

tdstype

The TDS type code.

value

The wrapped Python value.

class ctds.SqlVarChar(value, size=None)

SQL VARCHAR type wrapper.

Note

Byte strings are passed through unchanged to the database.

Parameters
  • value (object) – The value to wrap or None.

  • size (int) – An optional size override. This value will be used for the output parameter buffer size. It can also be used to truncate the input parameter.

size

The size of the type. This will be -1 for fixed size values.

tdstype

The TDS type code.

value

The wrapped Python value.