[solved] Error in ZSqlProcessor

The alpha/beta tester's forum for ZeosLib 7.0.x series

Report problems concerning our Delphi 2009+ version and new Zeoslib 7.0 features here.

This is a forum that will be removed once the 7.X version goes into stable!!

Moderators: gto, EgonHugeist, olehs

Locked
ism
Zeos Test Team
Zeos Test Team
Posts: 202
Joined: 02.10.2010, 20:48

[solved] Error in ZSqlProcessor

Post 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  
Last edited by ism on 05.11.2012, 19:37, edited 1 time in total.
Lazarus 1.0.8 fpc 2.6.0
josimarz
Junior Boarder
Junior Boarder
Posts: 41
Joined: 14.09.2009, 17:29
Location: Brazil

Post 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
ism
Zeos Test Team
Zeos Test Team
Posts: 202
Joined: 02.10.2010, 20:48

Post by ism »

Solved
For "PROCEDURE %s can't return a result set in the given context " need
ZConnection1.Properties:='CLIENT_MULTI_STATEMENTS=65535'

Thanks
Lazarus 1.0.8 fpc 2.6.0
Locked