view m-toolbox/classes/+utils/@jmysql/queryDialog.m @ 3:960fe1aa1c10 database-connection-manager

Add LTPDADatabaseConnectionManager implementation. Java code
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

% QUERYDIALOG a visual query builder for querying an LTPDA repository.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DESCRIPTION: QUERYDIALOG a visual query builder for querying an LTPDA
%              repository.
%
% CALL:        utils.jmysql.queryDialog();
%              utils.jmysql.queryDialog(conn);
%
% INPUTS:
%              conn - a connection object like that returned from
%                     utils.jmysql.connect.
%
%
% VERSION:     $Id: queryDialog.m,v 1.2 2009/09/22 14:40:07 ingo Exp $
%
% HISTORY:     24-05-2007 M Hewitson
%                 Creation
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



function  queryDialog(varargin)
  
  if nargin == 1 && ~isa(varargin{1}, 'mpipeline.repository.RepositoryConnection')
    error('### The first argument should be empty or a RepositoryConnection');
  end
  
  
  % Inputs
  conn = [];
  if nargin > 0
    conn  = varargin{1};
  end
  
  if isempty(conn)
    conn = utils.jmysql.connect();
  end
  
  if ~conn.isConnected
    conn.openConnection
  end
  
  if ~conn.isConnected
    error('### Failed to connect to repository.');
  end
  
  % open a query dialog
  if nargin == 0
    closeConnectionOnExit = true;
  else
    closeConnectionOnExit = false;
  end
  warning('off', 'MATLAB:JavaEDTAutoDelegation');
  qrd = mpipeline.repository.RepositoryQueryDialog([], false, conn, false, closeConnectionOnExit);
  qrd.setVisible(true)
  warning('off', 'MATLAB:JavaEDTAutoDelegation');
  
  
  
end