Module postgres

Search:
Group by:

Types

POid = ptr Oid
  Source Edit
Oid = int32
  Source Edit
SockAddr = array[1 .. 112, int8]
  Source Edit
PGresAttDesc = object
  name*: cstring
  adtid*: Oid
  adtsize*: int
  Source Edit
PPGresAttDesc = ptr PGresAttDesc
  Source Edit
PPPGresAttDesc = ptr PPGresAttDesc
  Source Edit
PGresAttValue = object
  length*: int32
  value*: cstring
  Source Edit
PPGresAttValue = ptr PGresAttValue
  Source Edit
PPPGresAttValue = ptr PPGresAttValue
  Source Edit
PExecStatusType = ptr ExecStatusType
  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
  Source Edit
PGlobjfuncs = 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
PPGlobjfuncs = ptr PGlobjfuncs
  Source Edit
PConnStatusType = ptr ConnStatusType
  Source Edit
ConnStatusType = enum
  CONNECTION_OK, CONNECTION_BAD, CONNECTION_STARTED, CONNECTION_MADE,
  CONNECTION_AWAITING_RESPONSE, CONNECTION_AUTH_OK, CONNECTION_SETENV,
  CONNECTION_SSL_STARTUP, CONNECTION_NEEDED
  Source Edit
PGconn = 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
PPGconn = ptr PGconn
  Source Edit
PGresult = 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
PPGresult = ptr PGresult
  Source Edit
PPostgresPollingStatusType = ptr PostgresPollingStatusType
  Source Edit
PostgresPollingStatusType = enum
  PGRES_POLLING_FAILED = 0, PGRES_POLLING_READING, PGRES_POLLING_WRITING,
  PGRES_POLLING_OK, PGRES_POLLING_ACTIVE
  Source Edit
PPGTransactionStatusType = ptr PGTransactionStatusType
  Source Edit
PGTransactionStatusType = enum
  PQTRANS_IDLE, PQTRANS_ACTIVE, PQTRANS_INTRANS, PQTRANS_INERROR, PQTRANS_UNKNOWN
  Source Edit
PPGVerbosity = ptr PGVerbosity
  Source Edit
PGVerbosity = enum
  PQERRORS_TERSE, PQERRORS_DEFAULT, PQERRORS_VERBOSE
  Source Edit
PpgNotify = ptr pgNotify
  Source Edit
pgNotify = object
  relname*: cstring
  be_pid*: int32
  extra*: cstring
  Source Edit
PQnoticeReceiver = proc (arg: pointer; res: PPGresult) {.
cdecl
.}
  Source Edit
PQnoticeProcessor = proc (arg: pointer; message: cstring) {.
cdecl
.}
  Source Edit
Ppqbool = ptr pqbool
  Source Edit
pqbool = char
  Source Edit
P_PQprintOpt = ptr PQprintOpt
  Source Edit
PQprintOpt = object
  header*: pqbool
  align*: pqbool
  standard*: pqbool
  html3*: pqbool
  expanded*: pqbool
  pager*: pqbool
  fieldSep*: cstring
  tableOpt*: cstring
  caption*: cstring
  fieldName*: ptr cstring
  Source Edit
P_PQconninfoOption = ptr PQconninfoOption
  Source Edit
PQconninfoOption = object
  keyword*: cstring
  envvar*: cstring
  compiled*: cstring
  val*: cstring
  label*: cstring
  dispchar*: cstring
  dispsize*: int32
  Source Edit
PPQArgBlock = ptr PQArgBlock
  Source Edit
PQArgBlock = object
  length*: int32
  isint*: int32
  p*: pointer
  Source Edit

Consts

ERROR_MSG_LENGTH = 4096
  Source Edit
CMDSTATUS_LEN = 40
  Source Edit

Procs

proc pqconnectStart(conninfo: cstring): PPGconn {.
cdecl, dynlib: dllName, importc: "PQconnectStart"
.}
  Source Edit
proc pqconnectPoll(conn: PPGconn): PostgresPollingStatusType {.
cdecl, dynlib: dllName, importc: "PQconnectPoll"
.}
  Source Edit
