Table name from StorageEvent
4 posts
• Page 1 of 1
Table name from StorageEvent
Hi,
Can I somehow extract the name of the database table on which a StorageEvent happens?
In the following generic code I want to fill sTableName with that name
Thanks for your help.
Luc
Can I somehow extract the name of the database table on which a StorageEvent happens?
In the following generic code I want to fill sTableName with that name
- Code: Select all
public void doLog(StorageEvent pEvent) throws Exception
{
IBean oldRow = pEvent.getOld();
IBean newRow = pEvent.getNew();
Bean newLog = new Bean();
String sUser = TriggerAPI.getCurrentUserName();
Timestamp tTime = TriggerAPI.getCurrentTimestamp();
String sTableName = pEvent. ?????????????;
newLog.put("DBLOG_NEW", newRow.toString());
newLog.put("DBLOG_OLD", oldRow.toString());
newLog.put("SYS_CREATED_BY", sUser);
newLog.put("SYS_CREATED_ON", tTime);
newLog.put("TABLENAME", sTableName);
DBStorage dblog = getDblog();
dblog.insert(newLog);
}
Thanks for your help.
Luc
- lucdep
- Posts: 53
- Joined: Wed Oct 10, 2018 12:01 pm
Re: Table name from StorageEvent
You have the method: getStorage
Simply use the storage information/metadata/...
Simply use the storage information/metadata/...
-
Support@SIB - Posts: 353
- Joined: Mon Sep 28, 2009 1:56 pm
Re: Table name from StorageEvent
Hi,
I don't see any reference to the name of the database table in Metadata, just to Columns...
So what would the correct line be?
Thanks,
Luc
I don't see any reference to the name of the database table in Metadata, just to Columns...
So what would the correct line be?
- Code: Select all
String sOrigin = pEvent.getStorage().getMetaData().????
Thanks,
Luc
- lucdep
- Posts: 53
- Joined: Wed Oct 10, 2018 12:01 pm
Re: Table name from StorageEvent
Hi,
Figured it out...
Figured it out...
String sTableName = ((DBStorage)pEvent.getStorage()).getWritebackTable();
- lucdep
- Posts: 53
- Joined: Wed Oct 10, 2018 12:01 pm
4 posts
• Page 1 of 1