Safe Haskell | None |
---|---|
Language | Haskell2010 |
Database.ClickHouseDriver.Connection
Description
This module contains the implementations of communication with Clickhouse server. Most of functions are for internal use. User should just use Database.ClickHouseDriver.
Synopsis
- tcpConnect :: ByteString -> ByteString -> ByteString -> ByteString -> ByteString -> Bool -> IO (Either String TCPConnection)
- sendQuery :: TCPConnection -> ByteString -> Maybe ByteString -> IO ()
- receiveData :: ServerInfo -> Reader Block
- sendData :: TCPConnection -> ByteString -> Maybe Block -> IO ()
- receiveResult :: ServerInfo -> QueryInfo -> Reader (Either String CKResult)
- closeConnection :: TCPConnection -> IO ()
- processInsertQuery :: TCPConnection -> ByteString -> Maybe ByteString -> [[ClickhouseType]] -> IO ByteString
- ping' :: Int -> TCPConnection -> IO (Maybe String)
- versionTuple :: ServerInfo -> (Word, Word, Word)
- sendCancel :: TCPConnection -> IO ()
Documentation
Arguments
:: ByteString | host name to connect |
-> ByteString | port name to connect. Default would be 8123 |
-> ByteString | username. Default would be "default" |
-> ByteString | password. Default would be empty string |
-> ByteString | database. Default would be "default" |
-> Bool | choose if send and receive data in compressed form. Default would be False. |
-> IO (Either String TCPConnection) |
connect to database through TCP port, used in Client module.
Arguments
:: TCPConnection | To get socket and server info |
-> ByteString | SQL statement |
-> Maybe ByteString | query_id if any |
-> IO () |
receiveData :: ServerInfo -> Reader Block Source #
Read data from stream.
Arguments
:: TCPConnection | To get socket and context |
-> ByteString | table name |
-> Maybe Block | a block data if any |
-> IO () |
Arguments
:: ServerInfo | Server information |
-> QueryInfo | Query information |
-> Reader (Either String CKResult) | Receive either error message or query result. |
Transform received query data into Clickhouse type
closeConnection :: TCPConnection -> IO () Source #
Arguments
:: TCPConnection | source |
-> ByteString | query without data |
-> Maybe ByteString | query id |
-> [[ClickhouseType]] | data in Haskell type. |
-> IO ByteString | return 1 if insertion successfully completed |
Arguments
:: Int | Time limit |
-> TCPConnection | host name, port number, and socket are needed |
-> IO (Maybe String) | response |
internal implementation for ping test.
versionTuple :: ServerInfo -> (Word, Word, Word) Source #
This module mainly focuses how to make connection | to clickhouse database and protocols to send and receive data
sendCancel :: TCPConnection -> IO () Source #
Cancel last query sent to server