Page 1 of 1

[solved] Error in ZSqlProcessor

Posted: 30.10.2012, 18:15
by ism
Mysql 5.1 Lazarus 1.0.2
http://svn.code.sf.net/p/zeoslib/code-0 ... es/testing rev 1943

Image

Error in code

Code: Select all

FormMain.ZSQLProcessorUpload.Script.Clear;    
FormMain.ZSQLProcessorUpload.Script.Add('call proc_del_data_to_ram_table_sklad (618);'); 
FormMain.ZSQLProcessorUpload.Execute;  
With this procedure error

Code: Select all

CREATE PROCEDURE maximator.proc_del_data_to_ram_table_sklad(IN sklad_id INT)
  SQL SECURITY INVOKER
  COMMENT 'Удаление позиций склада из RAM таблицы'
BEGIN

declare count_ INTEGER; 
DECLARE shag INTEGER;
DECLARE i INTEGER ;
declare command_ VARCHAR(255);
SELECT
  count(result_table_ram.id) as count_
FROM
  result_table_ram where (id_sklad_postavshika=sklad_id) INTO count_ ;
if count_>0 THEN
  SET shag=5000;
  set i=(count_ DIV shag)+1;
  REPEAT
    SET @command_=concat('DELETE FROM result_table_ram where id_sklad_postavshika=',sklad_id,' LIMIT ',shag);
    prepare exec_command from @command_;
    EXECUTE exec_command ;
    SET i=i-1;
  UNTIL i<=0
  END REPEAT;
end if;
END  

Posted: 30.10.2012, 18:54
by josimarz
Hello ism,

The problem is not in the Zeos Lib.

When a STORED PROCEDURE in MySQL returns a Result Set, you must specify this using the directives READS SQL DATA or MODIFIES SQL DATE.

More details: http://dev.mysql.com/doc/refman/5.0/en/ ... edure.html

Best regards,

Josimar

Posted: 30.10.2012, 21:06
by ism
Solved
For "PROCEDURE %s can't return a result set in the given context " need
ZConnection1.Properties:='CLIENT_MULTI_STATEMENTS=65535'

Thanks