19,502
社区成员
发帖
与我相关
我的任务
分享
void CppSQLite3DB::open(LPCTSTR szFile)
{
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);
}