Bdata

From Bcontrol
Revision as of 15:30, 21 May 2009 by Jerlich (talk | contribs)

bdata is a wrapper for mym, which is a C++ function for accessing [1] from matlab.

Usage

There are three usages of bdata:

connid=bdata
returns the current connection id.
connid=bdata('connect',host,user,pass)
bdata , by default connects to the mysql database with select, show, insert, explain but NOT update or delete privileges. This usage is for the rare instance when you need to connect with extra privileges.
[varargout]=bdata(sql_query)
Examples
sessid=bdata('select sessid from sessions where hostname like "%15"')
bdata('select * from sessions limit 10')
[rat, avg_hits]=bdata('select ratname, avg(percent_correct) from sessions group by ratname')
bdata('select * from sessions where sessid="{S}"',19881)

This third use, is the most common. I highly recommend reading the documentation for mym and for the select syntax.

Content

MySql is an open-source implementation of an SQL relational database. SQL stands for Structured Query Language.

The content accessible through bdata is organized into different databases or schemas.

bdata('show schemas');

Database           
+------------------+
 solodata           
 bdata              
 protocol           
 ratinfo            
 udata     

To learn about the kind of information you can access using bdata, you can Commands to get you started:

bdata('show tables from <schema>')
shows all the tables available to search in bdata
bdata('explain <tablename>')
explain tells you about the table, e.g. column names and types.