proc pqconnectdb(conninfo: cstring): PPGconn {.
cdecl, dynlib: dllName, importc: "PQconnectdb"
.}
  Source Edit
proc pqsetdbLogin(pghost: cstring; pgport: cstring; pgoptions: cstring; pgtty: cstring;
                 dbName: cstring; login: cstring; pwd: cstring): PPGconn {.
cdecl, dynlib: dllName, importc: "PQsetdbLogin"
.}
  Source Edit
proc pqfinish(conn: PPGconn) {.
cdecl, dynlib: dllName, importc: "PQfinish"
.}
  Source Edit
proc pqconndefaults(): P_PQconninfoOption {.
cdecl, dynlib: dllName, importc: "PQconndefaults"
.}
  Source Edit
proc pqconninfoFree(connOptions: P_PQconninfoOption) {.
cdecl, dynlib: dllName, importc: "PQconninfoFree"
.}
  Source Edit
proc pqresetStart(conn: PPGconn): int32 {.
cdecl, dynlib: dllName, importc: "PQresetStart"
.}
  Source Edit
proc pqresetPoll(conn: PPGconn): PostgresPollingStatusType {.
cdecl, dynlib: dllName, importc: "PQresetPoll"
.}
  Source Edit
proc pqreset(conn: PPGconn) {.
cdecl, dynlib: dllName, importc: "PQreset"
.}
  Source Edit
proc pqrequestCancel(conn: PPGconn): int32 {.
cdecl, dynlib: dllName, importc: "PQrequestCancel"
.}
  Source Edit
proc pqdb(conn: PPGconn): cstring {.
cdecl, dynlib: dllName, importc: "PQdb"
.}
  Source Edit
proc pquser(conn: PPGconn): cstring {.
cdecl, dynlib: dllName, importc: "PQuser"
.}
  Source Edit
proc pqpass(conn: PPGconn): cstring {.
cdecl, dynlib: dllName, importc: "PQpass"
.}
  Source Edit
proc pqhost(conn: PPGconn): cstring {.
cdecl, dynlib: dllName, importc: "PQhost"
.}
  Source Edit
proc pqport(conn: PPGconn): cstring {.
cdecl, dynlib: dllName, importc: "PQport"
.}
  Source Edit
proc pqtty(conn: PPGconn): cstring {.
cdecl, dynlib: dllName, importc: "PQtty"
.}
  Source Edit
proc pqoptions(conn: PPGconn): cstring {.
cdecl, dynlib: dllName, importc: "PQoptions"
.}
  Source Edit
proc pqstatus(conn: PPGconn): ConnStatusType {.
cdecl, dynlib: dllName, importc: "PQstatus"
.}
  Source Edit
proc pqtransactionStatus(conn: PPGconn): PGTransactionStatusType {.
cdecl, dynlib: dllName, importc: "PQtransactionStatus"
.}
  Source Edit
proc pqparameterStatus(conn: PPGconn; paramName: cstring): cstring {.
cdecl, dynlib: dllName, importc: "PQparameterStatus"
.}
  Source Edit
proc pqprotocolVersion(conn: PPGconn): int32 {.
cdecl, dynlib: dllName, importc: "PQprotocolVersion"
.}
  Source Edit
proc pqerrorMessage(conn: PPGconn): cstring {.
cdecl, dynlib: dllName, importc: "PQerrorMessage"
.}
  Source Edit
proc pqsocket(conn: PPGconn): int32 {.
cdecl, dynlib: dllName, importc: "PQsocket"
.}
  Source Edit
proc pqbackendPID(conn: PPGconn): int32 {.
cdecl, dynlib: dllName, importc: "PQbackendPID"
.}
  Source Edit
proc pqclientEncoding(conn: PPGconn): int32 {.
cdecl, dynlib: dllName, importc: "PQclientEncoding"
.}
  Source Edit
proc pqsetClientEncoding(conn: PPGconn; encoding: cstring): int32 {.
cdecl, dynlib: dllName, importc: "PQsetClientEncoding"
.}
  Source Edit
