records.hrl 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 :: binary(),
  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. %% OK packet, commonly used in the protocol.
  28. -record(ok, {affected_rows :: integer(),
  29. insert_id :: integer(),
  30. status :: integer(),
  31. warning_count :: integer(),
  32. msg :: binary()}).
  33. %% Error packet, commonly used in the protocol.
  34. -record(error, {code, state, msg}).
  35. %% EOF packet, commonly used in the protocol.
  36. -record(eof, {status, warning_count}).
  37. %% Column definition, used while parsing a result set.
  38. -record(col, {name, type, charset, length, decimals, flags}).
  39. %% A resultset. The rows can be either lists of terms or unparsed binaries as
  40. %% received from the server using either the text protocol or the binary
  41. %% protocol.
  42. -record(resultset, {cols :: [#col{}],
  43. rows :: [[term()] | binary()]}).
  44. %% Response of a successfull prepare call.
  45. -record(prepared, {statement_id :: integer(),
  46. param_count :: integer(),
  47. warning_count :: integer()}).