Reputation: 63
This is my Delphi code to add user to Interbase security database
uses
IBHeader,IBExternals
var
Form7: TForm7;
userData: TUserSecData;
userDataPtr: PUserSecData;
status: array[0..19] of ISC_STATUS;
isc_status: PISC_STATUS;
procedure TForm7.Create_UserClick(Sender: TObject);
begin
{ setup isc_status pointer }
isc_status :=@status;
{ setup user data pointer to point to user data structure }
userDataPtr :=@userData;
{ setup user data structure }
userData.user_name :='aseem';
userData.password :='xxxxxxx';
userData.protocol :=sec_protocol_local;
userData.dba_user_name :='SYSDBA';
userData.dba_password :='xxxxxxx'; { Don_t hardcode this }
userData.first_name :='asa';
userData.last_name :='sad';
userData.sec_flags :=sec_password_spec or sec_dba_user_name_spec or
sec_dba_password_spec or sec_first_name_spec or sec_last_name_spec;
{ add user to security database }
isc_add_user(isc_status,userDataPtr);
end;
But there is one error like
isc_add_user(isc_status,userDataPtr);
function is not found in IBheader.pas,IBExternals
Can you please tell me what is the problem in this code?
I am using Delphi 2007 professional edition and I'm using the IBheader.pas, IBExternals.pas files that are in the source folder inside CodeGear.
Upvotes: 2
Views: 941
Reputation: 17203
You may want to use the interface defined in the IBIntf.pas:
uses IBHeader, IBExternals, IBIntf;
procedure TMyForm.RegisterNewUser;
var
status: ISC_STATUS;
status_vector: array[0..19] of ISC_STATUS;
user_sec_data: UserSecData;
gds: IGDSLibrary;
begin
//setup the user info and then
...
//call the function
gds := GetGDSLibrary;
gds.LoadLibrary;
try
status := gds.isc_add_user(@status_vector[0], @user_sec_data);
//check the status and act accordingly
finally
gds.FreeLibrary;
end;
end;
Or you may want to use the TIBSecurityService, which is part of IBX, the same library that provides the headers you're using, by calling it's AddUser method.
Or, in modern Interbase, you may want to just execute a CREATE USER
SQL statement to perform that action.
Upvotes: 2
Reputation: 16045
Download Unified Interbase library and copy all needed API declarations from it
TLama also suggests this article: http://edn.embarcadero.com/article/25831
Upvotes: 1