proc pqsetErrorVerbosity(conn: PPGconn; verbosity: PGVerbosity): PGVerbosity {.
cdecl, dynlib: dllName, importc: "PQsetErrorVerbosity"
.}
  Source Edit
proc pqtrace(conn: PPGconn; debug_port: File) {.
cdecl, dynlib: dllName, importc: "PQtrace"
.}
  Source Edit
proc pquntrace(conn: PPGconn) {.
cdecl, dynlib: dllName, importc: "PQuntrace"
.}
  Source Edit
proc pqsetNoticeReceiver(conn: PPGconn; theProc: PQnoticeReceiver; arg: pointer): PQnoticeReceiver {.
cdecl, dynlib: dllName, importc: "PQsetNoticeReceiver"
.}
  Source Edit
proc pqsetNoticeProcessor(conn: PPGconn; theProc: PQnoticeProcessor; arg: pointer): PQnoticeProcessor {.
cdecl, dynlib: dllName, importc: "PQsetNoticeProcessor"
.}
  Source Edit
proc pqexec(conn: PPGconn; query: cstring): PPGresult {.
cdecl, dynlib: dllName, importc: "PQexec"
.}
  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"
.}
  Source Edit
proc pqprepare(conn: PPGconn; stmtName, query: cstring; nParams: int32; paramTypes: POid): PPGresult {.
cdecl, dynlib: dllName, importc: "PQprepare"
.}
  Source Edit
proc pqexecPrepared(conn: PPGconn; stmtName: cstring; nParams: int32;
                   paramValues: cstringArray;
                   paramLengths, paramFormats: ptr int32; resultFormat: int32): PPGresult {.
cdecl, dynlib: dllName, importc: "PQexecPrepared"
.}
  Source Edit
proc pqsendQuery(conn: PPGconn; query: cstring): int32 {.
cdecl, dynlib: dllName, importc: "PQsendQuery"
.}
  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"
.}
  Source Edit
proc pqsendQueryPrepared(conn: PPGconn; stmtName: cstring; nParams: int32;
                        paramValues: cstringArray;
                        paramLengths, paramFormats: ptr int32; resultFormat: int32): int32 {.
cdecl, dynlib: dllName, importc: "PQsendQueryPrepared"
.}
  Source Edit
proc pqgetResult(conn: PPGconn): PPGresult {.
cdecl, dynlib: dllName, importc: "PQgetResult"
.}
  Source Edit
proc pqisBusy(conn: PPGconn): int32 {.
cdecl, dynlib: dllName, importc: "PQisBusy"
.}
  Source Edit
proc pqconsumeInput(conn: PPGconn): int32 {.
cdecl, dynlib: dllName, importc: "PQconsumeInput"
.}
  Source Edit
proc pqnotifies(conn: PPGconn): PpgNotify {.
cdecl, dynlib: dllName, importc: "PQnotifies"
.}
  Source Edit
proc pqputCopyData(conn: PPGconn; buffer: cstring; nbytes: int32): int32 {.
cdecl, dynlib: dllName, importc: "PQputCopyData"
.}
  Source Edit
proc pqputCopyEnd(conn: PPGconn; errormsg: cstring): int32 {.
cdecl, dynlib: dllName, importc: "PQputCopyEnd"
.}
  Source Edit
proc pqgetCopyData(conn: PPGconn; buffer: cstringArray; async: int32): int32 {.
cdecl, dynlib: dllName, importc: "PQgetCopyData"
.}
  Source Edit
proc pqgetline(conn: PPGconn; str: cstring; len: int32): int32 {.
cdecl, dynlib: dllName, importc: "PQgetline"
.}
  Source Edit
proc pqputline(conn: PPGconn; str: cstring): int32 {.
cdecl, dynlib: dllName, importc: "PQputline"
.}
  Source Edit
proc pqgetlineAsync(conn: PPGconn; buffer: cstring; bufsize: int32): int32 {.
cdecl, dynlib: dllName, importc: "PQgetlineAsync"
.}
  Source Edit
