Types
ConnStatusType = enum CONNECTION_OK, CONNECTION_BAD, CONNECTION_STARTED, CONNECTION_MADE, CONNECTION_AWAITING_RESPONSE, CONNECTION_AUTH_OK, CONNECTION_SETENV, CONNECTION_SSL_STARTUP, CONNECTION_NEEDED, CONNECTION_CHECK_WRITABLE, CONNECTION_CONSUME, CONNECTION_GSS_STARTUP, CONNECTION_CHECK_TARGET
- Source Edit
ExecStatusType = enum PGRES_EMPTY_QUERY = 0, PGRES_COMMAND_OK, PGRES_TUPLES_OK, PGRES_COPY_OUT, PGRES_COPY_IN, PGRES_BAD_RESPONSE, PGRES_NONFATAL_ERROR, PGRES_FATAL_ERROR, PGRES_COPY_BOTH, PGRES_SINGLE_TUPLE
- Source Edit
PGconn {.pure, final.} = object pghost*: cstring pgtty*: cstring pgport*: cstring pgoptions*: cstring dbName*: cstring status*: ConnStatusType errorMessage*: array[0 .. 4096 - 1, char] Pfin*: File Pfout*: File Pfdebug*: File sock*: int32 laddr*: SockAddr raddr*: SockAddr salt*: array[0 .. 2 - 1, char] asyncNotifyWaiting*: int32 notifyList*: pointer pguser*: cstring pgpass*: cstring lobjfuncs*: PPGlobjfuncs
- Source Edit
PGlobjfuncs {.pure, final.} = object fn_lo_open*: Oid fn_lo_close*: Oid fn_lo_creat*: Oid fn_lo_unlink*: Oid fn_lo_lseek*: Oid fn_lo_tell*: Oid fn_lo_read*: Oid fn_lo_write*: Oid
- Source Edit
PGresAttValue {.pure, final.} = object length*: int32 value*: cstring
- Source Edit
PGresult {.pure, final.} = object ntups*: int32 numAttributes*: int32 attDescs*: PPGresAttDesc tuples*: PPPGresAttValue tupArrSize*: int32 resultStatus*: ExecStatusType cmdStatus*: array[0 .. 40 - 1, char] binary*: int32 conn*: PPGconn
- Source Edit
PGTransactionStatusType = enum PQTRANS_IDLE, PQTRANS_ACTIVE, PQTRANS_INTRANS, PQTRANS_INERROR, PQTRANS_UNKNOWN
- Source Edit
PGVerbosity = enum PQERRORS_TERSE, PQERRORS_DEFAULT, PQERRORS_VERBOSE, PQERRORS_SQLSTATE
- Source Edit
PostgresPollingStatusType = enum PGRES_POLLING_FAILED = 0, PGRES_POLLING_READING, PGRES_POLLING_WRITING, PGRES_POLLING_OK, PGRES_POLLING_ACTIVE
- Source Edit
PPGlobjfuncs = ptr PGlobjfuncs
- Source Edit
PPGresAttDesc = ptr PGresAttDesc
- Source Edit
PPGVerbosity = ptr PGVerbosity
- Source Edit
PPQArgBlock = ptr PQArgBlock
- Source Edit
PPQprintOpt = ptr PQprintOpt
- Source Edit
PQconninfoOption {.pure, final.} = object keyword*: cstring envvar*: cstring compiled*: cstring val*: cstring label*: cstring dispchar*: cstring dispsize*: int32
- Source Edit
PQnoticeProcessor = proc (arg: pointer; message: cstring) {.cdecl.}
- Source Edit
PQnoticeReceiver = proc (arg: pointer; res: PPGresult) {.cdecl.}
- Source Edit
Consts
CMDSTATUS_LEN = 40
- Source Edit
ERROR_MSG_LENGTH = 4096
- Source Edit
Procs
proc lo_close(conn: PPGconn; fd: int32): int32 {.cdecl, dynlib: dllName, importc: "lo_close", ...raises: [], tags: [].}
- Source Edit
proc lo_creat(conn: PPGconn; mode: int32): Oid {.cdecl, dynlib: dllName, importc: "lo_creat", ...raises: [], tags: [].}
- Source Edit
proc lo_export(conn: PPGconn; lobjId: Oid; filename: cstring): int32 {.cdecl, dynlib: dllName, importc: "lo_export", ...raises: [], tags: [].}
- Source Edit
proc lo_import(conn: PPGconn; filename: cstring): Oid {.cdecl, dynlib: dllName, importc: "lo_import", ...raises: [], tags: [].}
- Source Edit
proc lo_lseek(conn: PPGconn; fd: int32; offset: int32; whence: int32): int32 {. cdecl, dynlib: dllName, importc: "lo_lseek", ...raises: [], tags: [].}
- Source Edit
proc lo_open(conn: PPGconn; lobjId: Oid; mode: int32): int32 {.cdecl, dynlib: dllName, importc: "lo_open", ...raises: [], tags: [].}
- Source Edit
proc lo_read(conn: PPGconn; fd: int32; buf: cstring; length: int): int32 {. cdecl, dynlib: dllName, importc: "lo_read", ...raises: [], tags: [].}
- Source Edit
proc lo_tell(conn: PPGconn; fd: int32): int32 {.cdecl, dynlib: dllName, importc: "lo_tell", ...raises: [], tags: [].}
- Source Edit
proc lo_unlink(conn: PPGconn; lobjId: Oid): int32 {.cdecl, dynlib: dllName, importc: "lo_unlink", ...raises: [], tags: [].}
- Source Edit
proc lo_write(conn: PPGconn; fd: int32; buf: cstring; length: int): int32 {. cdecl, dynlib: dllName, importc: "lo_write", ...raises: [], tags: [].}
- Source Edit
proc pqbackendPID(conn: PPGconn): int32 {.cdecl, dynlib: dllName, importc: "PQbackendPID", ...raises: [], tags: [].}
- Source Edit
proc pqbinaryTuples(res: PPGresult): int32 {.cdecl, dynlib: dllName, importc: "PQbinaryTuples", ...raises: [], tags: [].}
- Source Edit
proc pqclear(res: PPGresult) {.cdecl, dynlib: dllName, importc: "PQclear", ...raises: [], tags: [].}
- Source Edit
proc pqclientEncoding(conn: PPGconn): int32 {.cdecl, dynlib: dllName, importc: "PQclientEncoding", ...raises: [], tags: [].}
- Source Edit
proc pqcmdStatus(res: PPGresult): cstring {.cdecl, dynlib: dllName, importc: "PQcmdStatus", ...raises: [], tags: [].}
- Source Edit
proc pqcmdTuples(res: PPGresult): cstring {.cdecl, dynlib: dllName, importc: "PQcmdTuples", ...raises: [], tags: [].}
- Source Edit
proc pqconndefaults(): PPQconninfoOption {.cdecl, dynlib: dllName, importc: "PQconndefaults", ...raises: [], tags: [].}
- Source Edit
proc pqconnectdb(conninfo: cstring): PPGconn {.cdecl, dynlib: dllName, importc: "PQconnectdb", ...raises: [], tags: [].}
- Source Edit
proc pqconnectionNeedsPassword(conn: PPGconn): int32 {.cdecl, dynlib: dllName, importc: "PQconnectionNeedsPassword", ...raises: [], tags: [].}
- Source Edit
proc pqconnectionUsedPassword(conn: PPGconn): int32 {.cdecl, dynlib: dllName, importc: "PQconnectionUsedPassword", ...raises: [], tags: [].}
- Source Edit
proc pqconnectPoll(conn: PPGconn): PostgresPollingStatusType {.cdecl, dynlib: dllName, importc: "PQconnectPoll", ...raises: [], tags: [].}
- Source Edit
proc pqconnectStart(conninfo: cstring): PPGconn {.cdecl, dynlib: dllName, importc: "PQconnectStart", ...raises: [], tags: [].}
- Source Edit
proc pqconninfoFree(connOptions: PPQconninfoOption) {.cdecl, dynlib: dllName, importc: "PQconninfoFree", ...raises: [], tags: [].}
- Source Edit
proc pqconsumeInput(conn: PPGconn): int32 {.cdecl, dynlib: dllName, importc: "PQconsumeInput", ...raises: [], tags: [].}
- Source Edit
proc pqdb(conn: PPGconn): cstring {.cdecl, dynlib: dllName, importc: "PQdb", ...raises: [], tags: [].}
- Source Edit
proc pqdisplayTuples(res: PPGresult; fp: File; fillAlign: int32; fieldSep: cstring; printHeader: int32; quiet: int32) {. cdecl, dynlib: dllName, importc: "PQdisplayTuples", ...raises: [], tags: [].}
- Source Edit
proc pqendcopy(conn: PPGconn): int32 {.cdecl, dynlib: dllName, importc: "PQendcopy", ...raises: [], tags: [].}
- Source Edit
proc pqenv2encoding(): int32 {.cdecl, dynlib: dllName, importc: "PQenv2encoding", ...raises: [], tags: [].}
- Source Edit
proc pqerrorMessage(conn: PPGconn): cstring {.cdecl, dynlib: dllName, importc: "PQerrorMessage", ...raises: [], tags: [].}
- Source Edit
proc pqescapeBytea(bintext: cstring; binlen: int; bytealen: var int): cstring {. cdecl, dynlib: dllName, importc: "PQescapeBytea", ...raises: [], tags: [].}
- Source Edit
proc pqescapeString(till, from: cstring; len: int): int {.cdecl, dynlib: dllName, importc: "PQescapeString", ...raises: [], tags: [].}
- Source Edit
proc pqexec(conn: PPGconn; query: cstring): PPGresult {.cdecl, dynlib: dllName, importc: "PQexec", ...raises: [], tags: [].}
- Source Edit
proc pqexecParams(conn: PPGconn; command: cstring; nParams: int32; paramTypes: POid; paramValues: cstringArray; paramLengths, paramFormats: ptr int32; resultFormat: int32): PPGresult {. cdecl, dynlib: dllName, importc: "PQexecParams", ...raises: [], tags: [].}
- Source Edit
proc pqexecPrepared(conn: PPGconn; stmtName: cstring; nParams: int32; paramValues: cstringArray; paramLengths, paramFormats: ptr int32; resultFormat: int32): PPGresult {. cdecl, dynlib: dllName, importc: "PQexecPrepared", ...raises: [], tags: [].}
- Source Edit
proc pqfformat(res: PPGresult; field_num: int32): int32 {.cdecl, dynlib: dllName, importc: "PQfformat", ...raises: [], tags: [].}
- Source Edit
proc pqfinish(conn: PPGconn) {.cdecl, dynlib: dllName, importc: "PQfinish", ...raises: [], tags: [].}
- Source Edit
proc pqflush(conn: PPGconn): int32 {.cdecl, dynlib: dllName, importc: "PQflush", ...raises: [], tags: [].}
- Source Edit
proc pqfmod(res: PPGresult; field_num: int32): int32 {.cdecl, dynlib: dllName, importc: "PQfmod", ...raises: [], tags: [].}
- Source Edit
proc pqfn(conn: PPGconn; fnid: int32; result_buf, result_len: ptr int32; result_is_int: int32; args: PPQArgBlock; nargs: int32): PPGresult {. cdecl, dynlib: dllName, importc: "PQfn", ...raises: [], tags: [].}
- Source Edit
proc pqfname(res: PPGresult; field_num: int32): cstring {.cdecl, dynlib: dllName, importc: "PQfname", ...raises: [], tags: [].}
- Source Edit
proc pqfnumber(res: PPGresult; field_name: cstring): int32 {.cdecl, dynlib: dllName, importc: "PQfnumber", ...raises: [], tags: [].}
- Source Edit
proc pqfreemem(p: pointer) {.cdecl, dynlib: dllName, importc: "PQfreemem", ...raises: [], tags: [].}
- Source Edit
proc pqfsize(res: PPGresult; field_num: int32): int32 {.cdecl, dynlib: dllName, importc: "PQfsize", ...raises: [], tags: [].}
- Source Edit
proc pqftable(res: PPGresult; field_num: int32): Oid {.cdecl, dynlib: dllName, importc: "PQftable", ...raises: [], tags: [].}
- Source Edit
proc pqftablecol(res: PPGresult; field_num: int32): int32 {.cdecl, dynlib: dllName, importc: "PQftablecol", ...raises: [], tags: [].}
- Source Edit
proc pqftype(res: PPGresult; field_num: int32): Oid {.cdecl, dynlib: dllName, importc: "PQftype", ...raises: [], tags: [].}
- Source Edit
proc pqgetCopyData(conn: PPGconn; buffer: cstringArray; async: int32): int32 {. cdecl, dynlib: dllName, importc: "PQgetCopyData", ...raises: [], tags: [].}
- Source Edit
proc pqgetisnull(res: PPGresult; tup_num: int32; field_num: int32): int32 {. cdecl, dynlib: dllName, importc: "PQgetisnull", ...raises: [], tags: [].}
- Source Edit
proc pqgetlength(res: PPGresult; tup_num: int32; field_num: int32): int32 {. cdecl, dynlib: dllName, importc: "PQgetlength", ...raises: [], tags: [].}
- Source Edit
proc pqgetline(conn: PPGconn; str: cstring; len: int32): int32 {.cdecl, dynlib: dllName, importc: "PQgetline", ...raises: [], tags: [].}
- Source Edit
proc pqgetlineAsync(conn: PPGconn; buffer: cstring; bufsize: int32): int32 {. cdecl, dynlib: dllName, importc: "PQgetlineAsync", ...raises: [], tags: [].}
- Source Edit
proc pqgetResult(conn: PPGconn): PPGresult {.cdecl, dynlib: dllName, importc: "PQgetResult", ...raises: [], tags: [].}
- Source Edit
proc pqgetvalue(res: PPGresult; tup_num: int32; field_num: int32): cstring {. cdecl, dynlib: dllName, importc: "PQgetvalue", ...raises: [], tags: [].}
- Source Edit
proc pqhost(conn: PPGconn): cstring {.cdecl, dynlib: dllName, importc: "PQhost", ...raises: [], tags: [].}
- Source Edit
proc pqinitOpenSSL(do_ssl: int32; do_crypto: int32) {.cdecl, dynlib: dllName, importc: "PQinitOpenSSL", ...raises: [], tags: [].}
- Source Edit
proc pqisBusy(conn: PPGconn): int32 {.cdecl, dynlib: dllName, importc: "PQisBusy", ...raises: [], tags: [].}
- Source Edit
proc pqisnonblocking(conn: PPGconn): int32 {.cdecl, dynlib: dllName, importc: "PQisnonblocking", ...raises: [], tags: [].}
- Source Edit
proc pqmakeEmptyPGresult(conn: PPGconn; status: ExecStatusType): PPGresult {. cdecl, dynlib: dllName, importc: "PQmakeEmptyPGresult", ...raises: [], tags: [].}
- Source Edit
proc pqmblen(s: cstring; encoding: int32): int32 {.cdecl, dynlib: dllName, importc: "PQmblen", ...raises: [], tags: [].}
- Source Edit
proc pqnfields(res: PPGresult): int32 {.cdecl, dynlib: dllName, importc: "PQnfields", ...raises: [], tags: [].}
- Source Edit
proc pqnotifies(conn: PPGconn): PPGNotify {.cdecl, dynlib: dllName, importc: "PQnotifies", ...raises: [], tags: [].}
- Source Edit
proc pqntuples(res: PPGresult): int32 {.cdecl, dynlib: dllName, importc: "PQntuples", ...raises: [], tags: [].}
- Source Edit
proc pqoidStatus(res: PPGresult): cstring {.cdecl, dynlib: dllName, importc: "PQoidStatus", ...raises: [], tags: [].}
- Source Edit
proc pqoidValue(res: PPGresult): Oid {.cdecl, dynlib: dllName, importc: "PQoidValue", ...raises: [], tags: [].}
- Source Edit
proc pqoptions(conn: PPGconn): cstring {.cdecl, dynlib: dllName, importc: "PQoptions", ...raises: [], tags: [].}
- Source Edit
proc pqparameterStatus(conn: PPGconn; paramName: cstring): cstring {.cdecl, dynlib: dllName, importc: "PQparameterStatus", ...raises: [], tags: [].}
- Source Edit
proc pqpass(conn: PPGconn): cstring {.cdecl, dynlib: dllName, importc: "PQpass", ...raises: [], tags: [].}
- Source Edit
proc pqport(conn: PPGconn): cstring {.cdecl, dynlib: dllName, importc: "PQport", ...raises: [], tags: [].}
- Source Edit
proc pqprepare(conn: PPGconn; stmtName, query: cstring; nParams: int32; paramTypes: POid): PPGresult {.cdecl, dynlib: dllName, importc: "PQprepare", ...raises: [], tags: [].}
- Source Edit
proc pqprint(fout: File; res: PPGresult; ps: PPQprintOpt) {.cdecl, dynlib: dllName, importc: "PQprint", ...raises: [], tags: [].}
- Source Edit
proc pqprintTuples(res: PPGresult; fout: File; printAttName: int32; terseOutput: int32; width: int32) {.cdecl, dynlib: dllName, importc: "PQprintTuples", ...raises: [], tags: [].}
- Source Edit
proc pqprotocolVersion(conn: PPGconn): int32 {.cdecl, dynlib: dllName, importc: "PQprotocolVersion", ...raises: [], tags: [].}
- Source Edit
proc pqputCopyData(conn: PPGconn; buffer: cstring; nbytes: int32): int32 {. cdecl, dynlib: dllName, importc: "PQputCopyData", ...raises: [], tags: [].}
- Source Edit
proc pqputCopyEnd(conn: PPGconn; errormsg: cstring): int32 {.cdecl, dynlib: dllName, importc: "PQputCopyEnd", ...raises: [], tags: [].}
- Source Edit
proc pqputline(conn: PPGconn; str: cstring): int32 {.cdecl, dynlib: dllName, importc: "PQputline", ...raises: [], tags: [].}
- Source Edit
proc pqputnbytes(conn: PPGconn; buffer: cstring; nbytes: int32): int32 {.cdecl, dynlib: dllName, importc: "PQputnbytes", ...raises: [], tags: [].}
- Source Edit
proc pqrequestCancel(conn: PPGconn): int32 {.cdecl, dynlib: dllName, importc: "PQrequestCancel", ...raises: [], tags: [].}
- Source Edit
proc pqreset(conn: PPGconn) {.cdecl, dynlib: dllName, importc: "PQreset", ...raises: [], tags: [].}
- Source Edit
proc pqresetPoll(conn: PPGconn): PostgresPollingStatusType {.cdecl, dynlib: dllName, importc: "PQresetPoll", ...raises: [], tags: [].}
- Source Edit
proc pqresetStart(conn: PPGconn): int32 {.cdecl, dynlib: dllName, importc: "PQresetStart", ...raises: [], tags: [].}
- Source Edit
proc pqresStatus(status: ExecStatusType): cstring {.cdecl, dynlib: dllName, importc: "PQresStatus", ...raises: [], tags: [].}
- Source Edit
proc pqresultErrorField(res: PPGresult; fieldcode: int32): cstring {.cdecl, dynlib: dllName, importc: "PQresultErrorField", ...raises: [], tags: [].}
- Source Edit
proc pqresultErrorMessage(res: PPGresult): cstring {.cdecl, dynlib: dllName, importc: "PQresultErrorMessage", ...raises: [], tags: [].}
- Source Edit
proc pqresultStatus(res: PPGresult): ExecStatusType {.cdecl, dynlib: dllName, importc: "PQresultStatus", ...raises: [], tags: [].}
- Source Edit
proc pqsendQuery(conn: PPGconn; query: cstring): int32 {.cdecl, dynlib: dllName, importc: "PQsendQuery", ...raises: [], tags: [].}
- See also https://www.postgresql.org/docs/current/libpq-async.html Source Edit
proc pqsendQueryParams(conn: PPGconn; command: cstring; nParams: int32; paramTypes: POid; paramValues: cstringArray; paramLengths, paramFormats: ptr int32; resultFormat: int32): int32 {.cdecl, dynlib: dllName, importc: "PQsendQueryParams", ...raises: [], tags: [].}
- Source Edit
proc pqsendQueryPrepared(conn: PPGconn; stmtName: cstring; nParams: int32; paramValues: cstringArray; paramLengths, paramFormats: ptr int32; resultFormat: int32): int32 {.cdecl, dynlib: dllName, importc: "PQsendQueryPrepared", ...raises: [], tags: [].}
- Source Edit
proc pqserverVersion(conn: PPGconn): int32 {.cdecl, dynlib: dllName, importc: "PQserverVersion", ...raises: [], tags: [].}
- Source Edit
proc pqsetClientEncoding(conn: PPGconn; encoding: cstring): int32 {.cdecl, dynlib: dllName, importc: "PQsetClientEncoding", ...raises: [], tags: [].}
- Source Edit
proc pqsetdb(M_PGHOST, M_PGPORT, M_PGOPT, M_PGTTY, M_DBNAME: cstring): PPGconn {. ...raises: [], tags: [].}
- Source Edit
proc pqsetdbLogin(pghost: cstring; pgport: cstring; pgoptions: cstring; pgtty: cstring; dbName: cstring; login: cstring; pwd: cstring): PPGconn {. cdecl, dynlib: dllName, importc: "PQsetdbLogin", ...raises: [], tags: [].}
- Source Edit
proc pqsetErrorVerbosity(conn: PPGconn; verbosity: PGVerbosity): PGVerbosity {. cdecl, dynlib: dllName, importc: "PQsetErrorVerbosity", ...raises: [], tags: [].}
- Source Edit
proc pqsetnonblocking(conn: PPGconn; arg: int32): int32 {.cdecl, dynlib: dllName, importc: "PQsetnonblocking", ...raises: [], tags: [].}
- Source Edit
proc pqsetNoticeProcessor(conn: PPGconn; theProc: PQnoticeProcessor; arg: pointer): PQnoticeProcessor {.cdecl, dynlib: dllName, importc: "PQsetNoticeProcessor", ...raises: [], tags: [].}
- Source Edit
proc pqsetNoticeReceiver(conn: PPGconn; theProc: PQnoticeReceiver; arg: pointer): PQnoticeReceiver {. cdecl, dynlib: dllName, importc: "PQsetNoticeReceiver", ...raises: [], tags: [].}
- Source Edit
proc pqSetSingleRowMode(conn: PPGconn): int32 {.cdecl, dynlib: dllName, importc: "PQsetSingleRowMode", ...raises: [], tags: [].}
- See also https://www.postgresql.org/docs/current/libpq-single-row-mode.html Source Edit
proc pqsocket(conn: PPGconn): int32 {.cdecl, dynlib: dllName, importc: "PQsocket", ...raises: [], tags: [].}
- Source Edit
proc pqstatus(conn: PPGconn): ConnStatusType {.cdecl, dynlib: dllName, importc: "PQstatus", ...raises: [], tags: [].}
- Source Edit
proc pqtrace(conn: PPGconn; debug_port: File) {.cdecl, dynlib: dllName, importc: "PQtrace", ...raises: [], tags: [].}
- Source Edit
proc pqtransactionStatus(conn: PPGconn): PGTransactionStatusType {.cdecl, dynlib: dllName, importc: "PQtransactionStatus", ...raises: [], tags: [].}
- Source Edit
proc pqtty(conn: PPGconn): cstring {.cdecl, dynlib: dllName, importc: "PQtty", ...raises: [], tags: [].}
- Source Edit
proc pqunescapeBytea(strtext: cstring; retbuflen: var int): cstring {.cdecl, dynlib: dllName, importc: "PQunescapeBytea", ...raises: [], tags: [].}
- Source Edit