records.hrl 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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_vendor :: mysql | mariadb,
  21. server_version :: [integer()],
  22. connection_id :: integer(),
  23. capabilities :: integer(),
  24. character_set :: integer(),
  25. status :: integer(),
  26. auth_plugin_data :: binary(),
  27. auth_plugin_name :: binary()}).
  28. -record(auth_method_switch, {
  29. auth_plugin_name :: binary(),
  30. auth_plugin_data :: binary()
  31. }).
  32. %% OK packet, commonly used in the protocol.
  33. -record(ok, {affected_rows :: integer(),
  34. insert_id :: integer(),
  35. status :: integer(),
  36. warning_count :: integer(),
  37. msg :: binary()}).
  38. %% Error packet, commonly used in the protocol.
  39. -record(error, {code :: integer(), state :: binary() | undefined,
  40. msg :: binary()}).
  41. %% EOF packet, commonly used in the protocol.
  42. -record(eof, {status, warning_count}).
  43. %% Column definition, used while parsing a result set.
  44. -record(col, {name, type, charset, length, decimals, flags,
  45. decode_decimal=auto}).
  46. %% A resultset. The rows can be either lists of terms or unparsed binaries as
  47. %% received from the server using either the text protocol or the binary
  48. %% protocol.
  49. -record(resultset, {cols :: [#col{}],
  50. rows :: [[term()] | binary()],
  51. status :: integer(),
  52. warning_count :: integer()}).
  53. %% Response of a successful prepare call.
  54. -record(prepared, {statement_id :: integer(),
  55. orig_query :: iodata(),
  56. param_count :: integer(),
  57. warning_count :: integer()}).