Code covered by the BSD License  

Highlights from
myblob_testdb

from myblob_testdb by Luca Cerone
This function is used to create test environments starting

myblob_testdb(conn,sourcedb,testdb,limit)
function myblob_testdb(conn,sourcedb,testdb,limit)

if strcmpi(limit,'all')
    limit='';
else
    limit=[' limit ' num2str(limit)];
end

myblob_command(conn,['use ' sourcedb ,';']); %entra nel db di origine
tableslist=myblob_command(conn,'show tables')';%recupera l'elenco delle tabelle presenti nel db di origine
numTables=size(tableslist,1); %conta il numero di tabelle nel db di origine.

risp=input(['Vuoi cancellare eventuali database preesistenti dal nome ' testdb '? (S/N)'],'s');

if strcmpi(risp,'s')
myblob_command(conn,['drop database if exists ' testdb ';']);
end

%cancella il Db di destinazione (se esiste)
myblob_command(conn,['create database if not exists ' testdb ]);

for i=1:numTables
    myblob_command(conn,['create table if not exists ' testdb '.' tableslist{i} ...
        ' like ' sourcedb '.' tableslist{i}]);
    myblob_command(conn,['insert into ' testdb '.' tableslist{i} ...
       ' select * from ' sourcedb '.' tableslist{i} limit ';']);
end

Contact us at files@mathworks.com