void SybCTnewDAImpl::IntDoPutbackConnection(SybCTnewDA *&pSyb, bool bIsOpen, const String &server, const String &user)
{
	StartTrace1(SybCTnewDAImpl.IntDoPutbackConnection, "putting &" << (long)(IFAObject *)pSyb);
	if ( bIsOpen ) {
		String strToStore(server);
		strToStore << '.' << user;
		TimeStamp aStamp;
		Anything anyTimeStamp(coast::storage::Global());
		if ( !fgListOfSybCT.LookupPath(anyTimeStamp, "Open") ) {
			anyTimeStamp = Anything(Anything::ArrayMarker(),coast::storage::Global());
			fgListOfSybCT["Open"] = anyTimeStamp;
		}
		Anything anyToStore(coast::storage::Global());
		anyToStore[0L] = (IFAObject *)pSyb;
		anyToStore[1L] = strToStore;
		anyTimeStamp[aStamp.AsString()].Append(anyToStore);
	} else {
		fgListOfSybCT["Unused"].Append((IFAObject *)pSyb);
	}
	TraceAny(fgListOfSybCT, "current list of connections");
}
bool SybCTnewDAImpl::CheckCloseOpenedConnections(long lTimeout)
{
	StartTrace(SybCTnewDAImpl.CheckCloseOpenedConnections);
	bool bRet = false;
	Anything anyTimeStamp(coast::storage::Global());
	TimeStamp aStamp;
	aStamp -= lTimeout;
	Trace("current timeout " << lTimeout << "s, resulting time [" << aStamp.AsString() << "]");
	LockUnlockEntry me(fgStructureMutex);
	if ( fgInitialized ) {
		TraceAny(fgListOfSybCT, "current list of connections");
		if ( fgListOfSybCT.LookupPath(anyTimeStamp, "Open") && anyTimeStamp.GetSize() ) {
			SybCTnewDA *pSyb = NULL;
			long lTS = 0L;
			// if we still have open connections and the last access is older than lTimeout seconds
			while ( anyTimeStamp.GetSize() && ( aStamp > TimeStamp(anyTimeStamp.SlotName(lTS)) ) ) {
				Anything anyTS(coast::storage::Global());
				anyTS = anyTimeStamp[lTS];
				TraceAny(anyTS, "stamp of connections to close [" << anyTimeStamp.SlotName(0L) << "]");
				while ( anyTS.GetSize() ) {
					pSyb = SafeCast(anyTS[0L][0L].AsIFAObject(), SybCTnewDA);
					anyTS.Remove(0L);
					if ( pSyb != NULL ) {
						Trace("closing timeouted connection");
						if ( pSyb->Close() ) {
							bRet = true;
						}
					} else {
						SYSWARNING("Sybase connection with address " << (long)pSyb << " not valid anymore!");
					}
					fgListOfSybCT["Unused"].Append((IFAObject *)pSyb);
				}
				anyTimeStamp.Remove(lTS);
			}
		}
	} else {
		SYSERROR("SybCTnewDAImpl not initialized!");
	}
	return bRet;
}