phpmyadmin / phpmyadmin/phpmyadmin

problem in Build trigger phpmyadmin near DECLARE

Open
#18,476 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
PHP
Stars
7.9k
Forks
3.6k
Avg merge
4d 18h
Merged PRs (30d)
36

Description

i have Trigger code in phpmyadmin

phpmyadmin shows a problem near DECLARE

image

BEGIN
    DECLARE videTimeSum,channel INT;
    DECLARE done INT DEFAULT FALSE;
    DECLARE cur1 CURSOR FOR Select  sum(videotime) - COALESCE(sum( TIMESTAMPDIFF(Minute,datestart, now() ) ),0)  as videot,channelnumber from videos where flag='0' and channelnumber in (Select channelnumber from channels where flag='0') group by channelnumber order by videot asc limit 1;
    DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
    If(New.channelnumber is NULL or New.channelnumber ='')
            then   
                SET @channel=(Select channelnumber from channels where flag='0' and channelnumber not in (Select channelnumber from videos where dateend is NULL) limit 1);
                IF(@channel is not NULL and @channel <>'')
                    then 
                        SET New.channelnumber=@channel;
                        SET New.playdate=now() + INTERVAL 1 MINUTE;
                        SET New.enddate=now() + INTERVAL New.videotime MINUTE;
                ELSE
                    OPEN cur1;
                    read_loop: LOOP
                        FETCH cur1 INTO videTimeSum,channel;
                        IF done THEN
                            LEAVE read_loop;
                        ELSE
                            SET New.channelnumber=channel; 
                            SET @videTimeSum=videTimeSum;
                            SET New.playdate = now() + INTERVAL @videTimeSum MINUTE;
                            SET New.enddate = now() + INTERVAL (@videTimeSum + New.videotime)  MINUTE;
                        END IF;
                    END LOOP;
                    CLOSE cur1;
                END IF;
    END IF;
    
END

Please help me to overcome this problem

i have phpmyadmin version 4.5.4.1deb2ubuntu2.1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported trigger problem with the supplied SQL and the stated phpMyAdmin version 4.5.4.1deb2ubuntu2.1, while checking whether the error comes from phpMyAdmin or MySQL/MariaDB. Done means identifying a reproducible phpMyAdmin defect with a defined expected result; the issue does not name a repository file or test.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.