Connection

Connection

Constructors

this
this(string connString)

Makes a new connection to the database server

this
this(ConnectionStart , string connString)

Starts creation of a connection to the database server in a nonblocking manner

Destructor

~this
~this()
Undocumented in source.

Members

Functions

cancel
void cancel()

Try to cancel query

consumeInput
void consumeInput()

If input is available from the server, consume it

createResultContainer
immutable(ResultContainer) createResultContainer(PGresult* r)

Get result after PQexec* functions or throw exception if pull is empty

dbName
string dbName()
errorMessage
string errorMessage()

Returns the error message most recently generated by an operation on the connection

escapeIdentifier
string escapeIdentifier(string msg)
escapeLiteral
string escapeLiteral(string msg)
flush
bool flush()
Undocumented in source. Be warned that the author may not have intended to support it.
getResult
immutable(Result) getResult()

Get next result after sending a non-blocking commands. Can return null.

host
string host()
isBusy
bool isBusy()
isNonBlocking
bool isNonBlocking()

Returns the blocking status of the database connection

parameterStatus
string parameterStatus(string paramName)
poll
PostgresPollingStatusType poll()

Useful only for non-blocking operations.

posixSocket
int posixSocket()

Obtains the file descriptor number of the connection socket to the server

posixSocketDuplicate
socket_t posixSocketDuplicate()

Obtains duplicate file descriptor number of the connection socket to the server

protocolVersion
int protocolVersion()
resetPoll
PostgresPollingStatusType resetPoll()

Useful only for non-blocking operations.

resetStart
void resetStart()

Begin reset the communication channel to the server, in a nonblocking manner

serverVersion
int serverVersion()
setClientEncoding
void setClientEncoding(string encoding)
setNoticeProcessor
PQnoticeProcessor setNoticeProcessor(PQnoticeProcessor proc, void* arg)

Sets or examines the current notice processor

setSingleRowMode
bool setSingleRowMode()

Select single-row mode for the currently-executing query

socket
Socket socket()

Obtains std.socket.Socket of the connection to the server

status
ConnStatusType status()

Returns the status of the connection

trace
void trace(File stream)
transactionStatus
PGTransactionStatusType transactionStatus()

Returns the current in-transaction status of the server. The status can be: * PQTRANS_IDLE - currently idle * PQTRANS_ACTIVE - a command is in progress (reported only when a query has been sent to the server and not yet completed) * PQTRANS_INTRANS - idle, in a valid transaction block * PQTRANS_INERROR - idle, in a failed transaction block * PQTRANS_UNKNOWN - reported if the connection is bad

untrace
void untrace()

Mixins

__anonymous
mixin Queries
Undocumented in source.

Variables

conn
PGconn* conn;
Undocumented in source.

Mixed In Members

From mixin Queries

exec
immutable(Answer) exec(string SQLcmd)

Perform SQL query to DB It uses the old wire protocol and all values are returned in textual form. This means that the dpq2.conv.to_d_types.as template will likely not work for anything but strings. Try to used execParams instead, even if now parameters are present.

execParams
immutable(Answer) execParams(QueryParams qp)

Perform SQL query to DB

sendQuery
void sendQuery(string SQLcmd)

Submits a command to the server without waiting for the result(s)

sendQueryParams
void sendQueryParams(QueryParams qp)

Submits a command and separate parameters to the server without waiting for the result(s)

sendQueryPrepared
void sendQueryPrepared(QueryParams qp)

Sends a request to execute a prepared statement with given parameters, without waiting for the result(s)

getNextNotify
Notify getNextNotify()

Returns null if no notifies was received

prepare
immutable(Result) prepare(string statementName, string sqlStatement, Oid[] oids)

Submits a request to create a prepared statement with the given parameters, and waits for completion.

prepareEx
void prepareEx(string statementName, string sqlStatement, Oid[] oids)

Submits a request to create a prepared statement with the given parameters, and waits for completion.

execPrepared
immutable(Answer) execPrepared(QueryParams qp)

Submits a request to execute a prepared statement with given parameters, and waits for completion.

sendPrepare
void sendPrepare(string statementName, string sqlStatement, Oid[] oids)

Sends a request to create a prepared statement with the given parameters, without waiting for completion.

describePrepared
immutable(Answer) describePrepared(string statementName)

Submits a request to obtain information about the specified prepared statement, and waits for completion.

sendDescribePrepared
void sendDescribePrepared(string statementName)

Submits a request to obtain information about the specified prepared statement, without waiting for completion.

putCopyData
bool putCopyData(string data)

Sends a buffer of CSV data to the COPY command

putCopyEnd
immutable(Answer) putCopyEnd()

Signals that COPY data send is finished. Finalize and flush the COPY command.

sendPutCopyEnd
bool sendPutCopyEnd()

Signals that COPY data send is finished.

waitEndOf
bool waitEndOf(WaitType type, Duration timeout)
Undocumented in source. Be warned that the author may not have intended to support it.

Meta