bartt
committed
on 17 Sep 02
Removal of ec-default-master.
/postgresql/file-storage-package-create.sql (+3 -3)
342 342                              v_filename,                  -- title
343 343                              v_description,               -- description
344 344                              v_mime_type,                 -- mime_type
345 345                              v_new_file_id,               -- item_id
346 346                              copy_file__creation_user,    -- creation_user
347 347                              copy_file__creation_ip       -- creation_ip
348 348                              );
349 349                             
350 350         if v_indb_p
351 351         then
352 352
353 353                 -- Lob to copy from
354 354                 select lob into v_lob_id
355 355                 from cr_revisions
356 356                 where revision_id = v_live_revision;
357 357
358 358                 -- New lob id
359 359                 v_new_lob_id := empty_lob();
360 360
361 361                 -- copy the blob
362                   select lob_copy(v_lob_id,v_new_lob_id);
  362                 perform lob_copy(v_lob_id,v_new_lob_id);
363 363
364 364                 -- Update the lob id on the new version
365 365                 update cr_revisions
366 366                 set lob = v_new_lob_id,
367 367                     content_length = v_content_length
368 368                 where revision_id = v_new_version_id;
369 369
370 370         else
371 371
372 372                 -- For now, we simply copy the file name
373 373                 select content into v_file_path
374 374                 from cr_revisions
375 375                 where revision_id = v_live_revision;
376 376
377 377                 -- Update the file path
378 378                 update cr_revisions
379 379                 set content = v_file_path,
380 380                     content_length = v_content_length
381 381                 where revision_id = v_new_version_id;
382 382
 
385 385         perform acs_object__update_last_modified(copy_file__target_folder_id);
386 386
387 387         return v_new_version_id;
388 388
389 389 end;' language 'plpgsql';
390 390
391 391
392 392 create function file_storage__move_file (
393 393        --
394 394        -- Move a file (ans all its versions) to a different folder.
395 395        -- Wrapper for content_item__move
396 396        --
397 397        integer,         -- cr_folders.folder_id%TYPE,
398 398        integer          -- cr_folders.folder_id%TYPE
399 399 ) returns integer as '  -- 0 for success
400 400 declare
401 401         move_file__file_id              alias for $1;
402 402         move_file__target_folder_id     alias for $2;
403 403 begin
404 404
405           select content_item__move(
  405         perform content_item__move(
406 406                move_file__file_id,              -- item_id
407 407                move_file__target_folder_id      -- target_folder_id
408 408                );
409 409
410 410         perform acs_object__update_last_modified(move_file__target_folder_id);
411 411
412 412         return 0;
413 413 end;' language 'plpgsql';
414 414
415 415
416 416 create function file_storage__get_title (
417 417        --
418 418        -- Unfortunately, title in the file-storage context refers
419 419        -- to the name attribute in cr_items, not the title attribute in
420 420        -- cr_revisions
421 421        integer          -- cr_items.item_id%TYPE
422 422 ) returns varchar as '
423 423 declare
424 424   get_title__item_id                 alias for $1
425 425   v_title                            cr_items.name%TYPE;