proc pqputnbytes(conn: PPGconn; buffer: cstring; nbytes: int32): int32 {.
cdecl, dynlib: dllName, importc: "PQputnbytes"
.}
  Source Edit
proc pqendcopy(conn: PPGconn): int32 {.
cdecl, dynlib: dllName, importc: "PQendcopy"
.}
  Source Edit
proc pqsetnonblocking(conn: PPGconn; arg: int32): int32 {.
cdecl, dynlib: dllName, importc: "PQsetnonblocking"
.}
  Source Edit
proc pqisnonblocking(conn: PPGconn): int32 {.
cdecl, dynlib: dllName, importc: "PQisnonblocking"
.}
  Source Edit
proc pqflush(conn: PPGconn): int32 {.
cdecl, dynlib: dllName, importc: "PQflush"
.}
  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"
.}
  Source Edit
proc pqresultStatus(res: PPGresult): ExecStatusType {.
cdecl, dynlib: dllName, importc: "PQresultStatus"
.}
  Source Edit
proc pqresStatus(status: ExecStatusType): cstring {.
cdecl, dynlib: dllName, importc: "PQresStatus"
.}
  Source Edit
proc pqresultErrorMessage(res: PPGresult): cstring {.
cdecl, dynlib: dllName, importc: "PQresultErrorMessage"
.}
  Source Edit
proc pqresultErrorField(res: PPGresult; fieldcode: int32): cstring {.
cdecl, dynlib: dllName, importc: "PQresultErrorField"
.}
  Source Edit
proc pqntuples(res: PPGresult): int32 {.
cdecl, dynlib: dllName, importc: "PQntuples"
.}
  Source Edit
proc pqnfields(res: PPGresult): int32 {.
cdecl, dynlib: dllName, importc: "PQnfields"
.}
  Source Edit
proc pqbinaryTuples(res: PPGresult): int32 {.
cdecl, dynlib: dllName, importc: "PQbinaryTuples"
.}
  Source Edit
proc pqfname(res: PPGresult; field_num: int32): cstring {.
cdecl, dynlib: dllName, importc: "PQfname"
.}
  Source Edit
proc pqfnumber(res: PPGresult; field_name: cstring): int32 {.
cdecl, dynlib: dllName, importc: "PQfnumber"
.}
  Source Edit
proc pqftable(res: PPGresult; field_num: int32): Oid {.
cdecl, dynlib: dllName, importc: "PQftable"
.}
  Source Edit
proc pqftablecol(res: PPGresult; field_num: int32): int32 {.
cdecl, dynlib: dllName, importc: "PQftablecol"
.}
  Source Edit
proc pqfformat(res: PPGresult; field_num: int32): int32 {.
cdecl, dynlib: dllName, importc: "PQfformat"
.}
  Source Edit
proc pqftype(res: PPGresult; field_num: int32): Oid {.
cdecl, dynlib: dllName, importc: "PQftype"
.}
  Source Edit
proc pqfsize(res: PPGresult; field_num: int32): int32 {.
cdecl, dynlib: dllName, importc: "PQfsize"
.}
  Source Edit
proc pqfmod(res: PPGresult; field_num: int32): int32 {.
cdecl, dynlib: dllName, importc: "PQfmod"
.}
  Source Edit
proc pqcmdStatus(res: PPGresult): cstring {.
cdecl, dynlib: dllName, importc: "PQcmdStatus"
.}
  Source Edit
proc pqoidStatus(res: PPGresult): cstring {.
cdecl, dynlib: dllName, importc: "PQoidStatus"
.}
  Source Edit
proc pqoidValue(res: PPGresult): Oid {.
cdecl, dynlib: dllName, importc: "PQoidValue"
.}
  Source Edit
proc pqcmdTuples(res: PPGresult): cstring {.
cdecl, dynlib: dllName, importc: "PQcmdTuples"
.}
  Source Edit
proc pqgetvalue(res: PPGresult; tup_num: int32; field_num: int32): cstring {.
cdecl, dynlib: dllName, importc: "PQgetvalue"
.}
  Source Edit
