% 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

