view m-toolbox/classes/+utils/@jmysql/getRepositoryVersion.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
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