MySQL/OTP – MySQL client library for Erlang/OTP Copyright (C) 2014 Viktor Söderqvist This file is part of MySQL/OTP. MySQL/OTP is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . ------------------------------------------------------------------------ @title MySQL/OTP client library @doc MySQL/OTP is a client library for connecting to MySQL databases from Erlang/OTP applications. This is the documentation generated from the Erlang source code using EDoc. The project page is here: https://github.com/mysql-otp/mysql-otp/.

API functions

The mysql module contains all the API functions for connecting to and interacting with a MySQL server.

Value representation

MySQL Erlang Example
INT, TINYINT, etc. `integer()' `42'
VARCHAR, TEXT, etc. `iodata()' [1] `<<"foo">>', `"bar"'
BIT(N) `<<_:N/bitstring>>' `<<255, 6:3>>'
FLOAT, DOUBLE `float()' `3.14'
DECIMAL(P, S) `integer()' when S == 0
`float()' when P =< 15 and S > 0
`binary()' when P >= 16 and S > 0 [2]
`42'
`3.14'
`<<"3.14159265358979323846">>'
DATETIME, TIMESTAMP `calendar:datetime()' [3] `{{2014, 11, 18}, {10, 22, 36}}'
DATE `calendar:date()' `{2014, 11, 18}'
TIME `{Days, calendar:time()}' [3, 4] `{0, {10, 22, 36}}'
NULL `null' `null'
Notes:
  1. When fetching VARCHAR, TEXT etc. they are returned as `binary()'. When sending (insert or update) any `iodata()' is accepted.
  2. DECIMALs are returned as `integer()' or `float()' when the value can be represented without precision loss and as `binary()' for high precision DECIMAL values. This is similar to how the `odbc' OTP application treats DECIMALs.
  3. For `DATETIME', `TIMESTAMP' and `TIME' values with franctions of seconds, we use a float for the seconds part. (These are unusual and were added to MySQL in version 5.6.4.)
  4. Since `TIME' can be outside the `calendar:time()' interval, we use the format as returned by `calendar:seconds_to_daystime/1' for `TIME' values.

Copying

Copyright 2014 The authors of MySQL/OTP. See the project page at https://github.com/mysql-otp/mysql-otp. This library is free software licensed under the GNU LGPL which allows you to use it in proprietary applications as well as free software applications with other licenses. This documentation is generated from the source code and thus goes under the same license as the library itself.