Is there any time estimation about sqlite3's open speed?

Posted by sxingfeng on Stack Overflow See other posts from Stack Overflow or by sxingfeng
Published on 2010-06-16T08:33:13Z Indexed on 2010/06/16 9:22 UTC
Read the original article Hit count: 163

Filed under:
|
|
|

I am using SQLite3 in C++, I found the opening time of sqlite seems unstable at the first time( I mean ,open windows and open the db at the first time) It takes a long tiom on 50M db, about 10s in windows? and vary on different times.

Has any one met the same problem?

I am writting an desktop application in windows, so the openning speed is really important for me. Thanks in advance!

    int nRet;

#if defined(_UNICODE) || defined(UNICODE)

    nRet = sqlite3_open16(szFile, &mpDB); // not tested under window 98 

#else // For Ansi Version
//*************-  Added by Begemot  szFile must be in unicode- 23/03/06 11:04 - ****
    OSVERSIONINFOEX osvi;
    ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
    osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
    GetVersionEx ((OSVERSIONINFO *) &osvi);

    if ( osvi.dwMajorVersion == 5) 
    {
          WCHAR pMultiByteStr[MAX_PATH+1];
          MultiByteToWideChar( CP_ACP, 0, szFile,
                            _tcslen(szFile)+1, pMultiByteStr,   
                            sizeof(pMultiByteStr)/sizeof(pMultiByteStr[0]) );
          nRet = sqlite3_open16(pMultiByteStr, &mpDB);
    }
    else
          nRet = sqlite3_open(szFile,&mpDB);
#endif
//*************************
    if (nRet != SQLITE_OK)
    {
        LPCTSTR szError = (LPCTSTR) _sqlite3_errmsg(mpDB);
        throw CppSQLite3Exception(nRet, (LPTSTR)szError, DONT_DELETE_MSG);
    }
    setBusyTimeout(mnBusyTimeoutMs);

© Stack Overflow or respective owner

Related posts about c++

Related posts about sqlite