@@ -462,8 +462,11 @@ bool KBEEmailVerificationTableMysql::queryAccount(DBInterface * dbi, int8 type,
462462
463463 sqlstr += tbuf;
464464
465+ sqlstr += " \" and type=" ;
466+ kbe_snprintf (tbuf, MAX_BUF , " %d" , type);
467+ sqlstr += tbuf;
468+
465469 SAFE_RELEASE_ARRAY (tbuf);
466- sqlstr += " \" " ;
467470
468471 if (!dbi->query (sqlstr.c_str (), sqlstr.size (), false ))
469472 return false ;
@@ -489,7 +492,7 @@ bool KBEEmailVerificationTableMysql::queryAccount(DBInterface * dbi, int8 type,
489492// -------------------------------------------------------------------------------------
490493bool KBEEmailVerificationTableMysql::logAccount (DBInterface * dbi, int8 type, ACCOUNT_INFOS & info)
491494{
492- std::string sqlstr = " insert into kbe_email_verification (accountName, datas, code, logtime) values(" ;
495+ std::string sqlstr = " insert into kbe_email_verification (accountName, type, datas, code, logtime) values(" ;
493496
494497 char * tbuf = new char [MAX_BUF * 3 ];
495498
@@ -500,6 +503,9 @@ bool KBEEmailVerificationTableMysql::logAccount(DBInterface * dbi, int8 type, AC
500503 sqlstr += tbuf;
501504 sqlstr += " \" ," ;
502505
506+ kbe_snprintf (tbuf, MAX_BUF , " %d," , type);
507+ sqlstr += tbuf;
508+
503509 mysql_real_escape_string (static_cast <DBInterfaceMysql*>(dbi)->mysql (),
504510 tbuf, info.password .c_str (), info.password .size ());
505511
@@ -539,13 +545,16 @@ bool KBEEmailVerificationTableMysql::activateAccount(DBInterface * dbi, const st
539545
540546 sqlstr += tbuf;
541547
548+ sqlstr += " \" and type=" ;
549+ kbe_snprintf (tbuf, MAX_BUF , " %d" , (int )KBEEmailVerificationTable::V_TYPE_CREATEACCOUNT );
550+ sqlstr += tbuf;
551+
542552 SAFE_RELEASE_ARRAY (tbuf);
543- sqlstr += " \" " ;
544553
545554 if (!dbi->query (sqlstr.c_str (), sqlstr.size (), false ))
546555 return false ;
547556
548- uint64 logtime;
557+ uint64 logtime = 1 ;
549558
550559 MYSQL_RES * pResult = mysql_store_result (static_cast <DBInterfaceMysql*>(dbi)->mysql ());
551560 if (pResult)
@@ -651,11 +660,10 @@ bool KBEEmailVerificationTableMysql::delAccount(DBInterface * dbi, int8 type, co
651660
652661 sqlstr += " \" " ;
653662 sqlstr += tbuf;
654- sqlstr += " \" , and type=" ;
663+ sqlstr += " \" and type=" ;
655664
656665 kbe_snprintf (tbuf, MAX_BUF , " %d" , type);
657666 sqlstr += tbuf;
658- sqlstr += " )" ;
659667
660668 SAFE_RELEASE_ARRAY (tbuf);
661669
@@ -684,15 +692,21 @@ bool KBEEmailVerificationTableMysql::syncToDB(DBInterface* dbi)
684692 // 删除xx小时之前的记录
685693 sqlstr = (boost::format (" delete from kbe_email_verification where logtime<%1% and type=%2%" ) %
686694 KBEngine::StringConv::val2str (time (NULL ) - g_kbeSrvConfig.emailAtivationInfo_ .deadline ) %
687- ((int8)KBEEmailVerificationTable::V_TYPE_CREATEACCOUNT )).str ();
695+ ((int )KBEEmailVerificationTable::V_TYPE_CREATEACCOUNT )).str ();
696+
697+ ret = dbi->query (sqlstr.c_str (), sqlstr.size (), true );
698+ KBE_ASSERT (ret);
688699
689700 sqlstr = (boost::format (" delete from kbe_email_verification where logtime<%1% and type=%2%" ) %
690701 KBEngine::StringConv::val2str (time (NULL ) - g_kbeSrvConfig.emailResetPasswordInfo_ .deadline ) %
691- ((int8)KBEEmailVerificationTable::V_TYPE_RESETPASSWORD )).str ();
702+ ((int )KBEEmailVerificationTable::V_TYPE_RESETPASSWORD )).str ();
703+
704+ ret = dbi->query (sqlstr.c_str (), sqlstr.size (), true );
705+ KBE_ASSERT (ret);
692706
693707 sqlstr = (boost::format (" delete from kbe_email_verification where logtime<%1% and type=%2%" ) %
694708 KBEngine::StringConv::val2str (time (NULL ) - g_kbeSrvConfig.emailBindInfo_ .deadline ) %
695- ((int8 )KBEEmailVerificationTable::V_TYPE_BIND_MAIL )).str ();
709+ ((int )KBEEmailVerificationTable::V_TYPE_BIND_MAIL )).str ();
696710
697711 ret = dbi->query (sqlstr.c_str (), sqlstr.size (), true );
698712 KBE_ASSERT (ret);
0 commit comments