Difference between revisions of "Bdata"

From Bcontrol
(New page: bdata is a wrapper for [http://sourceforge.net/projects/mym mym] There are three usages of bdata: #connid=bdata % returns the current connection id. #connid=bdata('connect',host,user,pass...)
 
Line 2: Line 2:
  
 
There are three usages of bdata:
 
There are three usages of bdata:
#connid=bdata % returns the current connection id.
+
;connid=bdata
#connid=bdata('connect',host,user,pass) % bdata , by default connects to the mysql database with select, show, insert, explain but NOT update or delete priviliges.
+
:returns the current connection id.
#[varargout]=bdata(sql_query)
+
;connid=bdata('connect',host,user,pass)  
 +
:bdata , by default connects to the mysql database with select, show, insert, explain but NOT update or delete priviliges.
 +
;[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 [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.  
Line 10: Line 17:
  
 
Commands to get you started:
 
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.

Revision as of 21:56, 6 September 2008

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 priviliges.
[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.