|
|
|
очень хитрый запрос с call proc() или я что-то не так делаю?
|
|||
|---|---|---|---|
|
#18+
есть процедура: CREATE DEFINER=`root`@`localhost` PROCEDURE `getAllPoints`() BEGIN declare done1, done2, done3, done4, pointAlive BOOLEAN DEFAULT FALSE; *куча объявлений* ... *конец объявлений* **главный цикл declare cur1 cursor for select id, Owner_idOwner, longitude, lat,x,y from ExchangePoints.Point; declare continue handler for not found set done1= TRUE; DROP TEMPORARY TABLE IF EXISTS TEMP; CREATE temporary TABLE IF NOT EXISTS TEMP ( ** куча всего*** )ENGINE=MEMORY; open cur1; mainLoop: loop fetch cur1 into pointid, ownerid, pointlong, pointlat, pointx,pointy; if done1 then set done1 = FALSE; close cur1; leave mainLoop; end if; insert into TEMP (тут работает); BLOCK2:BEGIN **рабочий блок с курсором №1** END BLOCK2 ; BLOCK3:BEGIN **рабочий блок курсором №2** END BLOCK3; ** вот что не работает: call isAlive(pointid <<- переменная с значением,@Alive,@timeTill); update TEMP set Open = @Alive, TimeTill= @timeTill where Point_id = pointid;*/ end loop mainLoop; select * from TEMP; **Выводит только первую строку. **Если убрать вызов isAlive() - выдаст ~1200 строк END **а вот isAlive() CREATE DEFINER=`root`@`localhost` PROCEDURE `isAlive`(IN iPoint_id int, INOUT Alive int, INOUT timeTill time) BEGIN declare pointAlive int; select count(id) into pointAlive from ExchangePoints.Schedule where day = dayofweek(curdate())-1 and Point_id = iPoint_id and Start < curtime() and Stop > curtime(); if poinTalive then select pointAlive,timediff(Stop,curtime()) INTO Alive, timeTill from ExchangePoints.Schedule where day = dayofweek(curdate()) -1 and Point_id = iPoint_id; else select pointAlive,timediff(str_to_date(concat(curdate(),' ',@starttime), "%Y-%m-%d %T"),now()) INTO Alive, timeTill from ExchangePoints.Schedule where day = dayofweek(curdate()) -1 and Point_id = iPoint_id; end if; END Подскажите, что-же я делаю не правильно? Получается что после вызова isAlive с параметром внутри цикла mainloop эта процедура при возврате значений делает "break" mainloop? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 10.06.2015, 22:13:31 |
|
||
|
|

start [/forum/topic.php?desktop=1&fid=47&tid=1833072]: |
0ms |
get settings: |
6ms |
get forum list: |
20ms |
check forum access: |
4ms |
check topic access: |
4ms |
track hit: |
99ms |
get topic data: |
12ms |
get forum data: |
3ms |
get page messages: |
33ms |
get tp. blocked users: |
2ms |
| others: | 241ms |
| total: | 424ms |

| 0 / 0 |
