o2on svn commit
o2on-****@lists*****
2008年 5月 24日 (土) 12:14:36 JST
Revision: 90 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=o2on&view=rev&rev=90 Author: k-uehara Date: 2008-05-24 12:14:36 +0900 (Sat, 24 May 2008) Log Message: ----------- FIX: DBオープン失敗時に落ちる問題 stmtの初期化を最初に行うように変更 Modified Paths: -------------- branches/BRANCH_0043/o2on/src.o2on/O2DatDB.cpp Modified: branches/BRANCH_0043/o2on/src.o2on/O2DatDB.cpp =================================================================== --- branches/BRANCH_0043/o2on/src.o2on/O2DatDB.cpp 2008-05-23 11:04:08 UTC (rev 89) +++ branches/BRANCH_0043/o2on/src.o2on/O2DatDB.cpp 2008-05-24 03:14:36 UTC (rev 90) @@ -281,14 +281,14 @@ stopwatch sw("select"); #endif wstrarray cols; + sqlite3 *db = NULL; + sqlite3_stmt *stmt = NULL; - sqlite3 *db = NULL; int err = sqlite3_open16(dbfilename.c_str(), &db); if (err != SQLITE_OK) goto error; sqlite3_busy_timeout(db, 5000); - sqlite3_stmt *stmt = NULL; err = sqlite3_prepare16_v2(db, sql, wcslen(sql)*2, &stmt, NULL); if (err != SQLITE_OK) goto error; @@ -337,6 +337,8 @@ bool ret = true; sqlite3 *db = NULL; + sqlite3_stmt *stmt = NULL; + int err = sqlite3_open16(dbfilename.c_str(), &db); if (err != SQLITE_OK) goto error; @@ -348,7 +350,6 @@ L" from dat" L" order by random() limit 1;"; - sqlite3_stmt *stmt = NULL; err = sqlite3_prepare16_v2(db, sql, wcslen(sql)*2, &stmt, NULL); if (err != SQLITE_OK) goto error; @@ -391,6 +392,8 @@ bool ret = true; sqlite3 *db = NULL; + sqlite3_stmt *stmt = NULL; + int err = sqlite3_open16(dbfilename.c_str(), &db); if (err != SQLITE_OK) goto error; @@ -402,7 +405,6 @@ L" from dat" L" where hash = ?;"; - sqlite3_stmt *stmt = NULL; err = sqlite3_prepare16_v2(db, sql, wcslen(sql)*2, &stmt, NULL); if (err != SQLITE_OK) goto error; @@ -444,6 +446,8 @@ bool ret = true; sqlite3 *db = NULL; + sqlite3_stmt *stmt = NULL; + int err = sqlite3_open16(dbfilename.c_str(), &db); if (err != SQLITE_OK) goto error; @@ -457,7 +461,6 @@ L" and bbsname = ?" L" order by random() limit 1;"; - sqlite3_stmt *stmt = NULL; err = sqlite3_prepare16_v2(db, sql, wcslen(sql)*2, &stmt, NULL); if (err != SQLITE_OK) goto error; @@ -505,6 +508,8 @@ bool ret = true; sqlite3 *db = NULL; + sqlite3_stmt *stmt = NULL; + int err = sqlite3_open16(dbfilename.c_str(), &db); if (err != SQLITE_OK) goto error; @@ -518,7 +523,6 @@ L" and bbsname = ?" L" and datname = ?;"; - sqlite3_stmt *stmt = NULL; err = sqlite3_prepare16_v2(db, sql, wcslen(sql)*2, &stmt, NULL); if (err != SQLITE_OK) goto error; @@ -1233,6 +1237,8 @@ #endif sqlite3 *db = NULL; + sqlite3_stmt *stmt = NULL; + int err = sqlite3_open16(dbfilename.c_str(), &db); if (err != SQLITE_OK) goto error; @@ -1241,7 +1247,6 @@ wchar_t *sql = L"delete from dat where hash = ?;"; - sqlite3_stmt *stmt = NULL; err = sqlite3_prepare16_v2(db, sql, wcslen(sql)*2, &stmt, NULL); if (err != SQLITE_OK) goto error;