proc pqgetlength(res: PPGresult; tup_num: int32; field_num: int32): int32 {.
cdecl, dynlib: dllName, importc: "PQgetlength"
.}
  Source Edit
proc pqgetisnull(res: PPGresult; tup_num: int32; field_num: int32): int32 {.
cdecl, dynlib: dllName, importc: "PQgetisnull"
.}
  Source Edit
proc pqclear(res: PPGresult) {.
cdecl, dynlib: dllName, importc: "PQclear"
.}
  Source Edit
proc pqfreemem(p: pointer) {.
cdecl, dynlib: dllName, importc: "PQfreemem"
.}
  Source Edit
proc pqmakeEmptyPGresult(conn: PPGconn; status: ExecStatusType): PPGresult {.
cdecl, dynlib: dllName, importc: "PQmakeEmptyPGresult"
.}
  Source Edit
proc pqescapeString(till, `from`: cstring; len: int): int {.
cdecl, dynlib: dllName, importc: "PQescapeString"
.}
  Source Edit
proc pqescapeBytea(bintext: cstring; binlen: int; bytealen: var int): cstring {.
cdecl, dynlib: dllName, importc: "PQescapeBytea"
.}
  Source Edit
proc pqunescapeBytea(strtext: cstring; retbuflen: var int): cstring {.
cdecl, dynlib: dllName, importc: "PQunescapeBytea"
.}
  Source Edit
proc pqprint(fout: File; res: PPGresult; ps: P_PQprintOpt) {.
cdecl, dynlib: dllName, importc: "PQprint"
.}
  Source Edit
proc pqdisplayTuples(res: PPGresult; fp: File; fillAlign: int32; fieldSep: cstring;
                    printHeader: int32; quiet: int32) {.
cdecl, dynlib: dllName, importc: "PQdisplayTuples"
.}
  Source Edit
proc pqprintTuples(res: PPGresult; fout: File; printAttName: int32; terseOutput: int32;
                  width: int32) {.
cdecl, dynlib: dllName, importc: "PQprintTuples"
.}
  Source Edit
proc lo_open(conn: PPGconn; lobjId: Oid; mode: int32): int32 {.
cdecl, dynlib: dllName, importc: "lo_open"
.}
  Source Edit
proc lo_close(conn: PPGconn; fd: int32): int32 {.
cdecl, dynlib: dllName, importc: "lo_close"
.}
  Source Edit
proc lo_read(conn: PPGconn; fd: int32; buf: cstring; length: int): int32 {.
cdecl, dynlib: dllName, importc: "lo_read"
.}
  Source Edit
proc lo_write(conn: PPGconn; fd: int32; buf: cstring; length: int): int32 {.
cdecl, dynlib: dllName, importc: "lo_write"
.}
  Source Edit
proc lo_lseek(conn: PPGconn; fd: int32; offset: int32; whence: int32): int32 {.
cdecl, dynlib: dllName, importc: "lo_lseek"
.}
  Source Edit
proc lo_creat(conn: PPGconn; mode: int32): Oid {.
cdecl, dynlib: dllName, importc: "lo_creat"
.}
  Source Edit
proc lo_tell(conn: PPGconn; fd: int32): int32 {.
cdecl, dynlib: dllName, importc: "lo_tell"
.}
  Source Edit
  Source Edit
proc lo_import(conn: PPGconn; filename: cstring): Oid {.
cdecl, dynlib: dllName, importc: "lo_import"
.}
  Source Edit
proc lo_export(conn: PPGconn; lobjId: Oid; filename: cstring): int32 {.
cdecl, dynlib: dllName, importc: "lo_export"
.}
  Source Edit
proc pqmblen(s: cstring; encoding: int32): int32 {.
cdecl, dynlib: dllName, importc: "PQmblen"
.}
  Source Edit
proc pqenv2encoding(): int32 {.
cdecl, dynlib: dllName, importc: "PQenv2encoding"
.}
  Source Edit
proc pqsetdb(M_PGHOST, M_PGPORT, M_PGOPT, M_PGTTY, M_DBNAME: cstring): PPGconn {.
raises: [], tags: []
.}
  Source Edit