Bdata

From Bcontrol
Revision as of 22:00, 6 September 2008 by Jerlich (talk | contribs)

bdata is a wrapper for mym

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.


Commands to get you started:

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