postgres3types.inc 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. {
  2. Contains the types needed for use with Postgres protocol v3
  3. }
  4. Type
  5. size_t = sizeint;
  6. psize_t = ^size_t;
  7. TFILE = Longint;
  8. PFIle = ^TFILE;
  9. POid = ^Oid;
  10. Oid = dword;
  11. const
  12. ERROR_MSG_LENGTH = 4096;
  13. CMDSTATUS_LEN = 40;
  14. Type
  15. TSockAddr = Array [1..112] of byte;
  16. TPGresAttDesc = record
  17. name : Pchar;
  18. adtid : Oid;
  19. adtsize : integer;
  20. end;
  21. PPGresAttDesc= ^TPGresAttDesc;
  22. PPPGresAttDesc= ^PPGresAttDesc;
  23. TPGresAttValue = record
  24. len : longint;
  25. value : Pchar;
  26. end;
  27. PPGresAttValue= ^TPGresAttValue;
  28. PPPGresAttValue= ^PPGresAttValue;
  29. PExecStatusType = ^TExecStatusType;
  30. TExecStatusType = (PGRES_EMPTY_QUERY := 0,PGRES_COMMAND_OK,
  31. PGRES_TUPLES_OK,PGRES_COPY_OUT,PGRES_COPY_IN,
  32. PGRES_BAD_RESPONSE,PGRES_NONFATAL_ERROR,
  33. PGRES_FATAL_ERROR);
  34. TPGlobjfuncs = record
  35. fn_lo_open : Oid;
  36. fn_lo_close : Oid;
  37. fn_lo_creat : Oid;
  38. fn_lo_unlink : Oid;
  39. fn_lo_lseek : Oid;
  40. fn_lo_tell : Oid;
  41. fn_lo_read : Oid;
  42. fn_lo_write : Oid;
  43. end;
  44. PPGlobjfuncs= ^TPGlobjfuncs;
  45. PConnStatusType = ^TConnStatusType;
  46. TConnStatusType = (CONNECTION_OK,CONNECTION_BAD,CONNECTION_STARTED,
  47. CONNECTION_MADE,CONNECTION_AWAITING_RESPONSE,
  48. CONNECTION_AUTH_OK,CONNECTION_SETENV,
  49. CONNECTION_SSL_STARTUP,CONNECTION_NEEDED);
  50. TPGconn = record
  51. pghost : Pchar;
  52. pgtty : Pchar;
  53. pgport : Pchar;
  54. pgoptions : Pchar;
  55. dbName : Pchar;
  56. status : TConnStatusType;
  57. errorMessage : array[0..(ERROR_MSG_LENGTH)-1] of char;
  58. Pfin : PFILE;
  59. Pfout : PFILE;
  60. Pfdebug : PFILE;
  61. sock : longint;
  62. laddr : TSockAddr;
  63. raddr : TSockAddr;
  64. salt : array[0..(2)-1] of char;
  65. asyncNotifyWaiting : longint;
  66. notifyList : PDllist;
  67. pguser : Pchar;
  68. pgpass : Pchar;
  69. lobjfuncs : PPGlobjfuncs;
  70. end;
  71. PPGconn= ^TPGconn;
  72. TPGresult = record
  73. ntups : longint;
  74. numAttributes : longint;
  75. attDescs : PPGresAttDesc;
  76. tuples : PPPGresAttValue;
  77. tupArrSize : longint;
  78. resultStatus : TExecStatusType;
  79. cmdStatus : array[0..(CMDSTATUS_LEN)-1] of char;
  80. binary : longint;
  81. conn : PPGconn;
  82. end;
  83. PPGresult= ^TPGresult;
  84. PPostgresPollingStatusType = ^PostgresPollingStatusType;
  85. PostgresPollingStatusType = (PGRES_POLLING_FAILED := 0,PGRES_POLLING_READING,
  86. PGRES_POLLING_WRITING,PGRES_POLLING_OK,
  87. PGRES_POLLING_ACTIVE);
  88. PPGTransactionStatusType = ^PGTransactionStatusType;
  89. PGTransactionStatusType = (PQTRANS_IDLE,PQTRANS_ACTIVE,PQTRANS_INTRANS,
  90. PQTRANS_INERROR,PQTRANS_UNKNOWN);
  91. PPGVerbosity = ^PGVerbosity;
  92. PGVerbosity = (PQERRORS_TERSE,PQERRORS_DEFAULT,PQERRORS_VERBOSE);
  93. PpgNotify = ^pgNotify;
  94. pgNotify = record
  95. relname : Pchar;
  96. be_pid : longint;
  97. extra : Pchar;
  98. end;
  99. { Function types for notice-handling callbacks }
  100. PQnoticeReceiver = procedure (arg:pointer; res:PPGresult);cdecl;
  101. PQnoticeProcessor = procedure (arg:pointer; message:Pchar);cdecl;
  102. { Print options for PQprint() }
  103. Ppqbool = ^pqbool;
  104. pqbool = char;
  105. P_PQprintOpt = ^_PQprintOpt;
  106. _PQprintOpt = record
  107. header : pqbool;
  108. align : pqbool;
  109. standard : pqbool;
  110. html3 : pqbool;
  111. expanded : pqbool;
  112. pager : pqbool;
  113. fieldSep : Pchar;
  114. tableOpt : Pchar;
  115. caption : Pchar;
  116. fieldName : ^Pchar;
  117. end;
  118. PQprintOpt = _PQprintOpt;
  119. PPQprintOpt = ^PQprintOpt;
  120. { ----------------
  121. * Structure for the conninfo parameter definitions returned by PQconndefaults
  122. *
  123. * All fields except "val" point at static strings which must not be altered.
  124. * "val" is either NULL or a malloc'd current-value string. PQconninfoFree()
  125. * will release both the val strings and the PQconninfoOption array itself.
  126. * ----------------
  127. }
  128. P_PQconninfoOption = ^_PQconninfoOption;
  129. _PQconninfoOption = record
  130. keyword : Pchar;
  131. envvar : Pchar;
  132. compiled : Pchar;
  133. val : Pchar;
  134. _label : Pchar;
  135. dispchar : Pchar;
  136. dispsize : longint;
  137. end;
  138. PQconninfoOption = _PQconninfoOption;
  139. PPQconninfoOption = ^PQconninfoOption;
  140. { ----------------
  141. * PQArgBlock -- structure for PQfn() arguments
  142. * ----------------
  143. }
  144. { can't use void (dec compiler barfs) }
  145. PPQArgBlock = ^PQArgBlock;
  146. PQArgBlock = record
  147. len : longint;
  148. isint : longint;
  149. u : record
  150. case longint of
  151. 0 : ( ptr : Plongint );
  152. 1 : ( integer : longint );
  153. end;
  154. end;