TAG each input AO with a proper ID number. For each input AO, a new ID Tag is retrieved from the MySQL database and set in the AO. This is necessary before an AO can be submitted to the database. usage: aout = tag(ain, mysqlid) M Hewitson 09-05-07 $Id: tag.html,v 1.1 2007/06/08 14:15:03 hewitson Exp $
0001 function bs = tag(as, mymid) 0002 0003 % TAG each input AO with a proper ID number. 0004 % 0005 % For each input AO, a new ID Tag is retrieved from the MySQL database and 0006 % set in the AO. This is necessary before an AO can be submitted to the 0007 % database. 0008 % 0009 % usage: aout = tag(ain, mysqlid) 0010 % 0011 % M Hewitson 09-05-07 0012 % 0013 % $Id: tag.html,v 1.1 2007/06/08 14:15:03 hewitson Exp $ 0014 % 0015 0016 %-------------------------------------------------------------------------- 0017 % collect all AOs from input 0018 % as = []; 0019 % varargin 0020 % length(varargin) 0021 % for j=1:length(varargin) 0022 % a = varargin{j}; 0023 % if isa(a, 'ao') 0024 % as = [as a]; 0025 % end 0026 % end 0027 % if na < 1 0028 % error('### Incorrect inputs: please supply at least one AO to submit.'); 0029 % end 0030 0031 na = length(as); 0032 0033 %-------------------------------------------------------------------------- 0034 % Now process each AO 0035 bs = []; 0036 for j=1:na 0037 0038 a = as(j); 0039 disp(sprintf('** Taggin AO: %s', a.name)); 0040 0041 %----- complete all information in this AO 0042 0043 % get current max AO Id from server 0044 aoid = 1+mysql_getMaxId(mymid); 0045 disp(sprintf('** Got AO Id: %06d', aoid)); 0046 0047 % set id 0048 a = set(a, 'tag', aoid); 0049 bs = [bs a]; 0050 end 0051 0052 0053 % END