Changeset b61af96


Ignore:
Timestamp:
08/02/10 14:22:36 (7 years ago)
Author:
Marc-Antoine Parent <map@…>
Branches:
('master', '490da607341fc912953151a06bff77650ca214bb')('vitrine', '64aced58f2abea1ed48aa3134c125a714fe507cf')
Children:
33c17739455fef53ac27702eb4354db3ef509df5
Parents:
ad2acc59daa34580b0c031caa18a6c5b2424be53
git-author:
Marc-Antoine Parent <map@ntic.org>2010-08-02 14:22:36-04:00
git-committer:
Marc-Antoine Parent <map@ntic.org>2010-08-02 14:22:36-04:00
Message:

Variable name has become a reserved word. Already changed in schema_20.sql, but useful for a fresh install.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sql/nested_set_api.sql

    r3550449 rb61af96  
    218218                rec_subtree_root RECORD; 
    219219                sqlstring TEXT; 
    220                 move INTEGER; 
     220                move_distance INTEGER; 
    221221                level_change INTEGER; 
    222222        BEGIN 
     
    251251                                -- Calculate the move size (signed for direction) and level difference  
    252252                                IF new_parent_id IS NOT NULL THEN 
    253                                         move:=rec_new_parent.ns_right-rec_subtree_root.ns_left; 
     253                                        move_distance:=rec_new_parent.ns_right-rec_subtree_root.ns_left; 
    254254                                        level_change:=rec_new_parent.ns_level+ 1 - rec_subtree_root. ns_level; 
    255255                                ELSE 
    256                                         move:=(SELECT MAX(ns_right) FROM vocabulary_terms WHERE vdex_4_vocabulary_identifier = voc_id)+1-rec_subtree_root.ns_left;               
     256                                        move_distance:=(SELECT MAX(ns_right) FROM vocabulary_terms WHERE vdex_4_vocabulary_identifier = voc_id)+1-rec_subtree_root.ns_left;              
    257257                                        level_change:=0 - rec_subtree_root. ns_level; 
    258258                                END IF;  
    259                                 IF move = 0 THEN 
     259                                IF move_distance = 0 THEN 
    260260                                        RAISE EXCEPTION ''voc_move_subtree():  Move distance is 0'';     
    261261                                END IF; 
    262                                 --RAISE EXCEPTION ''voc_move_subtree():  move: % and level_change: %'',move,level_change; 
     262                                --RAISE EXCEPTION ''voc_move_subtree():  move_distance: % and level_change: %'',move_distance,level_change; 
    263263 
    264264                                --Create the hole to move the subtree 
     
    274274                                END IF; 
    275275                                 
    276                                 IF move < 0 THEN 
     276                                IF move_distance < 0 THEN 
    277277                                        --Update the subtree record, it was moved as well while punching the hole before it 
    278278                                        SELECT INTO rec_subtree_root vdex_6_1_identifier, ns_left, ns_right, ns_level, (ns_right-ns_left)+1 as width FROM vocabulary_terms WHERE vdex_4_vocabulary_identifier = voc_id AND vdex_6_1_identifier = subtree_root_id; 
     
    281281                                        END IF;  
    282282                                        --Adjust the move distance 
    283                                         move := move - rec_subtree_root.width; 
     283                                        move_distance := move_distance - rec_subtree_root.width; 
    284284                                END IF; 
    285                                 --RAISE EXCEPTION ''voc_move_subtree():  Final move: % and level_change: %'',move,level_change; 
     285                                --RAISE EXCEPTION ''voc_move_subtree():  Final move_distance: % and level_change: %'',move_distance,level_change; 
    286286 
    287287                                --Move the subtree in it''s final place 
    288                                 UPDATE vocabulary_terms SET ns_left = ns_left + move, ns_right=ns_right + move, ns_level=ns_level+level_change WHERE vdex_4_vocabulary_identifier = voc_id AND ns_left >= rec_subtree_root.ns_left AND ns_right <= rec_subtree_root.ns_right; 
     288                                UPDATE vocabulary_terms SET ns_left = ns_left + move_distance, ns_right=ns_right + move_distance, ns_level=ns_level+level_change WHERE vdex_4_vocabulary_identifier = voc_id AND ns_left >= rec_subtree_root.ns_left AND ns_right <= rec_subtree_root.ns_right; 
    289289                                        IF NOT FOUND THEN 
    290290                                                RAISE EXCEPTION ''voc_move_subtree():  No rows affected while moving subtree in final location'';        
Note: See TracChangeset for help on using the changeset viewer.