mysql4_com.pp 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. {$mode objfpc}{$H+}
  2. {$MACRO on}
  3. {$PACKRECORDS C}
  4. {$IFNDEF FPC_DOTTEDUNITS}
  5. unit mysql4_com;
  6. {$ENDIF FPC_DOTTEDUNITS}
  7. interface
  8. {$IFDEF FPC_DOTTEDUNITS}
  9. uses
  10. System.CTypes,System.DynLibs;
  11. {$ELSE FPC_DOTTEDUNITS}
  12. uses
  13. ctypes,dynlibs;
  14. {$ENDIF FPC_DOTTEDUNITS}
  15. {$IFDEF Unix}
  16. {$DEFINE extdecl:=cdecl}
  17. const
  18. External_library = 'libmysqlclient.'+sharedsuffix;
  19. {$ENDIF}
  20. {$IFDEF Windows}
  21. {$DEFINE extdecl:=stdcall}
  22. const
  23. External_library = 'libmysql.dll';
  24. {$ENDIF}
  25. { Pointers to basic pascal types, inserted by h2pas conversion program.}
  26. Type
  27. PLongint = ^Longint;
  28. PSmallInt = ^SmallInt;
  29. PByte = ^Byte;
  30. PWord = ^Word;
  31. PDWord = ^DWord;
  32. PDouble = ^Double;
  33. {$i mysql4_comtypes.inc}
  34. { Copyright (C) 2000 MySQL AB
  35. This program is free software; you can redistribute it and/or modify
  36. it under the terms of the GNU General Public License as published by
  37. the Free Software Foundation; either version 2 of the License, or
  38. (at your option) any later version.
  39. This program is distributed in the hope that it will be useful,
  40. but WITHOUT ANY WARRANTY; without even the implied warranty of
  41. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  42. GNU General Public License for more details.
  43. You should have received a copy of the GNU General Public License
  44. along with this program; if not, write to the Free Software
  45. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA }
  46. function my_net_init(net:PNET; vio:PVio):longint;extdecl;external External_library name 'my_net_init';
  47. procedure net_end(net:PNET);extdecl;external External_library name 'net_end';
  48. procedure net_clear(net:PNET);extdecl;external External_library name 'net_clear';
  49. function net_flush(net:PNET):longint;extdecl;external External_library name 'net_flush';
  50. (* Const before type ignored *)
  51. function my_net_write(net:PNET; packet:PAnsiChar; len:dword):longint;extdecl;external External_library name 'my_net_write';
  52. (* Const before type ignored *)
  53. function net_write_command(net:PNET; command:byte; packet:PAnsiChar; len:dword):longint;extdecl;external External_library name 'net_write_command';
  54. (* Const before type ignored *)
  55. function net_real_write(net:PNET; packet:PAnsiChar; len:dword):longint;extdecl;external External_library name 'net_real_write';
  56. function my_net_read(net:PNET):dword;extdecl;external External_library name 'my_net_read';
  57. { The following function is not meant for normal usage }
  58. {
  59. struct sockaddr;
  60. int my_connect(my_socket s, const struct sockaddr name, unsigned int namelen,
  61. unsigned int timeout);
  62. }
  63. procedure randominit(_para1:Prand_struct; seed1:dword; seed2:dword);extdecl;external External_library name 'randominit';
  64. function rnd(_para1:Prand_struct):double;extdecl;external External_library name 'rnd';
  65. (* Const before type ignored *)
  66. procedure make_scrambled_password(_to:PAnsiChar; password:PAnsiChar);extdecl;external External_library name 'make_scrambled_password';
  67. (* Const before type ignored *)
  68. procedure get_salt_from_password(res:Pdword; password:PAnsiChar);extdecl;external External_library name 'get_salt_from_password';
  69. procedure make_password_from_salt(_to:PAnsiChar; hash_res:Pdword);extdecl;external External_library name 'make_password_from_salt';
  70. (* Const before type ignored *)
  71. (* Const before type ignored *)
  72. function scramble(_to:PAnsiChar; message:PAnsiChar; password:PAnsiChar; old_ver:my_bool):PAnsiChar;extdecl;external External_library name 'scramble';
  73. (* Const before type ignored *)
  74. (* Const before type ignored *)
  75. function check_scramble(_para1:PAnsiChar; message:PAnsiChar; salt:Pdword; old_ver:my_bool):my_bool;extdecl;external External_library name 'check_scramble';
  76. function get_tty_password(opt_message:PAnsiChar):PAnsiChar;extdecl;external External_library name 'get_tty_password';
  77. (* Const before type ignored *)
  78. procedure hash_password(result:Pdword; password:PAnsiChar);extdecl;external External_library name 'hash_password';
  79. { Some other useful functions }
  80. procedure my_init;extdecl;external External_library name 'my_init';
  81. (* Const before type ignored *)
  82. (* Const before type ignored *)
  83. procedure load_defaults(conf_file:PAnsiChar; groups:PPAnsiChar; argc:Plongint; argv:PPPAnsiChar);extdecl;external External_library name 'load_defaults';
  84. function my_thread_init:my_bool;extdecl;external External_library name 'my_thread_init';
  85. procedure my_thread_end;extdecl;external External_library name 'my_thread_end';
  86. function packet_error : longint;
  87. { For net_store_length }
  88. { was #define dname def_expr }
  89. function NULL_LENGTH : dword;
  90. implementation
  91. // Next function also defined in mysql4_comdyn
  92. { was #define dname def_expr }
  93. function packet_error : longint;
  94. { return type might be wrong }
  95. begin
  96. packet_error:= not ({dword}(0));
  97. end;
  98. // Next function also defined in mysql4_comdyn
  99. { was #define dname def_expr }
  100. function NULL_LENGTH : dword;
  101. begin
  102. NULL_LENGTH:=dword( not (0));
  103. end;
  104. end.