1 dnl Copyright (C) 2013 The Meme Factory, Inc. http://www.meme.com/
3 dnl This file is part of Gombe-MI.
5 dnl Gombe-MI is free software; you can redistribute it and/or modify
6 dnl it under the terms of the GNU General Public License as published by
7 dnl the Free Software Foundation; either version 3 of the License, or
8 dnl (at your option) any later version.
10 dnl This program is distributed in the hope that it will be useful,
11 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 dnl GNU General Public License for more details.
15 dnl You should have received a copy of the GNU General Public License
16 dnl along with Gombe-MI. If not, see <http://www.gnu.org/licenses/>.
18 dnl Function to convert an animid in the access db.
20 dnl Karl O. Pinc <kop@meme.com>
23 include(`copyright.m4')
24 include(`constants.m4')
26 include(`macros.m4')dnl
28 dnl Reset our search path so we pick up the conversion schema.
29 define(`gmi_function_search_path', `prepared_data, gombemi, pg_temp')
31 CREATE OR REPLACE FUNCTION prepared_data.convert_animid(this_animid VARCHAR(gmi_animid_len)
33 RETURNS VARCHAR(gmi_animid_len)
37 gmi_function_set_search_path
39 -- Convert a mis-identified animid.
41 -- GPL_notice(` --', `2013', `The Meme Factory, Inc. http://www.meme.com/')
43 -- Syntax: convert_animid(this_animid, this_date);
46 -- this_animid The animid to convert
47 -- this_date Date of the data in question.
53 -- One-off program. Once it works we won't run it again.
59 IF this_date >= '2001-12-02' AND this_date <= '2004-12-31' THEN
63 IF this_date >= '1995-03-02' THEN
64 IF this_date <= '2001-12-01' THEN
66 ELSIF this_date <= '2004-12-31' THEN
71 IF this_date >= '1998-02-06' AND this_date <= '2008-03-02' THEN
75 IF this_date >= '2001-01-01' AND this_date <= '2013-07-02' THEN
88 grant_func_priv(`prepared_data.convert_animid(VARCHAR(gmi_animid_len), DATE)')