clickhouse-haskell-0.1.2.4: A Haskell library as database client for Clickhouse
Safe HaskellNone
LanguageHaskell2010

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

Documentation

tcpConnect Source #

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.

sendQuery Source #

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.

sendData Source #

Arguments

:: TCPConnection

To get socket and context

-> ByteString

table name

-> Maybe Block

a block data if any

-> IO () 

receiveResult Source #

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

processInsertQuery 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

ping' Source #

Arguments

:: Int

Time limit

-> TCPConnection

host name, port number, and socket are needed

-> IO (Maybe String)

response ping, or nothing indicating server is not properly connected.

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