overview.edoc 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. MySQL/OTP – MySQL client library for Erlang/OTP
  2. Copyright (C) 2014 Viktor Söderqvist
  3. This file is part of MySQL/OTP.
  4. MySQL/OTP is free software: you can redistribute it and/or modify it under
  5. the terms of the GNU Lesser General Public License as published by the Free
  6. Software Foundation, either version 3 of the License, or (at your option)
  7. any later version.
  8. This program is distributed in the hope that it will be useful, but WITHOUT
  9. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  11. more details.
  12. You should have received a copy of the GNU Lesser General Public License
  13. along with this program. If not, see <https://www.gnu.org/licenses/>.
  14. ------------------------------------------------------------------------
  15. @title MySQL/OTP client library
  16. @doc
  17. MySQL/OTP is a client library for connecting to MySQL databases from Erlang/OTP
  18. applications.
  19. This is the documentation generated from the Erlang source code using EDoc.
  20. The project page is here:
  21. <a href="https://github.com/mysql-otp/mysql-otp/"
  22. target="_top">https://github.com/mysql-otp/mysql-otp/</a>.
  23. <h2>API functions</h2>
  24. The <a href="mysql.html">mysql</a> module contains all the API functions for
  25. connecting to and interacting with a MySQL server.
  26. <h2 id="value-representation">Value representation</h2>
  27. <table>
  28. <thead>
  29. <tr>
  30. <th>MySQL</th>
  31. <th>Erlang</th>
  32. <th>Example</th>
  33. </tr>
  34. </thead>
  35. <tbody>
  36. <tr>
  37. <td>INT, TINYINT, etc.</td>
  38. <td>`integer()'</td>
  39. <td>`42'</td>
  40. </tr>
  41. <tr>
  42. <td>VARCHAR, TEXT, etc.</td>
  43. <td>`iodata()' [<a href="#vn1">1</a>]</td>
  44. <td>`<<"foo">>, "bar"'</td>
  45. </tr>
  46. <tr>
  47. <td>FLOAT, DOUBLE</td>
  48. <td>`float()'</td>
  49. <td>`3.14'</td>
  50. </tr>
  51. <tr>
  52. <td>DECIMAL</td>
  53. <td>`binary()' [<a href="#vn2">2</a>]</td>
  54. <td>`<<"3.140">>'</td>
  55. </tr>
  56. <tr>
  57. <td>DATETIME, TIMESTAMP</td>
  58. <td>`calendar:datetime()' [<a href="#vn3">3</a>]</td>
  59. <td>`{{2014, 11, 18}, {10, 22, 36}}'</td>
  60. </tr>
  61. <tr>
  62. <td>DATE</td>
  63. <td>`calendar:date()'</td>
  64. <td>`{2014, 11, 18}'</td>
  65. </tr>
  66. <tr>
  67. <td>TIME</td>
  68. <td>`{Days, calendar:time()}' [<a href="#vn3">3</a>,
  69. <a href="#vn4">4</a>]</td>
  70. <td>`{0, {10, 22, 36}}'</td>
  71. </tr>
  72. <tr>
  73. <td>NULL</td>
  74. <td>`null'</td>
  75. <td>`null'</td>
  76. </tr>
  77. </tbody>
  78. </table>
  79. Notes:
  80. <ol>
  81. <li id="vn1">When fetching VARCHAR, TEXT etc. they are returned as `binary()'.
  82. When sending (insert or update) any `iodata()' is accepted.</li>
  83. <li id="vn2">DECIMAL are currently always returned as `binary()'. This will
  84. probably be changed to something similar to how the `odbc' OTP application
  85. handles them, namely
  86. <ul>
  87. <li>`integer()' when there are no fractions;</li>
  88. <li>`float()' when the precision of a float is exact enough;</li>
  89. <li>`binary()' when the precision of a float is not enough.</li>
  90. </ul>
  91. </li>
  92. <li id="vn3">For `DATETIME', `TIMESTAMP' and `TIME' values with franctions of
  93. seconds, we use a float for the seconds part. (These are unusual and were
  94. added to MySQL in version 5.6.4.)</li>
  95. <li id="vn4">Since `TIME' can be outside the `calendar:time()' interval, we use
  96. the format as returned by calendar:seconds_to_daystime/1 for `TIME'
  97. values.</li>
  98. </ol>
  99. <h2>Copying</h2>
  100. Copyright 2014 The contributors of MySQL/OTP. See the project page at
  101. <a href="https://github.com/mysql-otp/mysql-otp"
  102. target="_top">https://github.com/mysql-otp/mysql-otp</a>.
  103. This library is free software licensed under the GNU LGPL which allows you to
  104. use it in proprietary applications as well as free software applications with
  105. other licenses. This documentation is generated from the source code and thus
  106. goes under the same license as the library itself.