records.hrl 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. %% MySQL/OTP – MySQL client library for Erlang/OTP
  2. %% Copyright (C) 2014 Viktor Söderqvist
  3. %%
  4. %% This file is part of MySQL/OTP.
  5. %%
  6. %% MySQL/OTP is free software: you can redistribute it and/or modify it under
  7. %% the terms of the GNU Lesser General Public License as published by the Free
  8. %% Software Foundation, either version 3 of the License, or (at your option)
  9. %% any later version.
  10. %%
  11. %% This program is distributed in the hope that it will be useful, but WITHOUT
  12. %% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13. %% FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  14. %% more details.
  15. %%
  16. %% You should have received a copy of the GNU Lesser General Public License
  17. %% along with this program. If not, see <https://www.gnu.org/licenses/>.
  18. %% --- Records ---
  19. %% Returned by parse_handshake/1.
  20. -record(handshake, {server_version :: [integer()],
  21. connection_id :: integer(),
  22. capabilities :: integer(),
  23. character_set :: integer(),
  24. status :: integer(),
  25. auth_plugin_data :: binary(),
  26. auth_plugin_name :: binary()}).
  27. -record(auth_method_switch, {
  28. auth_plugin_name :: binary(),
  29. auth_plugin_data :: binary()
  30. }).
  31. %% OK packet, commonly used in the protocol.
  32. -record(ok, {affected_rows :: integer(),
  33. insert_id :: integer(),
  34. status :: integer(),
  35. warning_count :: integer(),
  36. msg :: binary()}).
  37. %% Error packet, commonly used in the protocol.
  38. -record(error, {code :: integer(), state :: binary() | undefined,
  39. msg :: binary()}).
  40. %% EOF packet, commonly used in the protocol.
  41. -record(eof, {status, warning_count}).
  42. %% Column definition, used while parsing a result set.
  43. -record(col, {name, type, charset, length, decimals, flags}).
  44. %% A resultset. The rows can be either lists of terms or unparsed binaries as
  45. %% received from the server using either the text protocol or the binary
  46. %% protocol.
  47. -record(resultset, {cols :: [#col{}],
  48. rows :: [[term()] | binary()],
  49. status :: integer(),
  50. warning_count :: integer()}).
  51. %% Response of a successfull prepare call.
  52. -record(prepared, {statement_id :: integer(),
  53. orig_query :: iodata(),
  54. param_count :: integer(),
  55. warning_count :: integer()}).