We have had problems with TSQLConnection.GetProcedureParams after upgrading from 5.1.2.0 to version 6.* and it doesn't seem to have been solved in 6.1.2.0.
I have made an attempt to copy/paste relevant code into an example below.
Is there a problem with accessing the procedure via public synonyms in the newer drivers?
If you can confirm that there is a problem, when can we expect it to be fixed? ("next version" is a little too vague)
Do you have any other advice?
(Maybe finding out the schema owner name somehow - can't be hardcoded - and append it to the procedure name.)
Code: Select all
unit dbxtest1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, sqlexpr, db, dbxdevartoracle;
type
TForm1 = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
var
SQLConnection: TSQLConnection;
OracleGetSerial: TSQLStoredProc;
paramList: TParams;
procParams: TList;
{$R *.dfm}
initialization
SQLConnection := TSQLConnection.Create(nil);
try
SQLConnection.ConnectionName := 'Devart Oracle';
SQLConnection.DriverName := 'DevartOracle';
SQLConnection.LoginPrompt := False;
SQLConnection.Params.Values['DataBase'] := 'hbgmedusaora';
SQLConnection.Params.Values['User_Name'] := 'asu'; // not schema owner!
SQLConnection.Params.Values['Password'] := 'asu';
SQLConnection.Connected := True;
paramList := TParams.Create;
procParams := TList.Create;
try
OracleGetSerial := TSQLStoredProc.Create(nil);
OracleGetSerial.SQLConnection := TSQLConnection(SQLConnection);
OracleGetSerial.StoredProcName := 'GetSerial'; // Defined in, say schema NX.
TSQLConnection(SQLConnection).GetProcedureParams('GetSerial', procParams);
if procParams.count = 0 then // Returns 4 if logged in as schema owner, but erroneously 0 when logged in as another user,
// despite PUBLIC SYNONYM pointing to procedure NX.GetSerial.
raise Exception.Create('GetSerial PLSQL function not installed or user has no rights to execute.');
LoadParamListItems(ParamList, ProcParams);
OracleGetSerial.Params.Assign(ParamList);
finally
FreeProcParams(ProcParams);
paramList.Free;
end;
finally
SQLConnection.Free;
end;
end.