Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM Client/Server » View Thread |
Messages 1 to 3 of 3 total |
Finding user from Update Trigger |
Tue, Jun 28 2011 8:06 PM | Permanent Link |
Adam H. | Hi,
I'm playing around with a log writing script that records detailed information about what changes are made to a database at the DBSRVR level. The one hitch I'm having at the moment is trying to find out which logged in user has made the change. The issue that I have is that Triggersession.RemoteUser is returning an empty string. The code I currently have is as follows: procedure TMainForm.ServerEngineAfterUpdateTrigger(Sender: TObject; TriggerSession: TDBISAMSession; TriggerDatabase: TDBISAMDatabase; const TableName: string; CurrentRecord: TDBISAMRecord); var i : integer; Msg : TStringList; f1 : TextFile; begin if uppercase(TriggerDatabase.DatabaseName) <> 'MEMORY' then begin Msg := TStringList.create; for I := 0 to CurrentRecord.fieldcount - 1 do // Iterate if CurrentRecord.fields[i].fieldkind = fkdata then if CurrentRecord.fields[i].value <> CurrentRecord.fields[i].oldvalue then Msg.add('RemoteUser '+Triggersession.RemoteUser+#9+ //<<<<<<<< 'Table '+TableName+#9+ 'RecordID '+inttostr(CurrentRecord.RecordID)+#9+ 'Field: '+CurrentRecord.fields[i].fieldname+#9+ 'Altered'+#9+'Old Value: ' + quotedstr(vartostr(CurrentRecord.fields[i].oldvalue)) + #9+ 'New Value: ' + quotedstr(vartostr(CurrentRecord.fields[i].value))); if msg.text <> '' then begin assignfile(F1, DetailedLogFile); Append(f1); for i := 0 to Msg.Count - 1 do Writeln(f1, Msg[i]); CloseFile(F1) end; msg.free; Msg := nil; end; end; Appreciate any help. Cheers Adam. ---------------------------- DBISam 4.30b6 Delphi 2007 |
Wed, Jun 29 2011 8:57 AM | Permanent Link |
Raul Team Elevate | Adam,
Have you checked the content of CurrentServerUser property which is specific to triggers ? Raul |
Thu, Jun 30 2011 2:40 AM | Permanent Link |
Adam H. | Hi Raul,
Perfect - thanks for that. This is what I was after! Best Regards Adam. > Adam, > > Have you checked the content of CurrentServerUser property which is specific to triggers ? > > Raul > |
This web page was last updated on Tuesday, April 23, 2024 at 08:10 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |