postgres3types.inc 5.4 KB

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