Difference between revisions of "Bdata"

From Bcontrol
Line 1: Line 1:
bdata is a wrapper for [http://sourceforge.net/projects/mym mym]
+
bdata is a wrapper for [http://sourceforge.net/projects/mym mym], which is a C++ function for accessing [http://www.mysql.com] from matlab.
 
+
==Usage==
 
There are three usages of bdata:
 
There are three usages of bdata:
 
;connid=bdata
 
;connid=bdata
Line 13: Line 13:
 
:bdata('select * from sessions where sessid="{S}"',19881)
 
: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 [http://dev.mysql.com/doc/refman/5.0/en/select.html select] syntax.  
+
'''This third use, is the most common.  I highly recommend reading the documentation for [[mym]] and for the [http://dev.mysql.com/doc/refman/5.0/en/select.html 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|schemas]]'''.
  
 +
<code>bdata('show schemas');
 +
Database         
 +
+------------------+
 +
  [[Schemas#solodata|solodata]]         
 +
  [[Schemas#bdata|bdata]]             
 +
  [[Schemas#protocol|protocol]]         
 +
  [[Schemas#ratinfo|ratinfo]]           
 +
  [[Schemas#udata|udata]]   
 +
</code>
  
 +
To learn about the kind of information you can access using bdata, you can
 
Commands to get you started:
 
Commands to get you started:
;bdata('show tables')
+
;bdata('show tables from <schema>')
 
:shows all the tables available to search in bdata
 
:shows all the tables available to search in bdata
 
;bdata('explain <tablename>')  
 
;bdata('explain <tablename>')  
 
:explain tells you about the table, e.g. column names and types.
 
:explain tells you about the table, e.g. column names and types.

Revision as of 15:30, 21 May 2009

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.