records.hrl 2.1 KB

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