0001 function qtxt = mysql_get_qtxt(qids,varargin)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 narg = length(varargin);
0013 for iarg = 1:2:narg
0014 switch varargin{iarg}
0015 case 'conn_id'
0016 conn_id = varargin{iarg+1};
0017 otherwise
0018 fprintf('get_qtxt: Unknown input argument: %s\n', varargin{iarg});
0019 end
0020 end
0021
0022
0023 if ~exist('conn_id','var') || isempty(conn_id) || mysql(conn_id,'status')
0024 error('%s: Do not have a valid connection ID', mfilename);
0025 end
0026
0027 qid_str = sprintf('%d,', qids);
0028 qid_str = sprintf('(%s)', qid_str(1:end-1));
0029
0030 mysql_str = sprintf(['SELECT question_text FROM question ' ...
0031 'WHERE question_id IN %s;'], qid_str);
0032
0033 qtxt = mysql(conn_id,mysql_str);
0034
0035 return