| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Hmssql.Tds.Token
Description
Server tokens expressed as sequential reading recipes.
Synopsis
- data Token
- = TColMetaData ![ColumnInfo]
- | TRow !Row
- | TDone !Done
- | TDoneProc !Done
- | TDoneInProc !Done
- | TEnvChange !EnvChange
- | TError !ServerMessage
- | TInfo !ServerMessage
- | TLoginAck !LoginAck
- | TReturnStatus !Int32
- | TReturnValue !ReturnValue
- | TOrder ![Word16]
- | TColInfo !ByteString
- | TTabName !ByteString
- | TFeatureExtAck ![FeatureAck]
- | TSessionState !ByteString
- | TFedAuthInfo !ByteString
- | TSspi !ByteString
- | TOffset !Word16 !Word16
- data ColumnInfo = ColumnInfo {
- columnName :: !Text
- columnType :: !TypeInfo
- columnFlags :: !Word16
- columnUserType :: !Word32
- columnTableName :: !(Maybe [Text])
- columnIsNullable :: ColumnInfo -> Bool
- columnIsLong :: ColumnInfo -> Bool
- data ResultSetInfo
- rsColumns :: ResultSetInfo -> [ColumnInfo]
- rsColumnArray :: ResultSetInfo -> SmallArray ColumnInfo
- rsColumnCount :: ResultSetInfo -> Int
- rsCells :: ResultSetInfo -> [(Int, ColumnShape)]
- compileResultSet :: [ColumnInfo] -> ResultSetInfo
- tokenSizeLimit :: Int
- lobAllocAhead :: Int
- data Done = Done {
- doneStatus :: !Word16
- doneCurCmd :: !Word16
- doneRowCount :: !Word64
- doneMore :: Done -> Bool
- doneError :: Done -> Bool
- doneInTransaction :: Done -> Bool
- doneHasCount :: Done -> Bool
- doneAttention :: Done -> Bool
- doneServerError :: Done -> Bool
- data EnvChange
- = ECDatabase { }
- | ECLanguage { }
- | ECCharacterSet { }
- | ECPacketSize { }
- | ECUnicodeSortingLocale { }
- | ECUnicodeComparisonFlags { }
- | ECSqlCollation {
- oldBytes :: !ByteString
- newBytes :: !ByteString
- | ECBeginTransaction { }
- | ECCommitTransaction { }
- | ECRollbackTransaction { }
- | ECEnlistDtcTransaction { }
- | ECDefectTransaction { }
- | ECMirroringPartner { }
- | ECPromoteTransaction {
- dtcToken :: !ByteString
- | ECTransactionManagerAddress {
- newBytes :: !ByteString
- | ECTransactionEnded { }
- | ECResetConnectionAck
- | ECUserInstance { }
- | ECRouting {
- routing :: !RoutingInfo
- | ECUnknown {
- envChangeType :: !Word8
- payload :: !ByteString
- data RoutingInfo = RoutingInfo {
- routingProtocol :: !Word8
- routingPort :: !Word16
- routingServer :: !Text
- data ServerMessage = ServerMessage {}
- data LoginAck = LoginAck {
- laInterface :: !Word8
- laTdsVersion :: !Word32
- laProgName :: !Text
- laProgVersion :: !(Word8, Word8, Word8, Word8)
- data ReturnValue = ReturnValue {}
- data FeatureAck = FeatureAck {
- featureId :: !Word8
- featureData :: !ByteString
- readToken :: Maybe ResultSetInfo -> Parser Token
- readTokenWith :: Int -> Maybe ResultSetInfo -> Parser Token
- readTokenSkipping :: Maybe ResultSetInfo -> Parser Token
- doneOf :: Token -> Maybe Done
- isFinalDone :: Token -> Bool
- failedDoneOf :: Token -> Maybe Done
Documentation
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 |
data ColumnInfo Source #
A column of a result set, as its COLMETADATA describes it.
Constructors
| ColumnInfo | |
Fields
| |
Instances
| Show ColumnInfo Source # | |
Defined in Hmssql.Tds.Token Methods showsPrec :: Int -> ColumnInfo -> ShowS # show :: ColumnInfo -> String # showList :: [ColumnInfo] -> ShowS # | |
| Eq ColumnInfo Source # | |
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.
rsColumnArray :: ResultSetInfo -> SmallArray ColumnInfo Source #
The same, for indexing.
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.
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
| |
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.
An ENVCHANGE token: what changed in the session, with the old and the new value where the token carries both.
Constructors
| ECDatabase | |
| ECLanguage | |
| ECCharacterSet | |
| ECPacketSize | |
| ECUnicodeSortingLocale | |
| ECUnicodeComparisonFlags | |
| ECSqlCollation | |
Fields
| |
| ECBeginTransaction | |
Fields | |
| ECCommitTransaction | |
Fields | |
| ECRollbackTransaction | |
Fields | |
| ECEnlistDtcTransaction | |
Fields | |
| ECDefectTransaction | |
Fields | |
| ECMirroringPartner | |
| ECPromoteTransaction | |
Fields
| |
| ECTransactionManagerAddress | |
Fields
| |
| ECTransactionEnded | |
Fields | |
| ECResetConnectionAck | |
| ECUserInstance | |
| ECRouting | |
Fields
| |
| ECUnknown | |
Fields
| |
data RoutingInfo Source #
Where a routing ENVCHANGE sends the login: the protocol (0 is TCP), the port and the server.
Constructors
| RoutingInfo | |
Fields
| |
Instances
| Show RoutingInfo Source # | |
Defined in Hmssql.Tds.Token Methods showsPrec :: Int -> RoutingInfo -> ShowS # show :: RoutingInfo -> String # showList :: [RoutingInfo] -> ShowS # | |
| Eq RoutingInfo Source # | |
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
| Show ServerMessage Source # | |
Defined in Hmssql.Tds.Token Methods showsPrec :: Int -> ServerMessage -> ShowS # show :: ServerMessage -> String # showList :: [ServerMessage] -> ShowS # | |
| Eq ServerMessage Source # | |
Defined in Hmssql.Tds.Token Methods (==) :: ServerMessage -> ServerMessage -> Bool # (/=) :: ServerMessage -> ServerMessage -> Bool # | |
The LOGINACK token: the interface, the TDS version the server chose, and the server's name and version.
Constructors
| LoginAck | |
Fields
| |
Instances
data ReturnValue Source #
A RETURNVALUE token: an output parameter's value, or a function's return value, after a call.
Constructors
| ReturnValue | |
Instances
| Show ReturnValue Source # | |
Defined in Hmssql.Tds.Token Methods showsPrec :: Int -> ReturnValue -> ShowS # show :: ReturnValue -> String # showList :: [ReturnValue] -> ShowS # | |
| Eq ReturnValue Source # | |
Defined in Hmssql.Tds.Token | |
data FeatureAck Source #
One acknowledgment of a LOGIN7 feature extension, from a FEATUREEXTACK token.
Constructors
| FeatureAck | |
Fields
| |
Instances
| Show FeatureAck Source # | |
Defined in Hmssql.Tds.Token Methods showsPrec :: Int -> FeatureAck -> ShowS # show :: FeatureAck -> String # showList :: [FeatureAck] -> ShowS # | |
| Eq FeatureAck Source # | |
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.