Subject | RE: [IBO] Stored Procedure Changed Params not used!! |
---|---|
Author | Ben Daniel |
Post date | 2003-10-01T00:32:15Z |
Here's more info on the problem,
I created a simple test scenerio and was able to reproduce the problem (well,
unfortunately I can't produce anyother result at the moment, lol :oP)
Here's a script that will create the test database objects:
-------------------------- BEGIN SCRIPT ---------------------------
/* Create a generator */
CREATE GENERATOR MYGENERATOR;
/* Create a simple generator incrementor stored-proc */
SET TERM ^ ;
CREATE PROCEDURE MYSTOREDPROC (
BYAMOUNT INTEGER)
RETURNS (
GENRESULT INTEGER)
AS
BEGIN
GenResult = Gen_ID(MYGENERATOR, ByAmount);
SUSPEND;
END^
SET TERM ; ^
COMMIT;
GRANT EXECUTE ON PROCEDURE MYSTOREDPROC TO PUBLIC;
--------------------------- END SCRIPT ---------------------------
I have created a simple test form which illustrates the problem and included the dfm and pas source:
--------------------------- BEGIN DFM ---------------------------
object Form1: TForm1
Left = 293
Top = 133
Width = 401
Height = 242
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Button1: TBitBtn
Left = 5
Top = 37
Width = 63
Height = 25
Caption = '&Run'
TabOrder = 0
OnClick = Button1Click
end
object Memo1: TMemo
Left = 82
Top = 10
Width = 306
Height = 198
TabOrder = 1
end
object Edit1: TEdit
Left = 5
Top = 11
Width = 65
Height = 21
TabOrder = 2
end
object IBOStoredProc1: TIBOStoredProc
Params = <
item
DataType = ftInteger
Name = 'ByAmount'
ParamType = ptInput
end
item
DataType = ftInteger
Name = 'GenResult'
ParamType = ptOutput
end>
StoredProcHasDML = False
StoredProcName = 'MYSTOREDPROC'
DatabaseName = 'PCS'
Left = 28
Top = 88
end
end
---------------------------- END DFM ----------------------------
--------------------------- BEGIN PAS ---------------------------
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Buttons, Db, IBODataset, PCSFrm;
type
TForm1 = class(TPCSForm)
IBOStoredProc1: TIBOStoredProc;
Button1: TBitBtn;
Memo1: TMemo;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
IBOStoredProc1.Unprepare;
IBOStoredProc1.ParamByName('ByAmount').AsInteger := StrToIntDef(Edit1.Text, 0);
IBOStoredProc1.Prepare;
IBOStoredProc1.ExecProc;
Memo1.Lines.Add('ByAmount = ' + IBOStoredProc1.ParamByName('ByAmount').AsString +
', GenResult = ' + IBOStoredProc1.ParamByName('GenResult').AsString);
end;
end.
---------------------------- END PAS ----------------------------
We are using:
- Interbase Server 5.6
- Interbase Client 5.6.0.29
Thanks,
Ben
I created a simple test scenerio and was able to reproduce the problem (well,
unfortunately I can't produce anyother result at the moment, lol :oP)
Here's a script that will create the test database objects:
-------------------------- BEGIN SCRIPT ---------------------------
/* Create a generator */
CREATE GENERATOR MYGENERATOR;
/* Create a simple generator incrementor stored-proc */
SET TERM ^ ;
CREATE PROCEDURE MYSTOREDPROC (
BYAMOUNT INTEGER)
RETURNS (
GENRESULT INTEGER)
AS
BEGIN
GenResult = Gen_ID(MYGENERATOR, ByAmount);
SUSPEND;
END^
SET TERM ; ^
COMMIT;
GRANT EXECUTE ON PROCEDURE MYSTOREDPROC TO PUBLIC;
--------------------------- END SCRIPT ---------------------------
I have created a simple test form which illustrates the problem and included the dfm and pas source:
--------------------------- BEGIN DFM ---------------------------
object Form1: TForm1
Left = 293
Top = 133
Width = 401
Height = 242
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Button1: TBitBtn
Left = 5
Top = 37
Width = 63
Height = 25
Caption = '&Run'
TabOrder = 0
OnClick = Button1Click
end
object Memo1: TMemo
Left = 82
Top = 10
Width = 306
Height = 198
TabOrder = 1
end
object Edit1: TEdit
Left = 5
Top = 11
Width = 65
Height = 21
TabOrder = 2
end
object IBOStoredProc1: TIBOStoredProc
Params = <
item
DataType = ftInteger
Name = 'ByAmount'
ParamType = ptInput
end
item
DataType = ftInteger
Name = 'GenResult'
ParamType = ptOutput
end>
StoredProcHasDML = False
StoredProcName = 'MYSTOREDPROC'
DatabaseName = 'PCS'
Left = 28
Top = 88
end
end
---------------------------- END DFM ----------------------------
--------------------------- BEGIN PAS ---------------------------
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Buttons, Db, IBODataset, PCSFrm;
type
TForm1 = class(TPCSForm)
IBOStoredProc1: TIBOStoredProc;
Button1: TBitBtn;
Memo1: TMemo;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
IBOStoredProc1.Unprepare;
IBOStoredProc1.ParamByName('ByAmount').AsInteger := StrToIntDef(Edit1.Text, 0);
IBOStoredProc1.Prepare;
IBOStoredProc1.ExecProc;
Memo1.Lines.Add('ByAmount = ' + IBOStoredProc1.ParamByName('ByAmount').AsString +
', GenResult = ' + IBOStoredProc1.ParamByName('GenResult').AsString);
end;
end.
---------------------------- END PAS ----------------------------
We are using:
- Interbase Server 5.6
- Interbase Client 5.6.0.29
Thanks,
Ben