records.hrl 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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, state, msg}).
  39. %% EOF packet, commonly used in the protocol.
  40. -record(eof, {status, warning_count}).
  41. %% Column definition, used while parsing a result set.
  42. -record(col, {name, type, charset, length, decimals, flags}).
  43. %% A resultset. The rows can be either lists of terms or unparsed binaries as
  44. %% received from the server using either the text protocol or the binary
  45. %% protocol.
  46. -record(resultset, {cols :: [#col{}],
  47. rows :: [[term()] | binary()],
  48. status :: integer(),
  49. warning_count :: integer()}).
  50. %% Response of a successfull prepare call.
  51. -record(prepared, {statement_id :: integer(),
  52. orig_query :: iodata(),
  53. param_count :: integer(),
  54. warning_count :: integer()}).