mysql4_com.pp 4.7 KB

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