Page 1 of 1

SQLStoredProc

Posted: Fri 13 Jul 2007 11:47
by anglam62
I have used Delphi 7, mySQL 5.0, dbxmda 3.10.4 Trial. No problem in this case.
After, I buy the dbxmda 3.20.5 and the same program give me an error.
Using SQLStoredProc that have params[0] ptResult (integer) and param[1] ptInput (string).
Is sufficient I try to put Active = true, the error is :
'Incorrect number of argument of FUNCTION BASENAME.FUNCTIONNAME; expected 1, got 0.'
That is not true. Infact removing dbxmda 3.20.5 and installing
the old version the function give mi the correct value.

Posted: Mon 16 Jul 2007 13:42
by Antaeus
Please show me the code that you use to setup SQLStoredProc, fill its parameters and run it, and SQL statement to create a stored procedure/function on the server. What Queries are sent to server in both cases (you can use the TSQLMonitor, or SQL server logs for that)?

Try to call this function using the SQLQuery component. Query may look like this:
SELECT func(:inp_parameter)

Posted: Mon 16 Jul 2007 15:39
by anglam62
Hi Antaeus!

The code to setup SQLStoredProc is:

dmOrdini.ScriviProgrGen.Close;
dmOrdini.ScriviProgrGen.ParamByName('Tipo').AsString := 'Ordini';
dmOrdini.ScriviProgrGen.Open;

on the open if gives me the error

Error: Incorrect number of arguments for FUNCTION sigea.ScriviProgrGen; expected 1, got 0

This is my Function on the server:

CREATE DEFINER = 'root'@'localhost' FUNCTION `ScriviProgrGen`(Tipo CHAR(6))
RETURNS int(11)
NOT DETERMINISTIC
CONTAINS SQL
SQL SECURITY DEFINER
COMMENT ''
BEGIN
DECLARE ResultValue Integer;
IF NOT EXISTS
(SELECT Progr from progressivi
WHERE Ditta = '000'
AND Anno = '0000'
AND tipo = Tipo
AND Serie = '00') THEN
INSERT INTO Progressivi (Ditta,Anno,Tipo,Serie,progr)
VALUES('000','0000',Tipo,'00',0);
END IF;
select Progr into ResultValue
from progressivi
WHERE Ditta = '000'
AND Anno = '0000'
AND Tipo = Tipo
AND Serie = '00'
For UPDATE;
update Progressivi
set progr=Progr+1
WHERE Ditta = '000'
AND Anno = '0000'
AND Tipo = Tipo
AND Serie = '00';
RETURN ResultValue+1;
END;

I try to call the function 'Select ScriviProgrGen('Ordini')' using the SQLQuery component

the log Result is:

Select ScriviProgrGen(?)
:1 (String[6],IN) = 'Ordini'

if i try to open the SQLStoredProcedure

the log Result is:

SELECT ScriviProgrGen(?)
:1 (Int32,RESULT) =
:2 (String[6],IN) = 'Ordini'

Error: Incorrect number of arguments for FUNCTION sigea.ScriviProgrGen; expected 1, got 0

Thanks
bye
Angelo.

Posted: Wed 18 Jul 2007 08:36
by Antaeus
Thank you for such detailed information. We have reproduced this problem and fixed it. This fix will be included in the next build of DbxMda.

Posted: Thu 19 Jul 2007 06:39
by anglam62
hi Antaeus,
I'm glad, to be Useful.
One month ago, I decide to migrate from BDE to MySql, someone suggest me to use dbexpress and dbxmda.
so I try it an then buy dbxmda. But Just now, I undestend that in my case the best is MyDac. I try it. it's excellent.
As I buy the licenze of dbxmda on June 27 2007, I ask you if is possible to change it with MyDac.
Thanks.
Angelo

Posted: Fri 20 Jul 2007 08:35
by Devart
Please send your developer license number for DbxMda to our sales team by email.