LONG CBenubirdAutoProxy::AddFile(LPCTSTR file)
{
	//for default
	TCHAR szDefaultLib[0x100];
	memset(szDefaultLib,0,0x100*sizeof(TCHAR));
	g_dbDefaultLibrary.GetDefaultLibrary_For_Default(szDefaultLib);

	CView *pViewPtr = IsOpenedLibPath(szDefaultLib);

	CTFiles lTFiles;
	CIntArray lAddedFilesIDs;

	CStringList lFileNames;
	lFileNames.AddTail(file);

	CLibraryView* pView = DYNAMIC_DOWNCAST(CLibraryView, pViewPtr);

	int lAddedFiles = 0;
	
	lAddedFiles = pView->m_Repository.AddFiles(lFileNames);

	//int lAddedFiles = gRepository.AddFiles(lFileNames); pyj
	
	if (lAddedFiles > 0)
	{
		m_pDialog->InitFindText();
		
//?		if(((CLibraryDoc*)m_pDialog->GetActiveDocument())->GetMode() == CLibraryDoc::e_ModeHome)
//			((CLibraryView*)m_pDialog->GetActiveView())->Refresh();
		
	}
	return lAddedFiles;

}
Exemple #2
0
CDB* initDB(CDB::DBType dbType, const CHAR* dbUser, const CHAR* dbPasswd, const CHAR* dbName, const CHAR* dbHost, INT dbPort)
{
    INT rt = 0;
    CDB* uniDB;
    if(dbType == CDB::DB_MYSQL)
    {
        uniDB = new CDBMysql();
        UniINFO("new DBMySql ok.");
        rt = uniDB->connDB(dbUser, dbPasswd, dbName, dbHost, dbPort);
    }
    /*	else if(dbType == CDB::DB_REDIS)
        {
        uniDB = new CDBRedis();
        UniINFO("new DBRedis ok.");
        rt = uniDB->connDB(dbUser, dbPasswd, dbName, dbHost, dbPort);
        }*/
    else if(dbType == CDB::DB_REDIS)
    {
        uniDB = new CDBRedisCluster();
        UniINFO("new DBRedisCluster ok.");
        rt = uniDB->connDB(dbUser, dbPasswd, dbName, dbHost, dbPort);
        if (rt < 0)
            UniERROR("DBRedisCluster setup error");
    }
    else
    {
        UniERROR("DBType %d is not supported yet. The program will exit now...", dbType);
        exit(0);
    }

    if(rt>0)
    {
        UniINFO("Connecting db %s@%s:%s succeed. dbType:%d ", dbName, dbUser, dbHost, dbType);
    }
    else
    {
        UniERROR("Connecting db %s@%s:%s error. dbType:%d, Error info:%s ",dbName, dbUser, dbHost, dbType,
                uniDB->getErrMsg() );
        return NULL;
    }

    return uniDB;
}
Exemple #3
0
int main()
{
    CDB *pDB = NULL;

    // Create a database object through the exported function and class factory
    // object.
    CDBSrvFactory *pDBFactory=NULL;

    DllGetClassFactoryObject(&pDBFactory);
    pDBFactory->CreateDB(&pDB);

    pDBFactory->Release(); // We no longer need the factory.

    if (NULL != pDB)
    {
        pDB->Release();
    }

    return 0;

}
void CBenubirdAutoProxy::Show(void)
{ 
	g_strDBG.Empty();
	g_strDBG.Format(_T("------------------------------------- show AutoProxy  %X"),this);
	OutputDebugString(g_strDBG);

	//for default
	TCHAR szDefaultLib[0x100];
	memset(szDefaultLib,0,0x100*sizeof(TCHAR));
	g_dbDefaultLibrary.GetDefaultLibrary_For_Default(szDefaultLib);

	OutputDebugString(_T("------------------------  11"));
	theApp.CreateLibraryView(szDefaultLib);


	AFX_MANAGE_STATE(AfxGetAppModuleState());

	theApp.m_pMainWnd->ShowWindow(SW_SHOW); // Display the main Benubird application

// ----------------------------------
// Used to bring the dialogs displayed during the right-click menu
// to the foreground. For some reason, they were hiding in the background
// and other methods were failing...
// http://visualcpp.net/index.php?qID=52
// ----------------------------------
/*
	HWND hCurrWnd;
	int iMyTID;
	int iCurrTID;

	hCurrWnd = ::GetForegroundWindow();
	iMyTID   = GetCurrentThreadId();
	iCurrTID = GetWindowThreadProcessId(hCurrWnd,0);

	AttachThreadInput(iMyTID, iCurrTID, TRUE);
	SetForegroundWindow(theApp.m_pMainWnd->GetSafeHwnd());
	AttachThreadInput(iMyTID, iCurrTID, FALSE);
	*/
// ----------------------------------
}
Exemple #5
0
 CGameDB(const char* pszMode, CDB& parent) : CDB("game.dat", pszMode)
 {
   vTxn.push_back (parent.GetTxn ());
   ownTxn.push_back (false);
 }
Exemple #6
0
 CGameDB(const char* pszMode, CDB& parent) : CDB("game.dat", pszMode) {
     vTxn.push_back(parent.GetTxn());
     fHaveParent = true;
 }