Beispiel #1
0
inline void CaUserDefault::Init(CaNode* pNode)
{
	m_strVirtualNodeUser = _T("");
	CaSessionManager& sessionMgr = theApp.GetSessionManager();
	CaSession session;
	session.SetNode(pNode->GetName());
	session.SetDatabase(_T("iidbdb"));
	session.SetIndependent(TRUE);
	session.SetDescription(sessionMgr.GetDescription());
	CaSessionUsage UseSession (&sessionMgr, &session);
	m_strVirtualNodeUser = INGRESII_llDBMSInfo(_T("username")); // session_user?
}
Beispiel #2
0
BOOL DML_QueryDatabase(CdSqlQuery* pDoc, CTypedPtrList< CObList, CaDBObject* >& listObj, int& nSessionVersion)
{
	BOOL bOK = FALSE;
	CString strNode = pDoc->GetNode();
	CString strConnectionString = pDoc->GetConnectInfo();
	if (!strConnectionString.IsEmpty())
		strNode = strConnectionString;
	CaLLQueryInfo queryInfo (OBT_DATABASE, strNode, _T("iidbdb"));
	queryInfo.SetFetchObjects (CaLLQueryInfo::FETCH_ALL);

	CString strDefault;
	CString strServer = pDoc->GetServer();
	CString strUser = pDoc->GetUser();

	strDefault.LoadString(IDS_DEFAULT_SERVER);
	if (strDefault.CompareNoCase(strServer) == 0)
		strServer = _T("");
	strDefault.LoadString(IDS_DEFAULT_USER);
	if (strDefault.CompareNoCase(strUser) == 0)
		strUser = pDoc->GetDefaultConnectedUser();
	queryInfo.SetServerClass(strServer);
	queryInfo.SetUser(strUser);

	SETLOCKMODE lockmode;
	memset (&lockmode, 0, sizeof(lockmode));
	lockmode.nReadLock = LM_NOLOCK;
	CaSessionManager& sessionMgr = theApp.GetSessionManager();
	CaSession session;
	session.SetFlag(queryInfo.GetFlag());
	session.SetNode(queryInfo.GetNode());
	session.SetDatabase(queryInfo.GetDatabase());
	session.SetUser(queryInfo.GetUser());
	session.SetServerClass(queryInfo.GetServerClass());
	session.SetOptions(queryInfo.GetOptions());
	session.SetDescription(sessionMgr.GetDescription());
	CaSessionUsage useSession (&sessionMgr, &session);
	CaSession* pSession = useSession.GetCurrentSession();
	if (pSession)
	{
		pSession->SetLockMode(&lockmode);
		nSessionVersion = pSession->GetVersion();
		bOK = INGRESII_llQueryObject2 (&queryInfo, listObj, pSession);
	}

	return bOK;
}
Beispiel #3
0
BOOL IJA_llQueryTableTransactionData (
    CaQueryTransactionInfo* pQueryInfo,
    CaTableTransactionItemData* pTableTrans)
{
	CString strStatement;
	CString strDatabase;
	CString strDatabaseOwner;
	CString strTable;
	CString strTableOwner;
	if (!pQueryInfo)
		return FALSE;
	pQueryInfo->GetDatabase (strDatabase, strDatabaseOwner);
	pQueryInfo->GetTable (strTable, strTableOwner);

	CaSessionManager& smgr = theApp.GetSessionManager();
	CaSession session;
	session.SetNode(pQueryInfo->GetNode());
	session.SetDatabase(strDatabase);
	session.SetIndependent(TRUE);
	CaSessionUsage sessionUsage(&smgr, &session, SESSION_COMMIT); // commit on release

	//
	// TODO: Replace this statement to select from the temporary table:
	strStatement.Format (_T("select * from %s.%s"), (LPCTSTR)strTableOwner, (LPCTSTR)strTable);
	CaIjaCursor* pCursor = new CaIjaCursor (1, strStatement);
	if (pCursor && pCursor->Open())
	{
		int nCount = 0;
		CStringList& listData = pTableTrans->GetListData();
		//
		// Fetch only one row for a transaction <pTableTrans>
		pCursor->Fetch(listData, nCount);
		pCursor->Close();
	}

	return TRUE;
}