lars
committed
on 18 Dec 03
Set empty dates to null
openacs-4/.../postgresql/content-keyword.sql (+3 -3)
94 94
95 95 -- function new
96 96 create function content_keyword__new (varchar,varchar,integer,integer,timestamp,integer,varchar,varchar)
97 97 returns integer as '
98 98 declare
99 99   new__heading                alias for $1
100 100   new__description            alias for $2-- default null 
101 101   new__parent_id              alias for $3-- default null
102 102   new__keyword_id             alias for $4-- default null
103 103   new__creation_date          alias for $5-- default now()
104 104   new__creation_user          alias for $6-- default null
105 105   new__creation_ip            alias for $7-- default null
106 106   new__object_type            alias for $8-- default ''content_keyword''
107 107   v_id                        integer;      
108 108 begin
109 109
110 110   v_id := acs_object__new (new__keyword_id,
111 111                            new__object_type,
112 112                            new__creation_date,
113 113                            new__creation_user,
114                              new__creation_ip
115                              new__parent_id,
  114                            new__creation_ip,
  115                            new__parent_id
116 116   );
117 117    
118 118   insert into cr_keywords
119 119     (heading, description, keyword_id, parent_id)
120 120   values
121 121     (new__heading, new__description, v_id, new__parent_id);
122 122
123 123   return v_id;
124 124  
125 125 end;' language 'plpgsql';
126 126
127 127
128 128 -- procedure delete
129 129 create function content_keyword__delete (integer)
130 130 returns integer as '
131 131 declare
132 132   delete__keyword_id             alias for $1
133 133   v_item_id                      integer;     
134 134   v_rec                          record;
135 135 begin
 
257 257            k1.tree_sortkey like (k2.tree_sortkey || ''%'')) t,
258 258         cr_item_keyword_map m
259 259       where
260 260         t.keyword_id = m.keyword_id
261 261       and
262 262         m.item_id = is_assigned__item_id);
263 263
264 264   end if
265 265
266 266   -- Tried none, up and down - must be an invalid parameter
267 267   raise EXCEPTION ''-20000: The recurse parameter to content_keyword.is_assigned should be \\\'none\\\', \\\'up\\\' or \\\'down\\\''';
268 268  
269 269   return null;
270 270 end;' language 'plpgsql';
271 271
272 272
273 273 -- function get_path
274 274 create function content_keyword__get_path (integer)
275 275 returns text as '
276 276 declare
277     get_path_keyword_id             alias for $1
  277   get_path__keyword_id             alias for $1
278 278   v_path                          text default '''';
279 279   v_is_found                      boolean default ''f'';  
280 280   v_heading                       cr_keywords.heading%TYPE;
281 281   v_rec                           record;
282 282 begin
283 283 --               select
284 284 --                 heading
285 285 --               from (
286 286 --                  select
287 287 --                    heading, level as tree_level
288 288 --                  from cr_keywords
289 289 --                    connect by prior parent_id = keyword_id
290 290 --                    start with keyword_id = get_path.keyword_id) k
291 291 --                order by
292 292 --                  tree_level desc
293 293
294 294   for v_rec in select
295 295                  heading
296 296                from (
297 297                   select