--- innwebd/base.cpp 2005/02/08 05:53:27 1.12 +++ innwebd/base.cpp 2008/04/11 17:14:49 1.15 @@ -1,14 +1,10 @@ /*******************************************************/ /* */ /* LeafOK Innbbsd */ -/* Copyright (C) LeafOK.com, 2003-2004 */ /* */ -/* Programmed by Leaf */ -/* E-mail:leaflet@leafok.com QQ:6049044 */ +/* Copyright (C) LeafOK.com, 2003-2008 */ /* */ -/* http://bbs.leafok.com */ -/* http://bbs.leafok.net */ -/* http://bbs.fenglin.info */ +/* http://www.leafok.com */ /* */ /*******************************************************/ @@ -46,7 +42,9 @@ int base::s_exec(const char* in_str, CSt } catch(CException* e) { - syslog << logfile::log_head << "Error in s_exec()" << endl; + char strErrMsg[1024]; + e->GetErrorMessage(strErrMsg,1024); + syslog << logfile::log_head << "Error in s_exec() [" << strErrMsg << "]" << endl; e->Delete(); return -1; } @@ -59,10 +57,14 @@ int base::db_open(const char* conn_str) try { this->Db.Open("",0,0,conn_str,0); + this->Db.ExecuteSQL("SET CHARACTER SET gb2312"); + this->Db.ExecuteSQL("SET NAMES 'gb2312'"); } catch(CException* e) { - syslog << logfile::log_head << "Open database failed in db_open()" << endl; + char strErrMsg[1024]; + e->GetErrorMessage(strErrMsg,1024); + syslog << logfile::log_head << "Open database failed in db_open() [" << strErrMsg << "]" << endl; e->Delete(); return -1; } @@ -78,7 +80,9 @@ int base::db_close(void) } catch(CException* e) { - syslog << logfile::log_head << "Close database failed in db_close()" << endl; + char strErrMsg[1024]; + e->GetErrorMessage(strErrMsg,1024); + syslog << logfile::log_head << "Close database failed in db_close() [" << strErrMsg << "]" << endl; e->Delete(); return -1; } @@ -233,7 +237,7 @@ int base::bbs_post(const CString& head, } } if (nickname.GetLength() > 20) - nickname = nickname.Left(20); + nickname = nickname.Left(19) + " "; //Reference /bbs/add_sub.php @@ -351,7 +355,9 @@ long base::last_insert_id(void) } catch(CException* e) { - syslog << logfile::log_head << "Error in last_insert_id()" << endl; + char strErrMsg[1024]; + e->GetErrorMessage(strErrMsg,1024); + syslog << logfile::log_head << "Error in last_insert_id() [" << strErrMsg << "]" << endl; e->Delete(); return 0; } @@ -425,7 +431,9 @@ int base::s_send(const char* in_str, boo } catch(CException* e) { - syslog << logfile::log_head << "Error in s_send()" << endl; + char strErrMsg[1024]; + e->GetErrorMessage(strErrMsg,1024); + syslog << logfile::log_head << "Error in s_send() [" << strErrMsg << "]" << endl; e->Delete(); return -1; } @@ -462,7 +470,9 @@ int base::s_receive(CString& out_str, ch } catch(CException* e) { - syslog << logfile::log_head << "Error in s_receive()" << endl; + char strErrMsg[1024]; + e->GetErrorMessage(strErrMsg,1024); + syslog << logfile::log_head << "Error in s_receive() [" << strErrMsg << "]" << endl; e->Delete(); return -1; }