overview.edoc 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. ------------------------------------------------------------------------
  17. @title MySQL/OTP client library
  18. @doc
  19. This is the documentation generated from the Erlang source code using EDoc.
  20. The source code is available on the github page <a target="_top"
  21. href="https://github.com/mysql-otp/mysql-otp/">
  22. https://github.com/mysql-otp/mysql-otp/</a> along with a wiki and an issue
  23. tracker.
  24. This documentation is free to to copy, change and use for any purpose in
  25. accordance with the GNU GPL 3 or any later version as it is generated from the
  26. the source code itself which has this license. See the LICENSE file in the
  27. source code.
  28. <h2>API functions</h2>
  29. The <a href="mysql.html">mysql</a> module contains all the API
  30. functions for connecting to and interacting with a MySQL server.
  31. The <a href="mysql_connection.html">mysql_connection</a> module is the
  32. `gen_server' callback module holding a connection so you may want to refer to
  33. that sometimes (e.g. in the Modules part in a childspec for a supervisor). The
  34. other modules are for the internals.
  35. <h2>Value representation</h2>
  36. <table>
  37. <thead>
  38. <tr>
  39. <th>MySQL</th>
  40. <th>Erlang</th>
  41. <th>Example</th>
  42. </tr>
  43. </thead>
  44. <tbody>
  45. <tr>
  46. <td>INT, TINYINT, etc.</td>
  47. <td>`integer()'</td>
  48. <td>`42'</td>
  49. </tr>
  50. <tr>
  51. <td>VARCHAR, TEXT, etc.</td>
  52. <td>`iodata()'</td>
  53. <td>`<<"foo">>, "bar"'</td>
  54. </tr>
  55. <tr>
  56. <td>FLOAT, DOUBLE</td>
  57. <td>`float()'</td>
  58. <td>`3.14'</td>
  59. </tr>
  60. <tr>
  61. <td>DECIMAL</td>
  62. <td>`binary()'</td>
  63. <td>`<<"3.140">>'</td>
  64. </tr>
  65. <tr>
  66. <td>DATETIME, TIMESTAMP</td>
  67. <td>`calendar:datetime()'</td>
  68. <td>`{{2014, 11, 18}, {10, 22, 36}}'</td>
  69. </tr>
  70. <tr>
  71. <td>DATE</td>
  72. <td>`calendar:date()'</td>
  73. <td>`{2014, 11, 18}'</td>
  74. </tr>
  75. <tr>
  76. <td>TIME</td>
  77. <td>`{Days, calendar:time()}'</td>
  78. <td>`{0, {10, 22, 36}}'</td>
  79. </tr>
  80. <tr>
  81. <td>NULL</td>
  82. <td>`null'</td>
  83. <td>`null'</td>
  84. </tr>
  85. </tbody>
  86. </table>
  87. <h2>Example with Poolboy</h2>
  88. TODO