hmssql
Safe HaskellNone
LanguageHaskell2010

Hmssql.Tds.Token

Description

Server tokens expressed as sequential reading recipes.

Synopsis

Documentation

data Token Source #

A token of a response, as readToken reads it.

Constructors

TColMetaData ![ColumnInfo]

0x81; empty when the server reports no columns

TRow !Row

0xD1 ROW or 0xD2 NBCROW; see Hmssql.Tds.Value

TDone !Done

0xFD

TDoneProc !Done

0xFE

TDoneInProc !Done

0xFF

TEnvChange !EnvChange

0xE3

TError !ServerMessage

0xAA

TInfo !ServerMessage

0xAB

TLoginAck !LoginAck

0xAD

TReturnStatus !Int32

0x79

TReturnValue !ReturnValue

0xAC

TOrder ![Word16]

0xA9

TColInfo !ByteString

0xA5, undecoded

TTabName !ByteString

0xA4, undecoded

TFeatureExtAck ![FeatureAck]

0xAE

TSessionState !ByteString

0xE4, undecoded

TFedAuthInfo !ByteString

0xEE, undecoded

TSspi !ByteString

0xED

TOffset !Word16 !Word16

0x78

Instances

Instances details
Show Token Source # 
Instance details

Defined in Hmssql.Tds.Token

Methods

showsPrec :: Int -> Token -> ShowS #

show :: Token -> String #

showList :: [Token] -> ShowS #

Eq Token Source # 
Instance details

Defined in Hmssql.Tds.Token

Methods

(==) :: Token -> Token -> Bool #

(/=) :: Token -> Token -> Bool #

data ColumnInfo Source #

A column of a result set, as its COLMETADATA describes it.

Constructors

ColumnInfo 

Fields

Instances

Instances details
Show ColumnInfo Source # 
Instance details

Defined in Hmssql.Tds.Token

Eq ColumnInfo Source # 
Instance details

Defined in Hmssql.Tds.Token

columnIsNullable :: ColumnInfo -> Bool Source #

Whether the column may hold NULL.

columnIsLong :: ColumnInfo -> Bool Source #

Whether a column's values may be of any length: a max type, xml, json, a CLR type, or a legacy text, ntext or image, which arrive in pieces rather than behind a length of at most 8,000 bytes. Such a column is the one to read with a FoldingCell or streamField.

data ResultSetInfo Source #

A result set's columns, prepared once for the rows that follow.

rsColumns :: ResultSetInfo -> [ColumnInfo] Source #

The columns, in order.

rsColumnCount :: ResultSetInfo -> Int Source #

How many columns the result set has.

rsCells :: ResultSetInfo -> [(Int, ColumnShape)] Source #

Each column's index, and how its values are delimited.

compileResultSet :: [ColumnInfo] -> ResultSetInfo Source #

Prepare a result set's columns for its rows.

tokenSizeLimit :: Int Source #

Maximum size of metadata tokens, which must not buffer unbounded input. Rows and output parameter values aren't bound by it: they cost their size.

lobAllocAhead :: Int Source #

Default maximum allocation ahead of received value bytes. A server that declares a value it doesn't send costs this much, not what it declared.

data Done Source #

A DONE, DONEPROC or DONEINPROC token: its status bits, which doneMore and the functions beside it read, the current command, and the row count.

Constructors

Done 

Fields

Instances

Instances details
Show Done Source # 
Instance details

Defined in Hmssql.Tds.Token

Methods

showsPrec :: Int -> Done -> ShowS #

show :: Done -> String #

showList :: [Done] -> ShowS #

Eq Done Source # 
Instance details

Defined in Hmssql.Tds.Token

Methods

(==) :: Done -> Done -> Bool #

(/=) :: Done -> Done -> Bool #

doneMore :: Done -> Bool Source #

The status bits: more results follow; the statement failed; a transaction is open; the row count is meaningful; the statement was canceled by an Attention; and the server failed the request.

doneError :: Done -> Bool Source #

The status bits: more results follow; the statement failed; a transaction is open; the row count is meaningful; the statement was canceled by an Attention; and the server failed the request.

doneInTransaction :: Done -> Bool Source #

The status bits: more results follow; the statement failed; a transaction is open; the row count is meaningful; the statement was canceled by an Attention; and the server failed the request.

doneHasCount :: Done -> Bool Source #

The status bits: more results follow; the statement failed; a transaction is open; the row count is meaningful; the statement was canceled by an Attention; and the server failed the request.

doneAttention :: Done -> Bool Source #

The status bits: more results follow; the statement failed; a transaction is open; the row count is meaningful; the statement was canceled by an Attention; and the server failed the request.

doneServerError :: Done -> Bool Source #

The status bits: more results follow; the statement failed; a transaction is open; the row count is meaningful; the statement was canceled by an Attention; and the server failed the request.

data EnvChange Source #

An ENVCHANGE token: what changed in the session, with the old and the new value where the token carries both.

Instances

Instances details
Show EnvChange Source # 
Instance details

Defined in Hmssql.Tds.Token

Eq EnvChange Source # 
Instance details

Defined in Hmssql.Tds.Token

data RoutingInfo Source #

Where a routing ENVCHANGE sends the login: the protocol (0 is TCP), the port and the server.

Instances

Instances details
Show RoutingInfo Source # 
Instance details

Defined in Hmssql.Tds.Token

Eq RoutingInfo Source # 
Instance details

Defined in Hmssql.Tds.Token

data ServerMessage Source #

A message from the server: an error (SqlServerError) or an informational message (PRINT output, a low-severity message; connectOnInfoMessage).

Constructors

ServerMessage 

Fields

Instances

Instances details
Show ServerMessage Source # 
Instance details

Defined in Hmssql.Tds.Token

Eq ServerMessage Source # 
Instance details

Defined in Hmssql.Tds.Token

data LoginAck Source #

The LOGINACK token: the interface, the TDS version the server chose, and the server's name and version.

Instances

Instances details
Show LoginAck Source # 
Instance details

Defined in Hmssql.Tds.Token

Eq LoginAck Source # 
Instance details

Defined in Hmssql.Tds.Token

data ReturnValue Source #

A RETURNVALUE token: an output parameter's value, or a function's return value, after a call.

Instances

Instances details
Show ReturnValue Source # 
Instance details

Defined in Hmssql.Tds.Token

Eq ReturnValue Source # 
Instance details

Defined in Hmssql.Tds.Token

data FeatureAck Source #

One acknowledgment of a LOGIN7 feature extension, from a FEATUREEXTACK token.

Constructors

FeatureAck 

Instances

Instances details
Show FeatureAck Source # 
Instance details

Defined in Hmssql.Tds.Token

Eq FeatureAck Source # 
Instance details

Defined in Hmssql.Tds.Token

readToken :: Maybe ResultSetInfo -> Parser Token Source #

One token as a recipe, given the current result set's columns. It reads from the parser's input and suspends when that runs out, so nothing here knows about packets, sessions or the end of a message.

readTokenWith :: Int -> Maybe ResultSetInfo -> Parser Token Source #

readToken with the bound on allocating ahead of a value's bytes.

readTokenSkipping :: Maybe ResultSetInfo -> Parser Token Source #

readToken for a drain, which skips values rather than assembling them.

doneOf :: Token -> Maybe Done Source #

The DONE, DONEPROC or DONEINPROC a token is, if it is flagged as failed (DONE_ERROR or DONE_SRVERROR). In a response with no ERROR token that is all the server says of a failed request (SevereError).

isFinalDone :: Token -> Bool Source #

A DONE-family token without MORE ends the response.