postgres.nim 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  1. #
  2. #
  3. # Nim's Runtime Library
  4. # (c) Copyright 2015 Andreas Rumpf
  5. #
  6. # See the file "copying.txt", included in this
  7. # distribution, for details about the copyright.
  8. #
  9. # This module contains the definitions for structures and externs for
  10. # functions used by frontend postgres applications. It is based on
  11. # Postgresql's libpq-fe.h.
  12. #
  13. # It is for postgreSQL version 7.4 and higher with support for the v3.0
  14. # connection-protocol.
  15. #
  16. when defined(nimHasStyleChecks):
  17. {.push styleChecks: off.}
  18. when defined(windows):
  19. const
  20. dllName = "libpq.dll"
  21. elif defined(macosx):
  22. const
  23. dllName = "libpq.dylib"
  24. else:
  25. const
  26. dllName = "libpq.so(.5|)"
  27. when defined(nimPreviewSlimSystem):
  28. import std/syncio
  29. type
  30. POid* = ptr Oid
  31. Oid* = int32
  32. const
  33. ERROR_MSG_LENGTH* = 4096
  34. CMDSTATUS_LEN* = 40
  35. type
  36. SockAddr* = array[1..112, int8]
  37. PGresAttDesc*{.pure, final.} = object
  38. name*: cstring
  39. adtid*: Oid
  40. adtsize*: int
  41. PPGresAttDesc* = ptr PGresAttDesc
  42. PPPGresAttDesc* = ptr PPGresAttDesc
  43. PGresAttValue*{.pure, final.} = object
  44. length*: int32
  45. value*: cstring
  46. PPGresAttValue* = ptr PGresAttValue
  47. PPPGresAttValue* = ptr PPGresAttValue
  48. PExecStatusType* = ptr ExecStatusType
  49. ExecStatusType* = enum
  50. PGRES_EMPTY_QUERY = 0, PGRES_COMMAND_OK, PGRES_TUPLES_OK, PGRES_COPY_OUT,
  51. PGRES_COPY_IN, PGRES_BAD_RESPONSE, PGRES_NONFATAL_ERROR, PGRES_FATAL_ERROR,
  52. PGRES_COPY_BOTH, PGRES_SINGLE_TUPLE
  53. PGlobjfuncs*{.pure, final.} = object
  54. fn_lo_open*: Oid
  55. fn_lo_close*: Oid
  56. fn_lo_creat*: Oid
  57. fn_lo_unlink*: Oid
  58. fn_lo_lseek*: Oid
  59. fn_lo_tell*: Oid
  60. fn_lo_read*: Oid
  61. fn_lo_write*: Oid
  62. PPGlobjfuncs* = ptr PGlobjfuncs
  63. PConnStatusType* = ptr ConnStatusType
  64. ConnStatusType* = enum
  65. CONNECTION_OK, CONNECTION_BAD, CONNECTION_STARTED, CONNECTION_MADE,
  66. CONNECTION_AWAITING_RESPONSE, CONNECTION_AUTH_OK, CONNECTION_SETENV,
  67. CONNECTION_SSL_STARTUP, CONNECTION_NEEDED, CONNECTION_CHECK_WRITABLE,
  68. CONNECTION_CONSUME, CONNECTION_GSS_STARTUP, CONNECTION_CHECK_TARGET
  69. PGconn*{.pure, final.} = object
  70. pghost*: cstring
  71. pgtty*: cstring
  72. pgport*: cstring
  73. pgoptions*: cstring
  74. dbName*: cstring
  75. status*: ConnStatusType
  76. errorMessage*: array[0..(ERROR_MSG_LENGTH) - 1, char]
  77. Pfin*: File
  78. Pfout*: File
  79. Pfdebug*: File
  80. sock*: int32
  81. laddr*: SockAddr
  82. raddr*: SockAddr
  83. salt*: array[0..(2) - 1, char]
  84. asyncNotifyWaiting*: int32
  85. notifyList*: pointer
  86. pguser*: cstring
  87. pgpass*: cstring
  88. lobjfuncs*: PPGlobjfuncs
  89. PPGconn* = ptr PGconn
  90. PGresult*{.pure, final.} = object
  91. ntups*: int32
  92. numAttributes*: int32
  93. attDescs*: PPGresAttDesc
  94. tuples*: PPPGresAttValue
  95. tupArrSize*: int32
  96. resultStatus*: ExecStatusType
  97. cmdStatus*: array[0..(CMDSTATUS_LEN) - 1, char]
  98. binary*: int32
  99. conn*: PPGconn
  100. PPGresult* = ptr PGresult
  101. PPostgresPollingStatusType* = ptr PostgresPollingStatusType
  102. PostgresPollingStatusType* = enum
  103. PGRES_POLLING_FAILED = 0, PGRES_POLLING_READING, PGRES_POLLING_WRITING,
  104. PGRES_POLLING_OK, PGRES_POLLING_ACTIVE
  105. PPGTransactionStatusType* = ptr PGTransactionStatusType
  106. PGTransactionStatusType* = enum
  107. PQTRANS_IDLE, PQTRANS_ACTIVE, PQTRANS_INTRANS, PQTRANS_INERROR,
  108. PQTRANS_UNKNOWN
  109. PPGVerbosity* = ptr PGVerbosity
  110. PGVerbosity* = enum
  111. PQERRORS_TERSE, PQERRORS_DEFAULT, PQERRORS_VERBOSE, PQERRORS_SQLSTATE
  112. PPGNotify* = ptr pgNotify
  113. pgNotify*{.pure, final.} = object
  114. relname*: cstring
  115. be_pid*: int32
  116. extra*: cstring
  117. PQnoticeReceiver* = proc (arg: pointer, res: PPGresult){.cdecl.}
  118. PQnoticeProcessor* = proc (arg: pointer, message: cstring){.cdecl.}
  119. Ppqbool* = ptr pqbool
  120. pqbool* = char
  121. PPQprintOpt* = ptr PQprintOpt
  122. PQprintOpt*{.pure, final.} = object
  123. header*: pqbool
  124. align*: pqbool
  125. standard*: pqbool
  126. html3*: pqbool
  127. expanded*: pqbool
  128. pager*: pqbool
  129. fieldSep*: cstring
  130. tableOpt*: cstring
  131. caption*: cstring
  132. fieldName*: ptr cstring
  133. PPQconninfoOption* = ptr PQconninfoOption
  134. PQconninfoOption*{.pure, final.} = object
  135. keyword*: cstring
  136. envvar*: cstring
  137. compiled*: cstring
  138. val*: cstring
  139. label*: cstring
  140. dispchar*: cstring
  141. dispsize*: int32
  142. PPQArgBlock* = ptr PQArgBlock
  143. PQArgBlock*{.pure, final.} = object
  144. length*: int32
  145. isint*: int32
  146. p*: pointer
  147. proc pqinitOpenSSL*(do_ssl: int32, do_crypto: int32) {.cdecl, dynlib: dllName,
  148. importc: "PQinitOpenSSL".}
  149. proc pqconnectStart*(conninfo: cstring): PPGconn{.cdecl, dynlib: dllName,
  150. importc: "PQconnectStart".}
  151. proc pqconnectPoll*(conn: PPGconn): PostgresPollingStatusType{.cdecl,
  152. dynlib: dllName, importc: "PQconnectPoll".}
  153. proc pqconnectdb*(conninfo: cstring): PPGconn{.cdecl, dynlib: dllName,
  154. importc: "PQconnectdb".}
  155. proc pqsetdbLogin*(pghost: cstring, pgport: cstring, pgoptions: cstring,
  156. pgtty: cstring, dbName: cstring, login: cstring, pwd: cstring): PPGconn{.
  157. cdecl, dynlib: dllName, importc: "PQsetdbLogin".}
  158. proc pqsetdb*(M_PGHOST, M_PGPORT, M_PGOPT, M_PGTTY, M_DBNAME: cstring): PPGconn
  159. proc pqfinish*(conn: PPGconn){.cdecl, dynlib: dllName, importc: "PQfinish".}
  160. proc pqconndefaults*(): PPQconninfoOption{.cdecl, dynlib: dllName,
  161. importc: "PQconndefaults".}
  162. proc pqconninfoFree*(connOptions: PPQconninfoOption){.cdecl, dynlib: dllName,
  163. importc: "PQconninfoFree".}
  164. proc pqresetStart*(conn: PPGconn): int32{.cdecl, dynlib: dllName,
  165. importc: "PQresetStart".}
  166. proc pqresetPoll*(conn: PPGconn): PostgresPollingStatusType{.cdecl,
  167. dynlib: dllName, importc: "PQresetPoll".}
  168. proc pqreset*(conn: PPGconn){.cdecl, dynlib: dllName, importc: "PQreset".}
  169. proc pqrequestCancel*(conn: PPGconn): int32{.cdecl, dynlib: dllName,
  170. importc: "PQrequestCancel".}
  171. proc pqdb*(conn: PPGconn): cstring{.cdecl, dynlib: dllName, importc: "PQdb".}
  172. proc pquser*(conn: PPGconn): cstring{.cdecl, dynlib: dllName, importc: "PQuser".}
  173. proc pqpass*(conn: PPGconn): cstring{.cdecl, dynlib: dllName, importc: "PQpass".}
  174. proc pqhost*(conn: PPGconn): cstring{.cdecl, dynlib: dllName, importc: "PQhost".}
  175. proc pqport*(conn: PPGconn): cstring{.cdecl, dynlib: dllName, importc: "PQport".}
  176. proc pqtty*(conn: PPGconn): cstring{.cdecl, dynlib: dllName, importc: "PQtty".}
  177. proc pqoptions*(conn: PPGconn): cstring{.cdecl, dynlib: dllName,
  178. importc: "PQoptions".}
  179. proc pqstatus*(conn: PPGconn): ConnStatusType{.cdecl, dynlib: dllName,
  180. importc: "PQstatus".}
  181. proc pqtransactionStatus*(conn: PPGconn): PGTransactionStatusType{.cdecl,
  182. dynlib: dllName, importc: "PQtransactionStatus".}
  183. proc pqparameterStatus*(conn: PPGconn, paramName: cstring): cstring{.cdecl,
  184. dynlib: dllName, importc: "PQparameterStatus".}
  185. proc pqserverVersion*(conn: PPGconn): int32{.cdecl,
  186. dynlib: dllName, importc: "PQserverVersion".}
  187. proc pqprotocolVersion*(conn: PPGconn): int32{.cdecl, dynlib: dllName,
  188. importc: "PQprotocolVersion".}
  189. proc pqerrorMessage*(conn: PPGconn): cstring{.cdecl, dynlib: dllName,
  190. importc: "PQerrorMessage".}
  191. proc pqsocket*(conn: PPGconn): int32{.cdecl, dynlib: dllName,
  192. importc: "PQsocket".}
  193. proc pqbackendPID*(conn: PPGconn): int32{.cdecl, dynlib: dllName,
  194. importc: "PQbackendPID".}
  195. proc pqconnectionNeedsPassword*(conn: PPGconn): int32{.cdecl, dynlib: dllName,
  196. importc: "PQconnectionNeedsPassword".}
  197. proc pqconnectionUsedPassword*(conn: PPGconn): int32{.cdecl, dynlib: dllName,
  198. importc: "PQconnectionUsedPassword".}
  199. proc pqclientEncoding*(conn: PPGconn): int32{.cdecl, dynlib: dllName,
  200. importc: "PQclientEncoding".}
  201. proc pqsetClientEncoding*(conn: PPGconn, encoding: cstring): int32{.cdecl,
  202. dynlib: dllName, importc: "PQsetClientEncoding".}
  203. when defined(USE_SSL):
  204. # Get the SSL structure associated with a connection
  205. proc pqgetssl*(conn: PPGconn): PSSL{.cdecl, dynlib: dllName,
  206. importc: "PQgetssl".}
  207. proc pqsetErrorVerbosity*(conn: PPGconn, verbosity: PGVerbosity): PGVerbosity{.
  208. cdecl, dynlib: dllName, importc: "PQsetErrorVerbosity".}
  209. proc pqtrace*(conn: PPGconn, debug_port: File){.cdecl, dynlib: dllName,
  210. importc: "PQtrace".}
  211. proc pquntrace*(conn: PPGconn){.cdecl, dynlib: dllName, importc: "PQuntrace".}
  212. proc pqsetNoticeReceiver*(conn: PPGconn, theProc: PQnoticeReceiver, arg: pointer): PQnoticeReceiver{.
  213. cdecl, dynlib: dllName, importc: "PQsetNoticeReceiver".}
  214. proc pqsetNoticeProcessor*(conn: PPGconn, theProc: PQnoticeProcessor,
  215. arg: pointer): PQnoticeProcessor{.cdecl,
  216. dynlib: dllName, importc: "PQsetNoticeProcessor".}
  217. proc pqexec*(conn: PPGconn, query: cstring): PPGresult{.cdecl, dynlib: dllName,
  218. importc: "PQexec".}
  219. proc pqexecParams*(conn: PPGconn, command: cstring, nParams: int32,
  220. paramTypes: POid, paramValues: cstringArray,
  221. paramLengths, paramFormats: ptr int32, resultFormat: int32): PPGresult{.
  222. cdecl, dynlib: dllName, importc: "PQexecParams".}
  223. proc pqprepare*(conn: PPGconn, stmtName, query: cstring, nParams: int32,
  224. paramTypes: POid): PPGresult{.cdecl, dynlib: dllName, importc: "PQprepare".}
  225. proc pqexecPrepared*(conn: PPGconn, stmtName: cstring, nParams: int32,
  226. paramValues: cstringArray,
  227. paramLengths, paramFormats: ptr int32, resultFormat: int32): PPGresult{.
  228. cdecl, dynlib: dllName, importc: "PQexecPrepared".}
  229. proc pqsendQuery*(conn: PPGconn, query: cstring): int32{.cdecl, dynlib: dllName,
  230. importc: "PQsendQuery".}
  231. ## See also https://www.postgresql.org/docs/current/libpq-async.html
  232. proc pqsendQueryParams*(conn: PPGconn, command: cstring, nParams: int32,
  233. paramTypes: POid, paramValues: cstringArray,
  234. paramLengths, paramFormats: ptr int32,
  235. resultFormat: int32): int32{.cdecl, dynlib: dllName,
  236. importc: "PQsendQueryParams".}
  237. proc pqsendQueryPrepared*(conn: PPGconn, stmtName: cstring, nParams: int32,
  238. paramValues: cstringArray,
  239. paramLengths, paramFormats: ptr int32,
  240. resultFormat: int32): int32{.cdecl, dynlib: dllName,
  241. importc: "PQsendQueryPrepared".}
  242. proc pqSetSingleRowMode*(conn: PPGconn): int32{.cdecl, dynlib: dllName,
  243. importc: "PQsetSingleRowMode".}
  244. ## See also https://www.postgresql.org/docs/current/libpq-single-row-mode.html
  245. proc pqgetResult*(conn: PPGconn): PPGresult{.cdecl, dynlib: dllName,
  246. importc: "PQgetResult".}
  247. proc pqisBusy*(conn: PPGconn): int32{.cdecl, dynlib: dllName,
  248. importc: "PQisBusy".}
  249. proc pqconsumeInput*(conn: PPGconn): int32{.cdecl, dynlib: dllName,
  250. importc: "PQconsumeInput".}
  251. proc pqnotifies*(conn: PPGconn): PPGNotify{.cdecl, dynlib: dllName,
  252. importc: "PQnotifies".}
  253. proc pqputCopyData*(conn: PPGconn, buffer: cstring, nbytes: int32): int32{.
  254. cdecl, dynlib: dllName, importc: "PQputCopyData".}
  255. proc pqputCopyEnd*(conn: PPGconn, errormsg: cstring): int32{.cdecl,
  256. dynlib: dllName, importc: "PQputCopyEnd".}
  257. proc pqgetCopyData*(conn: PPGconn, buffer: cstringArray, async: int32): int32{.
  258. cdecl, dynlib: dllName, importc: "PQgetCopyData".}
  259. proc pqgetline*(conn: PPGconn, str: cstring, len: int32): int32{.cdecl,
  260. dynlib: dllName, importc: "PQgetline".}
  261. proc pqputline*(conn: PPGconn, str: cstring): int32{.cdecl, dynlib: dllName,
  262. importc: "PQputline".}
  263. proc pqgetlineAsync*(conn: PPGconn, buffer: cstring, bufsize: int32): int32{.
  264. cdecl, dynlib: dllName, importc: "PQgetlineAsync".}
  265. proc pqputnbytes*(conn: PPGconn, buffer: cstring, nbytes: int32): int32{.cdecl,
  266. dynlib: dllName, importc: "PQputnbytes".}
  267. proc pqendcopy*(conn: PPGconn): int32{.cdecl, dynlib: dllName,
  268. importc: "PQendcopy".}
  269. proc pqsetnonblocking*(conn: PPGconn, arg: int32): int32{.cdecl,
  270. dynlib: dllName, importc: "PQsetnonblocking".}
  271. proc pqisnonblocking*(conn: PPGconn): int32{.cdecl, dynlib: dllName,
  272. importc: "PQisnonblocking".}
  273. proc pqflush*(conn: PPGconn): int32{.cdecl, dynlib: dllName, importc: "PQflush".}
  274. proc pqfn*(conn: PPGconn, fnid: int32, result_buf, result_len: ptr int32,
  275. result_is_int: int32, args: PPQArgBlock, nargs: int32): PPGresult{.
  276. cdecl, dynlib: dllName, importc: "PQfn".}
  277. proc pqresultStatus*(res: PPGresult): ExecStatusType{.cdecl, dynlib: dllName,
  278. importc: "PQresultStatus".}
  279. proc pqresStatus*(status: ExecStatusType): cstring{.cdecl, dynlib: dllName,
  280. importc: "PQresStatus".}
  281. proc pqresultErrorMessage*(res: PPGresult): cstring{.cdecl, dynlib: dllName,
  282. importc: "PQresultErrorMessage".}
  283. proc pqresultErrorField*(res: PPGresult, fieldcode: int32): cstring{.cdecl,
  284. dynlib: dllName, importc: "PQresultErrorField".}
  285. proc pqntuples*(res: PPGresult): int32{.cdecl, dynlib: dllName,
  286. importc: "PQntuples".}
  287. proc pqnfields*(res: PPGresult): int32{.cdecl, dynlib: dllName,
  288. importc: "PQnfields".}
  289. proc pqbinaryTuples*(res: PPGresult): int32{.cdecl, dynlib: dllName,
  290. importc: "PQbinaryTuples".}
  291. proc pqfname*(res: PPGresult, field_num: int32): cstring{.cdecl,
  292. dynlib: dllName, importc: "PQfname".}
  293. proc pqfnumber*(res: PPGresult, field_name: cstring): int32{.cdecl,
  294. dynlib: dllName, importc: "PQfnumber".}
  295. proc pqftable*(res: PPGresult, field_num: int32): Oid{.cdecl, dynlib: dllName,
  296. importc: "PQftable".}
  297. proc pqftablecol*(res: PPGresult, field_num: int32): int32{.cdecl,
  298. dynlib: dllName, importc: "PQftablecol".}
  299. proc pqfformat*(res: PPGresult, field_num: int32): int32{.cdecl,
  300. dynlib: dllName, importc: "PQfformat".}
  301. proc pqftype*(res: PPGresult, field_num: int32): Oid{.cdecl, dynlib: dllName,
  302. importc: "PQftype".}
  303. proc pqfsize*(res: PPGresult, field_num: int32): int32{.cdecl, dynlib: dllName,
  304. importc: "PQfsize".}
  305. proc pqfmod*(res: PPGresult, field_num: int32): int32{.cdecl, dynlib: dllName,
  306. importc: "PQfmod".}
  307. proc pqcmdStatus*(res: PPGresult): cstring{.cdecl, dynlib: dllName,
  308. importc: "PQcmdStatus".}
  309. proc pqoidStatus*(res: PPGresult): cstring{.cdecl, dynlib: dllName,
  310. importc: "PQoidStatus".}
  311. proc pqoidValue*(res: PPGresult): Oid{.cdecl, dynlib: dllName,
  312. importc: "PQoidValue".}
  313. proc pqcmdTuples*(res: PPGresult): cstring{.cdecl, dynlib: dllName,
  314. importc: "PQcmdTuples".}
  315. proc pqgetvalue*(res: PPGresult, tup_num: int32, field_num: int32): cstring{.
  316. cdecl, dynlib: dllName, importc: "PQgetvalue".}
  317. proc pqgetlength*(res: PPGresult, tup_num: int32, field_num: int32): int32{.
  318. cdecl, dynlib: dllName, importc: "PQgetlength".}
  319. proc pqgetisnull*(res: PPGresult, tup_num: int32, field_num: int32): int32{.
  320. cdecl, dynlib: dllName, importc: "PQgetisnull".}
  321. proc pqclear*(res: PPGresult){.cdecl, dynlib: dllName, importc: "PQclear".}
  322. proc pqfreemem*(p: pointer){.cdecl, dynlib: dllName, importc: "PQfreemem".}
  323. proc pqmakeEmptyPGresult*(conn: PPGconn, status: ExecStatusType): PPGresult{.
  324. cdecl, dynlib: dllName, importc: "PQmakeEmptyPGresult".}
  325. proc pqescapeString*(till, `from`: cstring, len: int): int{.cdecl,
  326. dynlib: dllName, importc: "PQescapeString".}
  327. proc pqescapeBytea*(bintext: cstring, binlen: int, bytealen: var int): cstring{.
  328. cdecl, dynlib: dllName, importc: "PQescapeBytea".}
  329. proc pqunescapeBytea*(strtext: cstring, retbuflen: var int): cstring{.cdecl,
  330. dynlib: dllName, importc: "PQunescapeBytea".}
  331. proc pqprint*(fout: File, res: PPGresult, ps: PPQprintOpt){.cdecl,
  332. dynlib: dllName, importc: "PQprint".}
  333. proc pqdisplayTuples*(res: PPGresult, fp: File, fillAlign: int32,
  334. fieldSep: cstring, printHeader: int32, quiet: int32){.
  335. cdecl, dynlib: dllName, importc: "PQdisplayTuples".}
  336. proc pqprintTuples*(res: PPGresult, fout: File, printAttName: int32,
  337. terseOutput: int32, width: int32){.cdecl, dynlib: dllName,
  338. importc: "PQprintTuples".}
  339. proc lo_open*(conn: PPGconn, lobjId: Oid, mode: int32): int32{.cdecl,
  340. dynlib: dllName, importc: "lo_open".}
  341. proc lo_close*(conn: PPGconn, fd: int32): int32{.cdecl, dynlib: dllName,
  342. importc: "lo_close".}
  343. proc lo_read*(conn: PPGconn, fd: int32, buf: cstring, length: int): int32{.
  344. cdecl, dynlib: dllName, importc: "lo_read".}
  345. proc lo_write*(conn: PPGconn, fd: int32, buf: cstring, length: int): int32{.
  346. cdecl, dynlib: dllName, importc: "lo_write".}
  347. proc lo_lseek*(conn: PPGconn, fd: int32, offset: int32, whence: int32): int32{.
  348. cdecl, dynlib: dllName, importc: "lo_lseek".}
  349. proc lo_creat*(conn: PPGconn, mode: int32): Oid{.cdecl, dynlib: dllName,
  350. importc: "lo_creat".}
  351. proc lo_tell*(conn: PPGconn, fd: int32): int32{.cdecl, dynlib: dllName,
  352. importc: "lo_tell".}
  353. proc lo_unlink*(conn: PPGconn, lobjId: Oid): int32{.cdecl, dynlib: dllName,
  354. importc: "lo_unlink".}
  355. proc lo_import*(conn: PPGconn, filename: cstring): Oid{.cdecl, dynlib: dllName,
  356. importc: "lo_import".}
  357. proc lo_export*(conn: PPGconn, lobjId: Oid, filename: cstring): int32{.cdecl,
  358. dynlib: dllName, importc: "lo_export".}
  359. proc pqmblen*(s: cstring, encoding: int32): int32{.cdecl, dynlib: dllName,
  360. importc: "PQmblen".}
  361. proc pqenv2encoding*(): int32{.cdecl, dynlib: dllName, importc: "PQenv2encoding".}
  362. proc pqsetdb(M_PGHOST, M_PGPORT, M_PGOPT, M_PGTTY, M_DBNAME: cstring): PPGconn =
  363. result = pqsetdbLogin(M_PGHOST, M_PGPORT, M_PGOPT, M_PGTTY, M_DBNAME, "", "")
  364. when defined(nimHasStyleChecks):
  365. {.pop.}