image thumbnail

mym

version 2.8.2 (12.4 MB) by DataJoint Bot
MySQL API for MATLAB with support for BLOB objects

74 Downloads

Updated 27 May 2021

From GitHub

View license on GitHub

MYM - Interact with a MySQL database server
Copyright 2005, EPFL (Yannick Maret)

Copyright notice: this code is a heavily modified version of the original
work of Robert Almgren from University of Toronto.

If no output arguments are given, then display results. Otherwise returns
requested data silently.

INSTALLATION
------------
(Recommended) Using GHToolbox (FileExchange Community Toolbox):
1. Install *GHToolbox* using using an appropriate method in
https://github.com/datajoint/GHToolbox
2. run: `ghtb.install('datajoint/mym')`

Greater than R2016b:
1. Utilize MATLAB built-in GUI i.e. *Top Ribbon -> Add-Ons -> Get Add-Ons*
2. Search and Select `mym`
3. Select *Add from GitHub*

Less than R2016b:
1. Utilize MATLAB built-in GUI i.e. *Top Ribbon -> Add-Ons -> Get Add-Ons*
2. Search and Select `mym`
3. Select *Download from GitHub*
4. Save `mym.mltbx` locally
5. Navigate in MATLAB tree browser to saved toolbox file
6. Right-Click and Select *Install*
7. Select *Install*

From Source:
1. Download `mym.mltbx` locally
2. Navigate in MATLAB tree browser to saved toolbox file
3. Right-Click and Select *Install*
4. Select *Install*

mym() or mym
------------
shows status of all open connections (returns nothing).
mym('open', host, user, password)
---------------------------------
Open a connection with specified parameters, or defaults if none
host: default is local host. Use colon for port number
user: default is Unix login name.
password: default says connect without password.
use_tls: (optional) TLS encryption type. Values are as follows:
- 'true': TLS encryption is required.
- 'false': TLS encryption is disabled.
- 'nan'(default): TLS encryption utilized if available.
Examples: mym('open','arkiv') % connect on default port
mym('open','arkiv:2215') % TLS Preferred
mym('open','arkiv','root','simple','true') % TLS Required
If successful, open returns 0 if successful, and throw an error
otherwise. The program can maintain up to 20 independent connections.
Any command may be preceded by a connection handle -- an integer from 0
to 10 -- to apply the command to that connection.
Examples: mym(5,'open','host2') % connection 5 to host 2
mym % status of all connections
When no connection handle is given, mym use 0 by default. If the
corresponding connection is open, it is closed and opened again.
It is possible to ask mym to look for an available connection
handle by using -1. The used connection handle is then returned.
Example: cid = mym(-1, 'open', 'host2') % cid contains the used
connection handle
mym('close')
------------
Close the current connection. Use mym('closeall') to closes all open
connections.
mym('use',db) or mym('use db')
---------------------------------
Set the current database to db
Example: mym('use cme')
mym('status')
-------------
Display information about the connection and the server. Connections
utilizing TLS encryption will be displayed as '(encrypted)'.
Return 0 if connection is open and functioning
1 if connection is closed
2 if should be open but we cannot ping the server
mym(query)
----------
Send the given query or command to the MySQL server. If arguments are
given on the left, then each argument is set to the column of the
returned query. Dates and times in result are converted to Matlab
format: dates are serial day number, and times are fraction of day.
String variables are returned as cell arrays.
Example: p = mym('select price from contract where date="1997-04-30"');
% Returns price for contract that occured on April 30, 1997.
Note: All string comparisons are case-insensitive
Placeholders: in a query the following placeholders can be used: {S},
{Si}, {M}, {F}, and {B}.
Example: i = 1000;
B = [1 2; 3 4];
mym('INSERT INTO test(id,value) VALUES("{Si}","{M}")',i,B);
A = mym('SELECT value FROM test WHERE id ="{Si}")', 1000);
% Insert the array B into table test with id=1000. Then the
% value is retrieved and put into A.
{S} is remplaced by a string given by the corresponding argument arg.
Arg can be a matlab string or a scalar. The format of the string
for double scalars is [sign]d.ddddddEddd; for integers the format
is [sign]dddddd.
{Sn} is the same as {S} but for double scalar only. The format of the
string is [sign]d.ddddEddd, where the number of decimal after the
dot is given by n.
{Si} is the same as {S} but for double scalar only. The

Cite As

DataJoint Bot (2021). mym (https://github.com/datajoint/mym/releases/tag/v2.8.2), GitHub. Retrieved .

MATLAB Release Compatibility
Created with R2016b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

distribution/mexa64

distribution/mexmaci64

distribution/mexw64

To view or report issues in this GitHub add-on, visit the GitHub Repository.
To view or report issues in this GitHub add-on, visit the GitHub Repository.