Develop and Download Open Source Software

Browse CVS Repository

Diff of /xoonips/AL/commonal.cc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.35 by youi, Thu Jan 6 07:20:17 2005 UTC revision 1.36 by aga, Thu Jan 13 04:19:22 2005 UTC
# Line 2  Line 2 
2   *   *
3   * $Revision$   * $Revision$
4   * $Log$   * $Log$
5     * Revision 1.36  2005/01/13 04:19:22  aga
6     * ・VPをXNPに変換.
7     *
8   * Revision 1.35  2005/01/06 07:20:17  youi   * Revision 1.35  2005/01/06 07:20:17  youi
9   * WIN32定義時のインクルードの追加.   * WIN32定義時のインクルードの追加.
10   * MySQL APIに関するヘッダファイルを削除.   * MySQL APIに関するヘッダファイルを削除.
# Line 51  Line 54 
54   * ・開放忘れ修正.   * ・開放忘れ修正.
55   *   *
56   * Revision 1.23  2004/12/04 09:21:10  aga   * Revision 1.23  2004/12/04 09:21:10  aga
57   * ・vp_config → vpaccount_config.   * ・xnp_config → xnpaccount_config.
58   *   *
59   * Revision 1.22  2004/12/03 07:17:21  youi   * Revision 1.22  2004/12/03 07:17:21  youi
60   * isModeratorでアクセスするデータベーステーブル名を修正.   * isModeratorでアクセスするデータベーステーブル名を修正.
# Line 334  static bool gidExists( groupid_t gid ) Line 337  static bool gidExists( groupid_t gid )
337          return false;          return false;
338      }      }
339    
340      sql = "SELECT * FROM " + dbprefix + "_vpaccount_groups ";      sql = "SELECT * FROM " + dbprefix + "_xnpaccount_groups ";
341      sql += "WHERE gid=" + string( unsignedIntToString( gid ) );      sql += "WHERE gid=" + string( unsignedIntToString( gid ) );
342      if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) != SQL_SUCCESS ){      if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) != SQL_SUCCESS ){
343          setLastErrorString( "SQLExecDirect in gidExists" );          setLastErrorString( "SQLExecDirect in gidExists" );
# Line 370  static bool uidExists( userid_t uid ) Line 373  static bool uidExists( userid_t uid )
373      SQLRETURN sqlcode;      SQLRETURN sqlcode;
374      SQLINTEGER count = 0;      SQLINTEGER count = 0;
375            
376      sql = "SELECT * FROM " + dbprefix + "_vpaccount_users ";      sql = "SELECT * FROM " + dbprefix + "_xnpaccount_users ";
377      sql += "WHERE uid=" + string( unsignedIntToString( uid ) );      sql += "WHERE uid=" + string( unsignedIntToString( uid ) );
378      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {
379          if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){          if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){
# Line 533  bool isActivated( sessionid_t sid, useri Line 536  bool isActivated( sessionid_t sid, useri
536      SQLRETURN sqlcode;      SQLRETURN sqlcode;
537      SQLHANDLE hstmt = NULL;          SQLHANDLE hstmt = NULL;    
538            
539      sql = "SELECT * FROM " + dbprefix + "_vpaccount_users ";      sql = "SELECT * FROM " + dbprefix + "_xnpaccount_users ";
540      sql += "WHERE activate=1 and uid=" + string( unsignedIntToString( uid ) );      sql += "WHERE activate=1 and uid=" + string( unsignedIntToString( uid ) );
541      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {
542          if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){          if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){
# Line 581  result_t activate( sessionid_t sid, user Line 584  result_t activate( sessionid_t sid, user
584      SQLRETURN sqlcode;      SQLRETURN sqlcode;
585      result_t ret = RES_ERROR;      result_t ret = RES_ERROR;
586            
587      sql = "UPDATE " + dbprefix + "_vpaccount_users ";      sql = "UPDATE " + dbprefix + "_xnpaccount_users ";
588      sql += "SET activate=" + string( activate ? "1" : "0" );      sql += "SET activate=" + string( activate ? "1" : "0" );
589      sql += " WHERE uid=" + string( unsignedIntToString( uid ) );      sql += " WHERE uid=" + string( unsignedIntToString( uid ) );
590      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {
# Line 631  int getAccountCount( sessionid_t sid ) Line 634  int getAccountCount( sessionid_t sid )
634      SQLHANDLE hstmt = NULL;          SQLHANDLE hstmt = NULL;    
635            
636      //アカウント数を求める      //アカウント数を求める
637      sql = "SELECT COUNT(*) FROM " + dbprefix + "_vpaccount_users ";      sql = "SELECT COUNT(*) FROM " + dbprefix + "_xnpaccount_users ";
638      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {
639          if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){          if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){
640              SQLUINTEGER count = 0;              SQLUINTEGER count = 0;
# Line 686  result_t deleteAccount( sessionid_t sid, Line 689  result_t deleteAccount( sessionid_t sid,
689      /*      /*
690        1. delete user from default platform group        1. delete user from default platform group
691        2. delete user profile from xoops_users        2. delete user profile from xoops_users
692        3. delete platform user from vpaccount_users        3. delete platform user from xnpaccount_users
693       */       */
694            
695      //1. delete user from platform groups      //1. delete user from platform groups
# Line 726  result_t deleteAccount( sessionid_t sid, Line 729  result_t deleteAccount( sessionid_t sid,
729          ret1 = RES_ERROR;          ret1 = RES_ERROR;
730      }      }
731            
732      //3. delete platform user from vpaccount_users      //3. delete platform user from xnpaccount_users
733      sql = "DELETE FROM " + dbprefix + "_vpaccount_users ";      sql = "DELETE FROM " + dbprefix + "_xnpaccount_users ";
734      sql += "WHERE uid = " + string( unsignedIntToString( uid ) );      sql += "WHERE uid = " + string( unsignedIntToString( uid ) );
735      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {
736          if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){          if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){
# Line 824  result_t getAccounts( sessionid_t sid, c Line 827  result_t getAccounts( sessionid_t sid, c
827      account_t* dst = new account_t[ uidsLen ];      account_t* dst = new account_t[ uidsLen ];
828            
829      sql += "SELECT u1.uid, u1.name, u1.uname, u1.email, u1.url, u1.user_avatar, u1.user_regdate, u1.user_icq, u1.user_from, u1.user_sig, u1.user_viewemail, u1.actkey, u1.user_aim, u1.user_yim, u1.user_msnm, u1.pass, u1.posts, u1.attachsig, u1.rank, u1.level, u1.theme, u1.timezone_offset, u1.last_login, u1.umode, u1.uorder, u1.notify_method, u1.notify_mode, u1.user_occ, u1.bio, u1.user_intrest, u1.user_mailok, u2.activate, u2.address, u2.division, u2.tel, u2.company_name, u2.country, u2.zipcode, u2.fax, u2.base_url, u2.notice_mail, u2.notice_mail_since ";      sql += "SELECT u1.uid, u1.name, u1.uname, u1.email, u1.url, u1.user_avatar, u1.user_regdate, u1.user_icq, u1.user_from, u1.user_sig, u1.user_viewemail, u1.actkey, u1.user_aim, u1.user_yim, u1.user_msnm, u1.pass, u1.posts, u1.attachsig, u1.rank, u1.level, u1.theme, u1.timezone_offset, u1.last_login, u1.umode, u1.uorder, u1.notify_method, u1.notify_mode, u1.user_occ, u1.bio, u1.user_intrest, u1.user_mailok, u2.activate, u2.address, u2.division, u2.tel, u2.company_name, u2.country, u2.zipcode, u2.fax, u2.base_url, u2.notice_mail, u2.notice_mail_since ";
830      sql += "FROM " + dbprefix + "_users AS u1, " + dbprefix + "_vpaccount_users AS u2 ";      sql += "FROM " + dbprefix + "_users AS u1, " + dbprefix + "_xnpaccount_users AS u2 ";
831      sql += "WHERE u1.uid = u2.uid ";      sql += "WHERE u1.uid = u2.uid ";
832      if( uidsLen > 0 ){      if( uidsLen > 0 ){
833  #ifdef USE_SYSLOG  #ifdef USE_SYSLOG
# Line 958  result_t insertAccount( sessionid_t sid, Line 961  result_t insertAccount( sessionid_t sid,
961            
962      /*      /*
963        1. insert user profile into xoops_users        1. insert user profile into xoops_users
964        2. insert platform user profile into vpaccount_users        2. insert platform user profile into xnpaccount_users
965        3. add user to default platform group        3. add user to default platform group
966       */       */
967            
# Line 1091  result_t insertAccount( sessionid_t sid, Line 1094  result_t insertAccount( sessionid_t sid,
1094      }      }
1095            
1096      if( ret == RES_OK ){      if( ret == RES_OK ){
1097          //2.vpaccountのユーザテーブルに残りの情報を書き込む          //2.xnpaccountのユーザテーブルに残りの情報を書き込む
1098          SQLUINTEGER activate;          SQLUINTEGER activate;
1099          SQLCHAR address[VP_ACCOUNT_ADDRESS_LEN+1];          SQLCHAR address[XNP_ACCOUNT_ADDRESS_LEN+1];
1100          SQLCHAR division[VP_ACCOUNT_DIVISION_LEN+1];          SQLCHAR division[XNP_ACCOUNT_DIVISION_LEN+1];
1101          SQLCHAR tel[VP_ACCOUNT_TEL_LEN+1];          SQLCHAR tel[XNP_ACCOUNT_TEL_LEN+1];
1102          SQLCHAR company_name[VP_ACCOUNT_COMPANY_NAME_LEN+1];          SQLCHAR company_name[XNP_ACCOUNT_COMPANY_NAME_LEN+1];
1103          SQLCHAR country[VP_ACCOUNT_COUNTRY_LEN+1];          SQLCHAR country[XNP_ACCOUNT_COUNTRY_LEN+1];
1104          SQLCHAR zipcode[VP_ACCOUNT_ZIPCODE_LEN+1];          SQLCHAR zipcode[XNP_ACCOUNT_ZIPCODE_LEN+1];
1105          SQLCHAR fax[VP_ACCOUNT_FAX_LEN+1];          SQLCHAR fax[XNP_ACCOUNT_FAX_LEN+1];
1106          SQLCHAR base_url[VP_ACCOUNT_BASE_URL_LEN+1];          SQLCHAR base_url[XNP_ACCOUNT_BASE_URL_LEN+1];
1107          SQLINTEGER cbAddress = SQL_NTS, cbDivision = SQL_NTS, cbTel = SQL_NTS, cbCompany_name = SQL_NTS, cbCountry = SQL_NTS, cbZipcode = SQL_NTS, cbFax = SQL_NTS, cbBase_url = SQL_NTS;          SQLINTEGER cbAddress = SQL_NTS, cbDivision = SQL_NTS, cbTel = SQL_NTS, cbCompany_name = SQL_NTS, cbCountry = SQL_NTS, cbZipcode = SQL_NTS, cbFax = SQL_NTS, cbBase_url = SQL_NTS;
1108          SQLINTEGER cbUid = 0, cbActivate = 0, cbNotice_mail = 0, cbNotice_mail_since = 0;          SQLINTEGER cbUid = 0, cbActivate = 0, cbNotice_mail = 0, cbNotice_mail_since = 0;
1109          SQLUINTEGER notice_mail;          SQLUINTEGER notice_mail;
1110          SQLUINTEGER notice_mail_since;          SQLUINTEGER notice_mail_since;
1111          if( ret == RES_OK && ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {          if( ret == RES_OK && ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {
1112              string sql;              string sql;
1113              sql = "INSERT INTO " + dbprefix + "_vpaccount_users (uid, activate, address, division, tel, company_name, country, zipcode, fax, base_url, notice_mail, notice_mail_since) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )";              sql = "INSERT INTO " + dbprefix + "_xnpaccount_users (uid, activate, address, division, tel, company_name, country, zipcode, fax, base_url, notice_mail, notice_mail_since) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )";
1114              sqlcode = SQLPrepare(hstmt, (SQLCHAR*)sql.c_str(), SQL_NTS);              sqlcode = SQLPrepare(hstmt, (SQLCHAR*)sql.c_str(), SQL_NTS);
1115              if( sqlcode == SQL_SUCCESS || sqlcode == SQL_SUCCESS_WITH_INFO ){              if( sqlcode == SQL_SUCCESS || sqlcode == SQL_SUCCESS_WITH_INFO ){
1116                  SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_SSHORT, SQL_INTEGER, 0, 0, uid, 0, &cbUid);                  SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_SSHORT, SQL_INTEGER, 0, 0, uid, 0, &cbUid);
1117                  SQLBindParameter(hstmt, 2, SQL_PARAM_INPUT, SQL_C_SSHORT, SQL_INTEGER, 0, 0, &activate, 0, &cbActivate);                  SQLBindParameter(hstmt, 2, SQL_PARAM_INPUT, SQL_C_SSHORT, SQL_INTEGER, 0, 0, &activate, 0, &cbActivate);
1118                  SQLBindParameter(hstmt, 3, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, VP_ACCOUNT_ADDRESS_LEN, 0, address, 0, &cbAddress);                  SQLBindParameter(hstmt, 3, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, XNP_ACCOUNT_ADDRESS_LEN, 0, address, 0, &cbAddress);
1119                  SQLBindParameter(hstmt, 4, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, VP_ACCOUNT_DIVISION_LEN, 0, division, 0, &cbDivision);                  SQLBindParameter(hstmt, 4, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, XNP_ACCOUNT_DIVISION_LEN, 0, division, 0, &cbDivision);
1120                  SQLBindParameter(hstmt, 5, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, VP_ACCOUNT_TEL_LEN, 0, tel, 0, &cbTel);                  SQLBindParameter(hstmt, 5, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, XNP_ACCOUNT_TEL_LEN, 0, tel, 0, &cbTel);
1121                  SQLBindParameter(hstmt, 6, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, VP_ACCOUNT_COMPANY_NAME_LEN, 0, company_name, 0, &cbCompany_name);                  SQLBindParameter(hstmt, 6, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, XNP_ACCOUNT_COMPANY_NAME_LEN, 0, company_name, 0, &cbCompany_name);
1122                  SQLBindParameter(hstmt, 7, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, VP_ACCOUNT_COUNTRY_LEN, 0, country, 0, &cbCountry);                  SQLBindParameter(hstmt, 7, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, XNP_ACCOUNT_COUNTRY_LEN, 0, country, 0, &cbCountry);
1123                  SQLBindParameter(hstmt, 8, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, VP_ACCOUNT_ZIPCODE_LEN, 0, zipcode, 0, &cbZipcode);                  SQLBindParameter(hstmt, 8, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, XNP_ACCOUNT_ZIPCODE_LEN, 0, zipcode, 0, &cbZipcode);
1124                  SQLBindParameter(hstmt, 9, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, VP_ACCOUNT_FAX_LEN, 0, fax, 0, &cbFax);                  SQLBindParameter(hstmt, 9, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, XNP_ACCOUNT_FAX_LEN, 0, fax, 0, &cbFax);
1125                  SQLBindParameter(hstmt, 10, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, VP_ACCOUNT_BASE_URL_LEN, 0, base_url, 0, &cbBase_url);                  SQLBindParameter(hstmt, 10, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, XNP_ACCOUNT_BASE_URL_LEN, 0, base_url, 0, &cbBase_url);
1126                  SQLBindParameter(hstmt, 11, SQL_PARAM_INPUT, SQL_C_SSHORT, SQL_INTEGER, 0, 0, &notice_mail, 0, &cbNotice_mail);                  SQLBindParameter(hstmt, 11, SQL_PARAM_INPUT, SQL_C_SSHORT, SQL_INTEGER, 0, 0, &notice_mail, 0, &cbNotice_mail);
1127                  SQLBindParameter(hstmt, 12, SQL_PARAM_INPUT, SQL_C_SSHORT, SQL_INTEGER, 0, 0, &notice_mail_since, 0, &cbNotice_mail_since);                  SQLBindParameter(hstmt, 12, SQL_PARAM_INPUT, SQL_C_SSHORT, SQL_INTEGER, 0, 0, &notice_mail_since, 0, &cbNotice_mail_since);
1128                            
1129                  activate = account -> getActivate() ? 1 : 0;                  activate = account -> getActivate() ? 1 : 0;
1130                  strncpy2( (char*)address, account -> getAddress(), VP_ACCOUNT_ADDRESS_LEN );                  strncpy2( (char*)address, account -> getAddress(), XNP_ACCOUNT_ADDRESS_LEN );
1131                  strncpy2( (char*)division, account -> getDivision(), VP_ACCOUNT_DIVISION_LEN );                  strncpy2( (char*)division, account -> getDivision(), XNP_ACCOUNT_DIVISION_LEN );
1132                  strncpy2( (char*)tel, account -> getTel(), VP_ACCOUNT_TEL_LEN );                  strncpy2( (char*)tel, account -> getTel(), XNP_ACCOUNT_TEL_LEN );
1133                  strncpy2( (char*)company_name, account -> getCompanyName(), VP_ACCOUNT_COMPANY_NAME_LEN );                  strncpy2( (char*)company_name, account -> getCompanyName(), XNP_ACCOUNT_COMPANY_NAME_LEN );
1134                  strncpy2( (char*)country, account -> getCountry(), VP_ACCOUNT_COUNTRY_LEN );                  strncpy2( (char*)country, account -> getCountry(), XNP_ACCOUNT_COUNTRY_LEN );
1135                  strncpy2( (char*)zipcode, account -> getZipcode(), VP_ACCOUNT_ZIPCODE_LEN );                  strncpy2( (char*)zipcode, account -> getZipcode(), XNP_ACCOUNT_ZIPCODE_LEN );
1136                  strncpy2( (char*)fax, account -> getFax(), VP_ACCOUNT_FAX_LEN );                  strncpy2( (char*)fax, account -> getFax(), XNP_ACCOUNT_FAX_LEN );
1137                  strncpy2( (char*)base_url, account -> getBaseURL(), VP_ACCOUNT_BASE_URL_LEN );                  strncpy2( (char*)base_url, account -> getBaseURL(), XNP_ACCOUNT_BASE_URL_LEN );
1138                  notice_mail = account -> getNoticeMail( );                  notice_mail = account -> getNoticeMail( );
1139                  notice_mail_since = account -> getNoticeMailSince( );                  notice_mail_since = account -> getNoticeMailSince( );
1140                            
# Line 1222  result_t updateAccount( sessionid_t sid, Line 1225  result_t updateAccount( sessionid_t sid,
1225      SQLINTEGER cbUid = 0, cbUser_regdate = 0, cbUser_viewemail = 0, cbPosts = 0, cbAttachsig = 0, cbRank = 0, cbLevel = 0, cbLast_login = 0, cbUorder = 0, cbNotify_method = 0, cbNotify_mode, cbUser_mailok = 0, cbTimezone_offset = 0;      SQLINTEGER cbUid = 0, cbUser_regdate = 0, cbUser_viewemail = 0, cbPosts = 0, cbAttachsig = 0, cbRank = 0, cbLevel = 0, cbLast_login = 0, cbUorder = 0, cbNotify_method = 0, cbNotify_mode, cbUser_mailok = 0, cbTimezone_offset = 0;
1226    
1227      SQLUINTEGER activate;      SQLUINTEGER activate;
1228      SQLCHAR address[VP_ACCOUNT_ADDRESS_LEN+1];      SQLCHAR address[XNP_ACCOUNT_ADDRESS_LEN+1];
1229      SQLCHAR division[VP_ACCOUNT_DIVISION_LEN+1];      SQLCHAR division[XNP_ACCOUNT_DIVISION_LEN+1];
1230      SQLCHAR tel[VP_ACCOUNT_TEL_LEN+1];      SQLCHAR tel[XNP_ACCOUNT_TEL_LEN+1];
1231      SQLCHAR company_name[VP_ACCOUNT_COMPANY_NAME_LEN+1];      SQLCHAR company_name[XNP_ACCOUNT_COMPANY_NAME_LEN+1];
1232      SQLCHAR country[VP_ACCOUNT_COUNTRY_LEN+1];      SQLCHAR country[XNP_ACCOUNT_COUNTRY_LEN+1];
1233      SQLCHAR zipcode[VP_ACCOUNT_ZIPCODE_LEN+1];      SQLCHAR zipcode[XNP_ACCOUNT_ZIPCODE_LEN+1];
1234      SQLCHAR fax[VP_ACCOUNT_FAX_LEN+1];      SQLCHAR fax[XNP_ACCOUNT_FAX_LEN+1];
1235      SQLCHAR base_url[VP_ACCOUNT_BASE_URL_LEN+1];      SQLCHAR base_url[XNP_ACCOUNT_BASE_URL_LEN+1];
1236      SQLINTEGER cbAddress = SQL_NTS, cbDivision = SQL_NTS, cbTel = SQL_NTS, cbCompany_name = SQL_NTS, cbCountry = SQL_NTS, cbZipcode = SQL_NTS, cbFax = SQL_NTS, cbBase_url = SQL_NTS;      SQLINTEGER cbAddress = SQL_NTS, cbDivision = SQL_NTS, cbTel = SQL_NTS, cbCompany_name = SQL_NTS, cbCountry = SQL_NTS, cbZipcode = SQL_NTS, cbFax = SQL_NTS, cbBase_url = SQL_NTS;
1237      SQLUINTEGER notice_mail;      SQLUINTEGER notice_mail;
1238      SQLUINTEGER notice_mail_since;      SQLUINTEGER notice_mail_since;
# Line 1363  result_t updateAccount( sessionid_t sid, Line 1366  result_t updateAccount( sessionid_t sid,
1366          ret = RES_ERROR;          ret = RES_ERROR;
1367      }      }
1368            
1369      //vpaccountのユーザテーブルに残りの情報を上書きする      //xnpaccountのユーザテーブルに残りの情報を上書きする
1370      if( ret == RES_OK && ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {      if( ret == RES_OK && ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {
1371          string sql;          string sql;
1372    
1373          sql = "UPDATE " + dbprefix + "_vpaccount_users SET ";          sql = "UPDATE " + dbprefix + "_xnpaccount_users SET ";
1374          sql += "activate=?, ";          sql += "activate=?, ";
1375          sql += "address=?, ";          sql += "address=?, ";
1376          sql += "division=?, ";          sql += "division=?, ";
# Line 1384  result_t updateAccount( sessionid_t sid, Line 1387  result_t updateAccount( sessionid_t sid,
1387          sqlcode = SQLPrepare(hstmt, (SQLCHAR*)sql.c_str(), SQL_NTS);          sqlcode = SQLPrepare(hstmt, (SQLCHAR*)sql.c_str(), SQL_NTS);
1388          if( sqlcode == SQL_SUCCESS || sqlcode == SQL_SUCCESS_WITH_INFO ){          if( sqlcode == SQL_SUCCESS || sqlcode == SQL_SUCCESS_WITH_INFO ){
1389              SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_SSHORT, SQL_INTEGER, 0, 0, &activate, 0, &len);              SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_SSHORT, SQL_INTEGER, 0, 0, &activate, 0, &len);
1390              SQLBindParameter(hstmt, 2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, VP_ACCOUNT_ADDRESS_LEN, 0, address, 0, &cbAddress);              SQLBindParameter(hstmt, 2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, XNP_ACCOUNT_ADDRESS_LEN, 0, address, 0, &cbAddress);
1391              SQLBindParameter(hstmt, 3, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, VP_ACCOUNT_DIVISION_LEN, 0, division, 0, &cbDivision);              SQLBindParameter(hstmt, 3, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, XNP_ACCOUNT_DIVISION_LEN, 0, division, 0, &cbDivision);
1392              SQLBindParameter(hstmt, 4, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, VP_ACCOUNT_TEL_LEN, 0, tel, 0, &cbTel);              SQLBindParameter(hstmt, 4, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, XNP_ACCOUNT_TEL_LEN, 0, tel, 0, &cbTel);
1393              SQLBindParameter(hstmt, 5, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, VP_ACCOUNT_COMPANY_NAME_LEN, 0, company_name, 0, &cbCompany_name);              SQLBindParameter(hstmt, 5, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, XNP_ACCOUNT_COMPANY_NAME_LEN, 0, company_name, 0, &cbCompany_name);
1394              SQLBindParameter(hstmt, 6, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, VP_ACCOUNT_COUNTRY_LEN, 0, country, 0, &cbCountry);              SQLBindParameter(hstmt, 6, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, XNP_ACCOUNT_COUNTRY_LEN, 0, country, 0, &cbCountry);
1395              SQLBindParameter(hstmt, 7, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, VP_ACCOUNT_ZIPCODE_LEN, 0, zipcode, 0, &cbZipcode);              SQLBindParameter(hstmt, 7, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, XNP_ACCOUNT_ZIPCODE_LEN, 0, zipcode, 0, &cbZipcode);
1396              SQLBindParameter(hstmt, 8, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, VP_ACCOUNT_FAX_LEN, 0, fax, 0, &cbFax);              SQLBindParameter(hstmt, 8, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, XNP_ACCOUNT_FAX_LEN, 0, fax, 0, &cbFax);
1397              SQLBindParameter(hstmt, 9, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, VP_ACCOUNT_BASE_URL_LEN, 0, base_url, 0, &cbBase_url);              SQLBindParameter(hstmt, 9, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, XNP_ACCOUNT_BASE_URL_LEN, 0, base_url, 0, &cbBase_url);
1398              SQLBindParameter(hstmt, 10, SQL_PARAM_INPUT, SQL_C_SSHORT, SQL_INTEGER, 0, 0, &notice_mail, 0, &len);              SQLBindParameter(hstmt, 10, SQL_PARAM_INPUT, SQL_C_SSHORT, SQL_INTEGER, 0, 0, &notice_mail, 0, &len);
1399              SQLBindParameter(hstmt, 11, SQL_PARAM_INPUT, SQL_C_SSHORT, SQL_INTEGER, 0, 0, &notice_mail_since, 0, &len);              SQLBindParameter(hstmt, 11, SQL_PARAM_INPUT, SQL_C_SSHORT, SQL_INTEGER, 0, 0, &notice_mail_since, 0, &len);
1400              SQLBindParameter(hstmt, 12, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &uid, 0, &cbUid );              SQLBindParameter(hstmt, 12, SQL_PARAM_INPUT, SQL_C_SLONG, SQL_INTEGER, 0, 0, &uid, 0, &cbUid );
1401                            
1402              activate = account -> getActivate() ? 1 : 0;              activate = account -> getActivate() ? 1 : 0;
1403              strncpy2( (char*)address, account -> getAddress( ) , VP_ACCOUNT_ADDRESS_LEN );              strncpy2( (char*)address, account -> getAddress( ) , XNP_ACCOUNT_ADDRESS_LEN );
1404              strncpy2( (char*)division, account -> getDivision(), VP_ACCOUNT_DIVISION_LEN );              strncpy2( (char*)division, account -> getDivision(), XNP_ACCOUNT_DIVISION_LEN );
1405              strncpy2( (char*)tel, account -> getTel(), VP_ACCOUNT_TEL_LEN );              strncpy2( (char*)tel, account -> getTel(), XNP_ACCOUNT_TEL_LEN );
1406              strncpy2( (char*)company_name, account -> getCompanyName(), VP_ACCOUNT_COMPANY_NAME_LEN );              strncpy2( (char*)company_name, account -> getCompanyName(), XNP_ACCOUNT_COMPANY_NAME_LEN );
1407              strncpy2( (char*)country, account -> getCountry(), VP_ACCOUNT_COUNTRY_LEN );              strncpy2( (char*)country, account -> getCountry(), XNP_ACCOUNT_COUNTRY_LEN );
1408              strncpy2( (char*)zipcode, account -> getZipcode(), VP_ACCOUNT_ZIPCODE_LEN );              strncpy2( (char*)zipcode, account -> getZipcode(), XNP_ACCOUNT_ZIPCODE_LEN );
1409              strncpy2( (char*)fax, account -> getFax(), VP_ACCOUNT_FAX_LEN );              strncpy2( (char*)fax, account -> getFax(), XNP_ACCOUNT_FAX_LEN );
1410              strncpy2( (char*)base_url, account -> getBaseURL(), VP_ACCOUNT_BASE_URL_LEN );              strncpy2( (char*)base_url, account -> getBaseURL(), XNP_ACCOUNT_BASE_URL_LEN );
1411              notice_mail = account -> getNoticeMail( );              notice_mail = account -> getNoticeMail( );
1412              notice_mail_since = account -> getNoticeMailSince( );              notice_mail_since = account -> getNoticeMailSince( );
1413              uid = account -> getUID( );              uid = account -> getUID( );
# Line 1469  result_t dumpUids( sessionid_t sid, crit Line 1472  result_t dumpUids( sessionid_t sid, crit
1472      SQLINTEGER count = 0;      SQLINTEGER count = 0;
1473                            
1474    
1475      sql = "SELECT uid FROM " + dbprefix + "_vpaccount_users ";      sql = "SELECT uid FROM " + dbprefix + "_xnpaccount_users ";
1476      sql += criteria2str( cri );      sql += criteria2str( cri );
1477      if( countResultRows( sql.c_str(), &count ) == RES_OK ){      if( countResultRows( sql.c_str(), &count ) == RES_OK ){
1478          *uidsLen = count;          *uidsLen = count;
# Line 1536  int getGroupCount( sessionid_t sid ) Line 1539  int getGroupCount( sessionid_t sid )
1539      int ret = 0;      int ret = 0;
1540            
1541      //グループ数を求める      //グループ数を求める
1542      sql = "SELECT COUNT(*) FROM " + dbprefix + "_vpaccount_groups";      sql = "SELECT COUNT(*) FROM " + dbprefix + "_xnpaccount_groups";
1543      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {
1544          if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){          if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){
1545              SQLUINTEGER count = 0;              SQLUINTEGER count = 0;
# Line 1593  result_t getGroupsByUid( sessionid_t sid Line 1596  result_t getGroupsByUid( sessionid_t sid
1596      groupid_t* dst = 0;      groupid_t* dst = 0;
1597      int len = 0;      int len = 0;
1598            
1599      sql = "SELECT gid FROM " + dbprefix + "_vpaccount_groups_users_link";      sql = "SELECT gid FROM " + dbprefix + "_xnpaccount_groups_users_link";
1600      sql += " WHERE uid=" + string( unsignedIntToString( uid ) );      sql += " WHERE uid=" + string( unsignedIntToString( uid ) );
1601      sql += criteria2str( cri );      sql += criteria2str( cri );
1602      if( countResultRows( sql.c_str(), &count ) == RES_OK ){      if( countResultRows( sql.c_str(), &count ) == RES_OK ){
# Line 1610  result_t getGroupsByUid( sessionid_t sid Line 1613  result_t getGroupsByUid( sessionid_t sid
1613              if( count > 0 ){              if( count > 0 ){
1614                  SQLHANDLE hstmt2 = NULL;                      SQLHANDLE hstmt2 = NULL;    
1615                  if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt2 ) ) == SQL_SUCCESS ) {                  if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt2 ) ) == SQL_SUCCESS ) {
1616                      sql = "SELECT gid, uid, is_admin FROM " + dbprefix + "_vpaccount_groups_users_link";                      sql = "SELECT gid, uid, is_admin FROM " + dbprefix + "_xnpaccount_groups_users_link";
1617                      sql += " WHERE uid=" + string( unsignedIntToString( uid ) );                      sql += " WHERE uid=" + string( unsignedIntToString( uid ) );
1618                      sql += criteria2str( cri );                      sql += criteria2str( cri );
1619                      if( ( sqlcode = SQLExecDirect( hstmt2, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){                      if( ( sqlcode = SQLExecDirect( hstmt2, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){
# Line 1674  bool isGroupAdmin( sessionid_t sid, grou Line 1677  bool isGroupAdmin( sessionid_t sid, grou
1677      SQLRETURN sqlcode;      SQLRETURN sqlcode;
1678      SQLINTEGER count = 0;      SQLINTEGER count = 0;
1679            
1680      sql = "SELECT * FROM " + dbprefix + "_vpaccount_groups_users_link ";      sql = "SELECT * FROM " + dbprefix + "_xnpaccount_groups_users_link ";
1681      sql += "WHERE gid=" + string( unsignedIntToString( gid ) );      sql += "WHERE gid=" + string( unsignedIntToString( gid ) );
1682      sql += " AND uid=" + string( unsignedIntToString( uid ) );      sql += " AND uid=" + string( unsignedIntToString( uid ) );
1683      sql += " AND is_admin=1";      sql += " AND is_admin=1";
# Line 1716  result_t dumpGids( sessionid_t sid, crit Line 1719  result_t dumpGids( sessionid_t sid, crit
1719      SQLRETURN sqlcode;      SQLRETURN sqlcode;
1720      SQLINTEGER count = 0;      SQLINTEGER count = 0;
1721                            
1722      sql = "SELECT gid FROM " + dbprefix + "_vpaccount_groups ";      sql = "SELECT gid FROM " + dbprefix + "_xnpaccount_groups ";
1723      sql += criteria2str( cri );      sql += criteria2str( cri );
1724      if( countResultRows( sql.c_str(), &count ) == RES_OK ){      if( countResultRows( sql.c_str(), &count ) == RES_OK ){
1725          *gidsLen = count;          *gidsLen = count;
# Line 1777  result_t dumpGroupAdmins( sessionid_t si Line 1780  result_t dumpGroupAdmins( sessionid_t si
1780      SQLRETURN sqlcode;      SQLRETURN sqlcode;
1781      SQLINTEGER count = 0;      SQLINTEGER count = 0;
1782                            
1783      sql = "SELECT uid FROM " + dbprefix + "_vpaccount_groups_users_link ";      sql = "SELECT uid FROM " + dbprefix + "_xnpaccount_groups_users_link ";
1784      sql += " WHERE is_admin=1 and gid=" + unsignedIntToString( gid );      sql += " WHERE is_admin=1 and gid=" + unsignedIntToString( gid );
1785      if( countResultRows( sql.c_str(), &count ) == RES_OK ){      if( countResultRows( sql.c_str(), &count ) == RES_OK ){
1786          *uidsLen = count;          *uidsLen = count;
# Line 1861  static result_t deleteMemberNoLimit( ses Line 1864  static result_t deleteMemberNoLimit( ses
1864      SQLRETURN sqlcode;      SQLRETURN sqlcode;
1865      SQLHANDLE hstmt = NULL;      SQLHANDLE hstmt = NULL;
1866            
1867      sql = "DELETE FROM " + dbprefix + "_vpaccount_groups_users_link ";      sql = "DELETE FROM " + dbprefix + "_xnpaccount_groups_users_link ";
1868      sql += "WHERE gid=" + string( unsignedIntToString( gid ) );      sql += "WHERE gid=" + string( unsignedIntToString( gid ) );
1869      sql += " AND uid=" + string( unsignedIntToString( uid ) );      sql += " AND uid=" + string( unsignedIntToString( uid ) );
1870      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {
# Line 1922  result_t insertMember( sessionid_t sid, Line 1925  result_t insertMember( sessionid_t sid,
1925            
1926      //メンバーを追加      //メンバーを追加
1927      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {
1928          sql = "INSERT INTO " + dbprefix + "_vpaccount_groups_users_link ( gid, uid, is_admin ) VALUES (";          sql = "INSERT INTO " + dbprefix + "_xnpaccount_groups_users_link ( gid, uid, is_admin ) VALUES (";
1929          sql += string( unsignedIntToString( gid ) ) + ", ";          sql += string( unsignedIntToString( gid ) ) + ", ";
1930          sql += string( unsignedIntToString( uid ) ) + ", ";          sql += string( unsignedIntToString( uid ) ) + ", ";
1931          sql += string( admin ? "1" : "0" ) + ") ";          sql += string( admin ? "1" : "0" ) + ") ";
# Line 1983  result_t getMembers( sessionid_t sid, gr Line 1986  result_t getMembers( sessionid_t sid, gr
1986      userid_t* dst = 0;      userid_t* dst = 0;
1987            
1988      //how many members ?      //how many members ?
1989      sql = "SELECT COUNT(*) FROM " + dbprefix + "_vpaccount_groups_users_link ";      sql = "SELECT COUNT(*) FROM " + dbprefix + "_xnpaccount_groups_users_link ";
1990      sql += " WHERE gid=" + string( unsignedIntToString( gid ) );      sql += " WHERE gid=" + string( unsignedIntToString( gid ) );
1991      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {
1992          if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){          if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){
# Line 1998  result_t getMembers( sessionid_t sid, gr Line 2001  result_t getMembers( sessionid_t sid, gr
2001                      //retrive member's IDs                      //retrive member's IDs
2002                      SQLHANDLE hstmt2 = NULL;                          SQLHANDLE hstmt2 = NULL;    
2003                     if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt2 ) ) == SQL_SUCCESS ) {                     if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt2 ) ) == SQL_SUCCESS ) {
2004                          sql = "SELECT uid, gid, is_admin FROM " + dbprefix + "_vpaccount_groups_users_link ";                          sql = "SELECT uid, gid, is_admin FROM " + dbprefix + "_xnpaccount_groups_users_link ";
2005                          sql += " WHERE gid=" + string( unsignedIntToString( gid ) );                          sql += " WHERE gid=" + string( unsignedIntToString( gid ) );
2006                          sql += " " + string( criteria2str( cri ) );                          sql += " " + string( criteria2str( cri ) );
2007                          if( ( sqlcode = SQLExecDirect( hstmt2, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){                          if( ( sqlcode = SQLExecDirect( hstmt2, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){
# Line 2062  result_t deleteGroup( sessionid_t sid, g Line 2065  result_t deleteGroup( sessionid_t sid, g
2065      SQLRETURN sqlcode;      SQLRETURN sqlcode;
2066      SQLHANDLE hstmt = NULL;      SQLHANDLE hstmt = NULL;
2067            
2068      sql = "DELETE FROM " + dbprefix + "_vpaccount_groups ";      sql = "DELETE FROM " + dbprefix + "_xnpaccount_groups ";
2069      sql += "WHERE gid = " + string( unsignedIntToString( gid ) );      sql += "WHERE gid = " + string( unsignedIntToString( gid ) );
2070      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {
2071          if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){          if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){
# Line 2114  result_t insertGroup( sessionid_t sid, c Line 2117  result_t insertGroup( sessionid_t sid, c
2117            
2118      result_t ret = RES_ERROR;      result_t ret = RES_ERROR;
2119      string sql;      string sql;
2120      SQLCHAR gname[VP_GROUP_GNAME_LEN+1], gdesc[VP_GROUP_GDESC_LEN+1];      SQLCHAR gname[XNP_GROUP_GNAME_LEN+1], gdesc[XNP_GROUP_GDESC_LEN+1];
2121      SQLINTEGER cbGname = SQL_NTS, cbGdesc = SQL_NTS;      SQLINTEGER cbGname = SQL_NTS, cbGdesc = SQL_NTS;
2122      SQLRETURN sqlcode;      SQLRETURN sqlcode;
2123            
2124      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {
2125          sql = "INSERT INTO " + dbprefix + "_vpaccount_groups ( gname, gdesc ) VALUES ( ?, ? )";          sql = "INSERT INTO " + dbprefix + "_xnpaccount_groups ( gname, gdesc ) VALUES ( ?, ? )";
2126          sqlcode = SQLPrepare(hstmt, (SQLCHAR*)sql.c_str(), SQL_NTS);          sqlcode = SQLPrepare(hstmt, (SQLCHAR*)sql.c_str(), SQL_NTS);
2127          if( sqlcode == SQL_SUCCESS || sqlcode == SQL_SUCCESS_WITH_INFO ){          if( sqlcode == SQL_SUCCESS || sqlcode == SQL_SUCCESS_WITH_INFO ){
2128              SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, VP_GROUP_GNAME_LEN, 0, gname, 0, &cbGname );              SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, XNP_GROUP_GNAME_LEN, 0, gname, 0, &cbGname );
2129              SQLBindParameter(hstmt, 2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, VP_GROUP_GDESC_LEN, 0, gdesc, 0, &cbGdesc );              SQLBindParameter(hstmt, 2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, XNP_GROUP_GDESC_LEN, 0, gdesc, 0, &cbGdesc );
2130              strncpy2( (char*)gname, group -> getGname( ), VP_GROUP_GNAME_LEN );              strncpy2( (char*)gname, group -> getGname( ), XNP_GROUP_GNAME_LEN );
2131              strncpy2( (char*)gdesc, group -> getDesc( ), VP_GROUP_GDESC_LEN );              strncpy2( (char*)gdesc, group -> getDesc( ), XNP_GROUP_GDESC_LEN );
2132              if( ( sqlcode = SQLExecute( hstmt ) ) == SQL_SUCCESS ){              if( ( sqlcode = SQLExecute( hstmt ) ) == SQL_SUCCESS ){
2133                  SQLINTEGER count = 0;                  SQLINTEGER count = 0;
2134                  if( ( sqlcode = SQLRowCount( hstmt, &count ) ) == SQL_SUCCESS && count > 0 ){                  if( ( sqlcode = SQLRowCount( hstmt, &count ) ) == SQL_SUCCESS && count > 0 ){
# Line 2204  result_t updateGroup( sessionid_t sid, c Line 2207  result_t updateGroup( sessionid_t sid, c
2207            
2208      result_t ret = RES_ERROR;      result_t ret = RES_ERROR;
2209      string sql;      string sql;
2210      SQLCHAR gname[VP_GROUP_GNAME_LEN+1], gdesc[VP_GROUP_GDESC_LEN+1];      SQLCHAR gname[XNP_GROUP_GNAME_LEN+1], gdesc[XNP_GROUP_GDESC_LEN+1];
2211      SQLINTEGER cbGname = SQL_NTS, cbGdesc = SQL_NTS;      SQLINTEGER cbGname = SQL_NTS, cbGdesc = SQL_NTS;
2212      SQLRETURN sqlcode;      SQLRETURN sqlcode;
2213            
2214      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {
2215          sql = "UPDATE " + dbprefix + "_vpaccount_groups SET gname=?, gdesc=? WHERE gid=" + string( unsignedIntToString( group -> getGID( ) ) );          sql = "UPDATE " + dbprefix + "_xnpaccount_groups SET gname=?, gdesc=? WHERE gid=" + string( unsignedIntToString( group -> getGID( ) ) );
2216          sqlcode = SQLPrepare(hstmt, (SQLCHAR*)sql.c_str(), SQL_NTS);          sqlcode = SQLPrepare(hstmt, (SQLCHAR*)sql.c_str(), SQL_NTS);
2217          if( sqlcode == SQL_SUCCESS || sqlcode == SQL_SUCCESS_WITH_INFO ){          if( sqlcode == SQL_SUCCESS || sqlcode == SQL_SUCCESS_WITH_INFO ){
2218              SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, VP_GROUP_GNAME_LEN, 0, gname, 0, &cbGname );              SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, XNP_GROUP_GNAME_LEN, 0, gname, 0, &cbGname );
2219              SQLBindParameter(hstmt, 2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, VP_GROUP_GDESC_LEN, 0, gdesc, 0, &cbGdesc );              SQLBindParameter(hstmt, 2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, XNP_GROUP_GDESC_LEN, 0, gdesc, 0, &cbGdesc );
2220              strncpy2( (char*)gname, group -> getGname( ), VP_GROUP_GNAME_LEN );              strncpy2( (char*)gname, group -> getGname( ), XNP_GROUP_GNAME_LEN );
2221              strncpy2( (char*)gdesc, group -> getDesc( ), VP_GROUP_GDESC_LEN );              strncpy2( (char*)gdesc, group -> getDesc( ), XNP_GROUP_GDESC_LEN );
2222              if( ( sqlcode = SQLExecute( hstmt ) ) == SQL_SUCCESS ){              if( ( sqlcode = SQLExecute( hstmt ) ) == SQL_SUCCESS ){
2223                  SQLINTEGER count = 0;                  SQLINTEGER count = 0;
2224                  if( ( sqlcode = SQLRowCount( hstmt, &count ) ) == SQL_SUCCESS && count > 0 ){                  if( ( sqlcode = SQLRowCount( hstmt, &count ) ) == SQL_SUCCESS && count > 0 ){
# Line 2299  result_t getGroups( sessionid_t sid, gro Line 2302  result_t getGroups( sessionid_t sid, gro
2302      group_t* dst = new group_t[ gidsLen ];      group_t* dst = new group_t[ gidsLen ];
2303            
2304      sql += "SELECT gid, gname, gdesc ";      sql += "SELECT gid, gname, gdesc ";
2305      sql += "FROM " + dbprefix + "_vpaccount_groups ";      sql += "FROM " + dbprefix + "_xnpaccount_groups ";
2306      if( gidsLen > 0 ){      if( gidsLen > 0 ){
2307          sql += "WHERE gid=" + string( unsignedIntToString( gids[ 0 ] ) );          sql += "WHERE gid=" + string( unsignedIntToString( gids[ 0 ] ) );
2308          for( int i = 1; i < gidsLen; i++ ){          for( int i = 1; i < gidsLen; i++ ){
# Line 2375  bool isModerator( sessionid_t sid, useri Line 2378  bool isModerator( sessionid_t sid, useri
2378      groupid_t moderator_gid;      groupid_t moderator_gid;
2379            
2380      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {
2381          sql = "SELECT value FROM " + dbprefix + "_vpaccount_config";          sql = "SELECT value FROM " + dbprefix + "_xnpaccount_config";
2382          sql += " WHERE name='moderator_gid'";          sql += " WHERE name='moderator_gid'";
2383          if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){          if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){
2384              SQLINTEGER len = 0;              SQLINTEGER len = 0;
# Line 2459  result_t getUid( const char* uname, user Line 2462  result_t getUid( const char* uname, user
2462    
2463  /**  /**
2464   *   *
2465   * セッションを作成しxoops_vpaccount_sessionに書き込む。 sessionid_tをsessionに返す。   * セッションを作成しxoops_xnpaccount_sessionに書き込む。 sessionid_tをsessionに返す。
2466   *   *
2467   * @param uid xoops_usersのuid   * @param uid xoops_usersのuid
2468   * @param session sessionid_tを受け取るためのポインタ。   * @param session sessionid_tを受け取るためのポインタ。
# Line 2470  static result_t addSession( userid_t uid Line 2473  static result_t addSession( userid_t uid
2473  {  {
2474      result_t ret = RES_DB_QUERY_ERROR;      result_t ret = RES_DB_QUERY_ERROR;
2475      SQLRETURN sqlcode;      SQLRETURN sqlcode;
2476      string sql = "INSERT INTO " + dbprefix + "_vpaccount_session (uid) values (" +      string sql = "INSERT INTO " + dbprefix + "_xnpaccount_session (uid) values (" +
2477        unsignedIntToString(uid) + ")";        unsignedIntToString(uid) + ")";
2478      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {
2479          if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){          if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){
# Line 2564  void logoutUser( sessionid_t sid ) Line 2567  void logoutUser( sessionid_t sid )
2567      SQLRETURN sqlcode;      SQLRETURN sqlcode;
2568      SQLHANDLE hstmt = NULL;          SQLHANDLE hstmt = NULL;    
2569            
2570      sql = "DELETE FROM " + dbprefix + "_vpaccount_session WHERE sid=" + intToString((int)sid);      sql = "DELETE FROM " + dbprefix + "_xnpaccount_session WHERE sid=" + intToString((int)sid);
2571      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {
2572          if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){          if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){
2573              ;              ;
# Line 2643  result_t getSession( sessionid_t sid, co Line 2646  result_t getSession( sessionid_t sid, co
2646      SQLRETURN sqlcode;      SQLRETURN sqlcode;
2647            
2648      sql = "SELECT sid, uid, unix_timestamp(timestamp) from " + dbprefix +      sql = "SELECT sid, uid, unix_timestamp(timestamp) from " + dbprefix +
2649        "_vpaccount_session where sid=" + unsignedIntToString((unsigned int)sid);        "_xnpaccount_session where sid=" + unsignedIntToString((unsigned int)sid);
2650      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {
2651          if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){          if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){
2652              userid_t uid = 0;              userid_t uid = 0;
# Line 2683  result_t getSession( sessionid_t sid, co Line 2686  result_t getSession( sessionid_t sid, co
2686            
2687  /*  /*
2688      sql = "SELECT sid, uid, unix_timestamp(timestamp) from " + dbprefix +      sql = "SELECT sid, uid, unix_timestamp(timestamp) from " + dbprefix +
2689        "_vpaccount_session where sid=" + unsignedIntToString((unsigned int)sid);        "_xnpaccount_session where sid=" + unsignedIntToString((unsigned int)sid);
2690      if( 0 == SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ){      if( 0 == SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ){
2691          MYSQL_RES* result = fp_mysql_store_result( mysql );          MYSQL_RES* result = fp_mysql_store_result( mysql );
2692          if( result ){          if( result ){
# Line 2730  bool isValidSessionID( sessionid_t sid ) Line 2733  bool isValidSessionID( sessionid_t sid )
2733  #ifdef USE_SYSLOG  #ifdef USE_SYSLOG
2734      openlog( "commonal", LOG_ODELAY, LOG_USER );      openlog( "commonal", LOG_ODELAY, LOG_USER );
2735  #endif  #endif
2736      sql = "SELECT * FROM " + dbprefix + "_vpaccount_session WHERE sid=" + unsignedIntToString( sid );      sql = "SELECT * FROM " + dbprefix + "_xnpaccount_session WHERE sid=" + unsignedIntToString( sid );
2737      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {
2738          if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){          if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){
2739              if( ( sqlcode = SQLFetch( hstmt ) ) == SQL_SUCCESS ){              if( ( sqlcode = SQLFetch( hstmt ) ) == SQL_SUCCESS ){

Legend:
Removed from v.1.35  
changed lines
  Added in v.1.36

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26