view m-toolbox/classes/+utils/@jmysql/getRepositoryVersion.m @ 10:75007001cbfe database-connection-manager

Check for binary only objects
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

% getRepositoryVersion tries to get the version of the repository by
% inspecting various fields in the database.
% 
% ver = utils.jmysql.getRepositoryVersion(conn)
% 
% Rules:
%       objs table contains field 'uuid' => ver = 2.1
% 
% else: ver = 2.0;
% 
% M Hewitson 11-08-09
% 
% $Id: getRepositoryVersion.m,v 1.2 2009/08/11 12:33:19 ingo Exp $
% 

function ver = getRepositoryVersion(conn)
  
  ver = '2.0';
  
  q    = ['describe ' char(conn.getDatabase) '.objs'];
  results = conn.query(q);
  fields = {};
  while results.next
    fields = [fields {char(results.getString(1))}];
  end

  if utils.helper.ismember('uuid', fields)
    ver = '2.1';
  end
  
  
end