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.63 by aga, Thu Feb 10 02:33:16 2005 UTC revision 1.64 by youi, Tue Feb 15 02:35:47 2005 UTC
# Line 2  Line 2 
2   *   *
3   * $Revision$   * $Revision$
4   * $Log$   * $Log$
5     * Revision 1.64  2005/02/15 02:35:47  youi
6     * SQLINTEGERからSQLLENへ型変更.
7     *
8   * Revision 1.63  2005/02/10 02:33:16  aga   * Revision 1.63  2005/02/10 02:33:16  aga
9   * ・zipCreateをコメントアウトしていたのを戻した.   * ・zipCreateをコメントアウトしていたのを戻した.
10   *   *
# Line 547  static string odbcDiagString( SQLSMALLIN Line 550  static string odbcDiagString( SQLSMALLIN
550  string getResultCol( SQLHANDLE hstmt, int col )  string getResultCol( SQLHANDLE hstmt, int col )
551  {  {
552      string s;      string s;
553      SQLRETURN sqlcode;      SQLRETURN  sqlcode;
554      SQLCHAR       BinaryPtr[5000];      SQLCHAR    BinaryPtr[5000];
555      SQLINTEGER    BinaryLenOrInd, NumBytes;      SQLLEN     BinaryLenOrInd;
556        SQLINTEGER NumBytes;
557            
558      while ( ( sqlcode = SQLGetData(hstmt, col, SQL_C_CHAR, BinaryPtr, sizeof(BinaryPtr),      while ( ( sqlcode = SQLGetData(hstmt, col, SQL_C_CHAR, BinaryPtr, sizeof(BinaryPtr),
559                                     &BinaryLenOrInd)) != SQL_NO_DATA) {                                     &BinaryLenOrInd)) != SQL_NO_DATA) {
# Line 984  result_t activate( sessionid_t sid, user Line 988  result_t activate( sessionid_t sid, user
988      sql += " WHERE uid=" + string( unsignedIntToString( uid ) );      sql += " WHERE uid=" + string( unsignedIntToString( uid ) );
989      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {
990          if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){          if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){
991              SQLINTEGER count = 0;              SQLLEN count = 0;
992              if( ( sqlcode = SQLRowCount( hstmt, &count ) ) == SQL_SUCCESS && count > 0 ){              if( ( sqlcode = SQLRowCount( hstmt, &count ) ) == SQL_SUCCESS && count > 0 ){
993                  ret = RES_OK;                  ret = RES_OK;
994              }else{              }else{
# Line 1104  result_t deleteAccount( sessionid_t sid, Line 1108  result_t deleteAccount( sessionid_t sid,
1108      sql += "WHERE uid = " + string( unsignedIntToString( uid ) );      sql += "WHERE uid = " + string( unsignedIntToString( uid ) );
1109      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {
1110          if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){          if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){
1111              SQLINTEGER count = 0;              SQLLEN count = 0;
1112              if( ( sqlcode = SQLRowCount( hstmt, &count ) ) == SQL_SUCCESS && count > 0 ){              if( ( sqlcode = SQLRowCount( hstmt, &count ) ) == SQL_SUCCESS && count > 0 ){
1113                  ret1 = RES_OK;                  ret1 = RES_OK;
1114              }else{              }else{
# Line 1135  result_t deleteAccount( sessionid_t sid, Line 1139  result_t deleteAccount( sessionid_t sid,
1139      sql += "WHERE uid = " + string( unsignedIntToString( uid ) );      sql += "WHERE uid = " + string( unsignedIntToString( uid ) );
1140      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {
1141          if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){          if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){
1142              SQLINTEGER count = 0;              SQLLEN count = 0;
1143              if( ( sqlcode = SQLRowCount( hstmt, &count ) ) == SQL_SUCCESS && count > 0 ){              if( ( sqlcode = SQLRowCount( hstmt, &count ) ) == SQL_SUCCESS && count > 0 ){
1144                  ret2 = RES_OK;                  ret2 = RES_OK;
1145              }else{              }else{
# Line 1445  result_t insertAccount( sessionid_t sid, Line 1449  result_t insertAccount( sessionid_t sid,
1449              user_mailok = account -> getUserMailok( );              user_mailok = account -> getUserMailok( );
1450    
1451              if( ( sqlcode = SQLExecute( hstmt ) ) == SQL_SUCCESS ){              if( ( sqlcode = SQLExecute( hstmt ) ) == SQL_SUCCESS ){
1452                  SQLINTEGER count = 0;                  SQLLEN count = 0;
1453                  if( ( sqlcode = SQLRowCount( hstmt, &count ) ) == SQL_SUCCESS && count > 0 ){                  if( ( sqlcode = SQLRowCount( hstmt, &count ) ) == SQL_SUCCESS && count > 0 ){
1454                      //ユーザIDを取得する                      //ユーザIDを取得する
1455                      sql = "SELECT LAST_INSERT_ID()";                      sql = "SELECT LAST_INSERT_ID()";
# Line 1519  result_t insertAccount( sessionid_t sid, Line 1523  result_t insertAccount( sessionid_t sid,
1523                  notice_mail_since = account -> getNoticeMailSince( );                  notice_mail_since = account -> getNoticeMailSince( );
1524                            
1525                  if( ( sqlcode = SQLExecute( hstmt ) ) == SQL_SUCCESS ){                  if( ( sqlcode = SQLExecute( hstmt ) ) == SQL_SUCCESS ){
1526                      SQLINTEGER count = 0;                      SQLLEN count = 0;
1527                      if( ( sqlcode = SQLRowCount( hstmt, &count ) ) == SQL_SUCCESS && count > 0 ){                      if( ( sqlcode = SQLRowCount( hstmt, &count ) ) == SQL_SUCCESS && count > 0 ){
1528                          ret = RES_OK;                          ret = RES_OK;
1529                          if( ret == RES_OK ){                          if( ret == RES_OK ){
# Line 1755  result_t updateAccount( sessionid_t sid, Line 1759  result_t updateAccount( sessionid_t sid,
1759              uid = account -> getUID( );              uid = account -> getUID( );
1760                            
1761              if( ( sqlcode = SQLExecute( hstmt ) ) == SQL_SUCCESS ){              if( ( sqlcode = SQLExecute( hstmt ) ) == SQL_SUCCESS ){
1762                  SQLINTEGER count = 0;                  SQLLEN count = 0;
1763                  if( ( sqlcode = SQLRowCount( hstmt, &count ) ) == SQL_SUCCESS && count > 0 ){                  if( ( sqlcode = SQLRowCount( hstmt, &count ) ) == SQL_SUCCESS && count > 0 ){
1764                      ret = RES_OK;                      ret = RES_OK;
1765                  }else{                  }else{
# Line 1831  result_t updateAccount( sessionid_t sid, Line 1835  result_t updateAccount( sessionid_t sid,
1835              uid = account -> getUID( );              uid = account -> getUID( );
1836                            
1837              if( ( sqlcode = SQLExecute( hstmt ) ) == SQL_SUCCESS ){              if( ( sqlcode = SQLExecute( hstmt ) ) == SQL_SUCCESS ){
1838                  SQLINTEGER count = 0;                  SQLLEN count = 0;
1839                  if( ( sqlcode = SQLRowCount( hstmt, &count ) ) == SQL_SUCCESS && count > 0 ){                  if( ( sqlcode = SQLRowCount( hstmt, &count ) ) == SQL_SUCCESS && count > 0 ){
1840                      ret = RES_OK;                      ret = RES_OK;
1841                  }else{                  }else{
# Line 1889  result_t dumpUids( sessionid_t sid, crit Line 1893  result_t dumpUids( sessionid_t sid, crit
1893      userid_t* dst = 0;      userid_t* dst = 0;
1894      string sql;      string sql;
1895      SQLRETURN sqlcode;      SQLRETURN sqlcode;
1896      SQLINTEGER count = 0;      SQLLEN count = 0;
1897                            
1898    
1899      sql = "SELECT uid FROM " + dbprefix + "_xnpaccount_users ";      sql = "SELECT uid FROM " + dbprefix + "_xnpaccount_users ";
# Line 2014  result_t getGroupsByUid( sessionid_t sid Line 2018  result_t getGroupsByUid( sessionid_t sid
2018      string sql;      string sql;
2019      SQLRETURN sqlcode;      SQLRETURN sqlcode;
2020      SQLHANDLE hstmt = NULL;          SQLHANDLE hstmt = NULL;    
2021      SQLINTEGER count = 0;      SQLLEN count = 0;
2022      groupid_t* dst = 0;      groupid_t* dst = 0;
2023            
2024      sql = "SELECT gid FROM " + dbprefix + "_xnpaccount_groups_users_link";      sql = "SELECT gid FROM " + dbprefix + "_xnpaccount_groups_users_link";
# Line 2099  bool isGroupAdmin( sessionid_t sid, grou Line 2103  bool isGroupAdmin( sessionid_t sid, grou
2103            
2104      bool ret = false;      bool ret = false;
2105      string sql;      string sql;
2106      SQLINTEGER count = 0;      SQLLEN count = 0;
2107            
2108      sql = "SELECT * FROM " + dbprefix + "_xnpaccount_groups_users_link ";      sql = "SELECT * FROM " + dbprefix + "_xnpaccount_groups_users_link ";
2109      sql += "WHERE gid=" + string( unsignedIntToString( gid ) );      sql += "WHERE gid=" + string( unsignedIntToString( gid ) );
# Line 2141  result_t dumpGids( sessionid_t sid, crit Line 2145  result_t dumpGids( sessionid_t sid, crit
2145      groupid_t* dst = 0;      groupid_t* dst = 0;
2146      string sql;      string sql;
2147      SQLRETURN sqlcode;      SQLRETURN sqlcode;
2148      SQLINTEGER count = 0;      SQLLEN count = 0;
2149                            
2150      sql = "SELECT gid FROM " + dbprefix + "_xnpaccount_groups ";      sql = "SELECT gid FROM " + dbprefix + "_xnpaccount_groups ";
2151      sql += criteria2str( cri );      sql += criteria2str( cri );
# Line 2201  result_t dumpGroupAdmins( sessionid_t si Line 2205  result_t dumpGroupAdmins( sessionid_t si
2205      result_t ret = RES_ERROR;      result_t ret = RES_ERROR;
2206      string sql;      string sql;
2207      SQLRETURN sqlcode;      SQLRETURN sqlcode;
2208      SQLINTEGER count = 0;      SQLLEN count = 0;
2209                            
2210      sql = "SELECT uid FROM " + dbprefix + "_xnpaccount_groups_users_link ";      sql = "SELECT uid FROM " + dbprefix + "_xnpaccount_groups_users_link ";
2211      sql += " WHERE is_admin=1 and gid=" + unsignedIntToString( gid );      sql += " WHERE is_admin=1 and gid=" + unsignedIntToString( gid );
# Line 2292  static result_t deleteMemberNoLimit( ses Line 2296  static result_t deleteMemberNoLimit( ses
2296      sql += " AND uid=" + string( unsignedIntToString( uid ) );      sql += " AND uid=" + string( unsignedIntToString( uid ) );
2297      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {
2298          if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){          if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){
2299              SQLINTEGER count = 0;              SQLLEN count = 0;
2300              if( ( sqlcode = SQLRowCount( hstmt, &count ) ) == SQL_SUCCESS && count > 0 ){              if( ( sqlcode = SQLRowCount( hstmt, &count ) ) == SQL_SUCCESS && count > 0 ){
2301                  ret = RES_OK;                  ret = RES_OK;
2302              }else{              }else{
# Line 2355  result_t insertMember( sessionid_t sid, Line 2359  result_t insertMember( sessionid_t sid,
2359          sql += string( unsignedIntToString( uid ) ) + ", ";          sql += string( unsignedIntToString( uid ) ) + ", ";
2360          sql += string( admin ? "1" : "0" ) + ") ";          sql += string( admin ? "1" : "0" ) + ") ";
2361          if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){          if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){
2362              SQLINTEGER count = 0;              SQLLEN count = 0;
2363              if( ( sqlcode = SQLRowCount( hstmt, &count ) ) == SQL_SUCCESS && count > 0 ){              if( ( sqlcode = SQLRowCount( hstmt, &count ) ) == SQL_SUCCESS && count > 0 ){
2364                  ret = RES_OK;                  ret = RES_OK;
2365              }else{              }else{
# Line 2500  result_t deleteGroup( sessionid_t sid, g Line 2504  result_t deleteGroup( sessionid_t sid, g
2504      sql += "WHERE gid = " + string( unsignedIntToString( gid ) );      sql += "WHERE gid = " + string( unsignedIntToString( gid ) );
2505      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {
2506          if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){          if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){
2507              SQLINTEGER count = 0;              SQLLEN count = 0;
2508              if( ( sqlcode = SQLRowCount( hstmt, &count ) ) == SQL_SUCCESS && count > 0 ){              if( ( sqlcode = SQLRowCount( hstmt, &count ) ) == SQL_SUCCESS && count > 0 ){
2509                  ret = RES_OK;                  ret = RES_OK;
2510              }else{              }else{
# Line 2563  result_t insertGroup( sessionid_t sid, c Line 2567  result_t insertGroup( sessionid_t sid, c
2567              strncpy2( (char*)gname, group -> getGname( ), XNP_GROUP_GNAME_LEN );              strncpy2( (char*)gname, group -> getGname( ), XNP_GROUP_GNAME_LEN );
2568              strncpy2( (char*)gdesc, group -> getDesc( ), XNP_GROUP_GDESC_LEN );              strncpy2( (char*)gdesc, group -> getDesc( ), XNP_GROUP_GDESC_LEN );
2569              if( ( sqlcode = SQLExecute( hstmt ) ) == SQL_SUCCESS ){              if( ( sqlcode = SQLExecute( hstmt ) ) == SQL_SUCCESS ){
2570                  SQLINTEGER count = 0;                  SQLLEN count = 0;
2571                  if( ( sqlcode = SQLRowCount( hstmt, &count ) ) == SQL_SUCCESS && count > 0 ){                  if( ( sqlcode = SQLRowCount( hstmt, &count ) ) == SQL_SUCCESS && count > 0 ){
2572                      //グループIDを取得する                      //グループIDを取得する
2573                      sql = "SELECT LAST_INSERT_ID()";                      sql = "SELECT LAST_INSERT_ID()";
# Line 2670  result_t updateGroup( sessionid_t sid, c Line 2674  result_t updateGroup( sessionid_t sid, c
2674              strncpy2( (char*)gname, group -> getGname( ), XNP_GROUP_GNAME_LEN );              strncpy2( (char*)gname, group -> getGname( ), XNP_GROUP_GNAME_LEN );
2675              strncpy2( (char*)gdesc, group -> getDesc( ), XNP_GROUP_GDESC_LEN );              strncpy2( (char*)gdesc, group -> getDesc( ), XNP_GROUP_GDESC_LEN );
2676              if( ( sqlcode = SQLExecute( hstmt ) ) == SQL_SUCCESS ){              if( ( sqlcode = SQLExecute( hstmt ) ) == SQL_SUCCESS ){
2677                  SQLINTEGER count = 0;                  SQLLEN count = 0;
2678                  if( ( sqlcode = SQLRowCount( hstmt, &count ) ) == SQL_SUCCESS && count > 0 ){                  if( ( sqlcode = SQLRowCount( hstmt, &count ) ) == SQL_SUCCESS && count > 0 ){
2679                      ret = RES_OK;                      ret = RES_OK;
2680                  }else{                  }else{
# Line 2826  bool isModerator( sessionid_t sid, useri Line 2830  bool isModerator( sessionid_t sid, useri
2830      bool ret = false;      bool ret = false;
2831      SQLRETURN sqlcode;      SQLRETURN sqlcode;
2832      SQLHANDLE hstmt = NULL;          SQLHANDLE hstmt = NULL;    
2833      SQLINTEGER count = 0;      SQLLEN count = 0;
2834      string sql;      string sql;
2835      groupid_t moderator_gid;      groupid_t moderator_gid;
2836            
# Line 3252  result_t insertItem( sessionid_t sid, co Line 3256  result_t insertItem( sessionid_t sid, co
3256              last_update_date = time( NULL );              last_update_date = time( NULL );
3257                            
3258              if( ( sqlcode = SQLExecute( hstmt ) ) == SQL_SUCCESS ){              if( ( sqlcode = SQLExecute( hstmt ) ) == SQL_SUCCESS ){
3259                  SQLINTEGER count = 0;                  SQLLEN count = 0;
3260                  if( ( sqlcode = SQLRowCount( hstmt, &count ) ) == SQL_SUCCESS && count > 0 ){                  if( ( sqlcode = SQLRowCount( hstmt, &count ) ) == SQL_SUCCESS && count > 0 ){
3261                      //アイテムIDを取得する                      //アイテムIDを取得する
3262                      sql = "SELECT LAST_INSERT_ID()";                      sql = "SELECT LAST_INSERT_ID()";
# Line 3480  result_t dumpItemID(sessionid_t sid, cri Line 3484  result_t dumpItemID(sessionid_t sid, cri
3484      result_t ret = RES_ERROR;      result_t ret = RES_ERROR;
3485      SQLRETURN sqlcode;      SQLRETURN sqlcode;
3486      SQLHANDLE hstmt = NULL;          SQLHANDLE hstmt = NULL;    
3487      SQLINTEGER count = 0;      SQLLEN count = 0;
3488      string sql;      string sql;
3489      itemid_t* dst = 0;      itemid_t* dst = 0;
3490            
# Line 3607  result_t updateItem( sessionid_t sid, co Line 3611  result_t updateItem( sessionid_t sid, co
3611              item_id = item -> getItemID( );              item_id = item -> getItemID( );
3612                            
3613              if( ( sqlcode = SQLExecute( hstmt ) ) == SQL_SUCCESS ){              if( ( sqlcode = SQLExecute( hstmt ) ) == SQL_SUCCESS ){
3614                  SQLINTEGER count = 0;                  SQLLEN count = 0;
3615                  if( ( sqlcode = SQLRowCount( hstmt, &count ) ) == SQL_SUCCESS && count > 0 ){                  if( ( sqlcode = SQLRowCount( hstmt, &count ) ) == SQL_SUCCESS && count > 0 ){
3616                      char* certify_item_val;                      char* certify_item_val;
3617                      if( getConfigValue( XNP_CONFIG_CERTIFY_ITEM_KEY, &certify_item_val ) == RES_OK ){                      if( getConfigValue( XNP_CONFIG_CERTIFY_ITEM_KEY, &certify_item_val ) == RES_OK ){
# Line 3739  result_t deleteItem( sessionid_t sid, it Line 3743  result_t deleteItem( sessionid_t sid, it
3743      sql += "WHERE item_id = " + string( unsignedIntToString( itemid ) );      sql += "WHERE item_id = " + string( unsignedIntToString( itemid ) );
3744      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {
3745          if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){          if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){
3746              SQLINTEGER count = 0;              SQLLEN count = 0;
3747              if( ( sqlcode = SQLRowCount( hstmt, &count ) ) == SQL_SUCCESS && count > 0 ){              if( ( sqlcode = SQLRowCount( hstmt, &count ) ) == SQL_SUCCESS && count > 0 ){
3748                  ret = RES_OK;                  ret = RES_OK;
3749              }else{              }else{
# Line 3770  result_t deleteItem( sessionid_t sid, it Line 3774  result_t deleteItem( sessionid_t sid, it
3774      sql += "WHERE item_id = " + string( unsignedIntToString( itemid ) );      sql += "WHERE item_id = " + string( unsignedIntToString( itemid ) );
3775      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {
3776          if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){          if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){
3777              SQLINTEGER count = 0;              SQLLEN count = 0;
3778              if( ( sqlcode = SQLRowCount( hstmt, &count ) ) == SQL_SUCCESS && count > 0 ){              if( ( sqlcode = SQLRowCount( hstmt, &count ) ) == SQL_SUCCESS && count > 0 ){
3779                  ret = RES_OK;                  ret = RES_OK;
3780              }else{              }else{
# Line 3802  result_t deleteItem( sessionid_t sid, it Line 3806  result_t deleteItem( sessionid_t sid, it
3806      sql += "WHERE item_id = " + string( unsignedIntToString( itemid ) );      sql += "WHERE item_id = " + string( unsignedIntToString( itemid ) );
3807      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {      if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ) == SQL_SUCCESS ) {
3808          if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){          if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){
3809              SQLINTEGER count = 0;              SQLLEN count = 0;
3810              if( ( sqlcode = SQLRowCount( hstmt, &count ) ) == SQL_SUCCESS && count > 0 ){              if( ( sqlcode = SQLRowCount( hstmt, &count ) ) == SQL_SUCCESS && count > 0 ){
3811                  ret = RES_OK;                  ret = RES_OK;
3812              }else{              }else{
# Line 3858  result_t getPrivateItemID( sessionid_t s Line 3862  result_t getPrivateItemID( sessionid_t s
3862      itemid_t* dst = 0;      itemid_t* dst = 0;
3863      string sql;      string sql;
3864      SQLRETURN sqlcode;      SQLRETURN sqlcode;
3865      SQLINTEGER count = 0;      SQLLEN count = 0;
3866      userid_t sess_uid;      userid_t sess_uid;
3867            
3868      if( ( ret = sessionID2UID( sid, &sess_uid ) ) != RES_OK ) return ret;      if( ( ret = sessionID2UID( sid, &sess_uid ) ) != RES_OK ) return ret;
# Line 3973  result_t getItemIDByIndexID( sessionid_t Line 3977  result_t getItemIDByIndexID( sessionid_t
3977      itemid_t* dst = 0;      itemid_t* dst = 0;
3978      string sql;      string sql;
3979      SQLRETURN sqlcode;      SQLRETURN sqlcode;
3980      SQLINTEGER count = 0;      SQLLEN count = 0;
3981      userid_t uid;      userid_t uid;
3982            
3983      if( ( ret = sessionID2UID( sid, &uid ) ) != RES_OK ) return ret;      if( ( ret = sessionID2UID( sid, &uid ) ) != RES_OK ) return ret;
# Line 4063  result_t getItemIDByBinderID( sessionid_ Line 4067  result_t getItemIDByBinderID( sessionid_
4067      itemid_t* dst = 0;      itemid_t* dst = 0;
4068      string sql;      string sql;
4069      SQLRETURN sqlcode;      SQLRETURN sqlcode;
4070      SQLINTEGER count = 0;      SQLLEN count = 0;
4071            
4072      sql = "SELECT t1.item_id FROM " + dbprefix + "_xnpaccount_item_basic as t1, "      sql = "SELECT t1.item_id FROM " + dbprefix + "_xnpaccount_item_basic as t1, "
4073          + dbprefix + "_xnpbinder_binder_item_link as t2 ";          + dbprefix + "_xnpbinder_binder_item_link as t2 ";
# Line 4174  bool getCertifyPermission( sessionid_t s Line 4178  bool getCertifyPermission( sessionid_t s
4178            
4179      result_t ret = RES_ERROR;      result_t ret = RES_ERROR;
4180      string sql;      string sql;
4181      SQLINTEGER count = 0;      SQLLEN count = 0;
4182      userid_t sess_uid;      userid_t sess_uid;
4183            
4184      if( ( ret = sessionID2UID( sid, &sess_uid ) ) != RES_OK ) return ret;      if( ( ret = sessionID2UID( sid, &sess_uid ) ) != RES_OK ) return ret;
# Line 4755  bool isGroupMemberInternal( sessionid_t Line 4759  bool isGroupMemberInternal( sessionid_t
4759            
4760      bool ret = false;      bool ret = false;
4761      string sql;      string sql;
4762      SQLINTEGER count = 0;      SQLLEN count = 0;
4763            
4764      sql = "SELECT * FROM " + dbprefix + "_xnpaccount_groups_users_link ";      sql = "SELECT * FROM " + dbprefix + "_xnpaccount_groups_users_link ";
4765      sql += "WHERE gid=" + string( unsignedIntToString( gid ) );      sql += "WHERE gid=" + string( unsignedIntToString( gid ) );
# Line 5794  result_t setConfigValue( const char* key Line 5798  result_t setConfigValue( const char* key
5798              SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, SQL_DESC_LENGTH, 0, (SQLCHAR*)value, strlen(value), &cbValue );              SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, SQL_DESC_LENGTH, 0, (SQLCHAR*)value, strlen(value), &cbValue );
5799              SQLBindParameter(hstmt, 2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, XNP_CONFIG_NAME_LEN, 0, (SQLCHAR*)key  , strlen(key)  , &cbKey );              SQLBindParameter(hstmt, 2, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_LONGVARCHAR, XNP_CONFIG_NAME_LEN, 0, (SQLCHAR*)key  , strlen(key)  , &cbKey );
5800              if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){              if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){
5801                  SQLINTEGER count = 0;                  SQLLEN count = 0;
5802                  if( ( sqlcode = SQLRowCount( hstmt, &count ) ) == SQL_SUCCESS && count > 0 ){                  if( ( sqlcode = SQLRowCount( hstmt, &count ) ) == SQL_SUCCESS && count > 0 ){
5803                      ret = RES_OK;                      ret = RES_OK;
5804                  }else if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt2 ) ) == SQL_SUCCESS ) {                  }else if( ( sqlcode = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt2 ) ) == SQL_SUCCESS ) {
# Line 5875  result_t getConfigValue( const char* key Line 5879  result_t getConfigValue( const char* key
5879              if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){              if( ( sqlcode = SQLExecDirect( hstmt, (SQLCHAR*)sql.c_str(), sql.length() ) ) == SQL_SUCCESS ){
5880                  while( SQLFetch( hstmt ) == SQL_SUCCESS ){                  while( SQLFetch( hstmt ) == SQL_SUCCESS ){
5881                      string valuestr;                      string valuestr;
5882                      SQLINTEGER length = 0;                      SQLLEN length = 0;
5883                      syslog_printf( "\nsql at %d=%s", __LINE__, sql.c_str() );                      syslog_printf( "\nsql at %d=%s", __LINE__, sql.c_str() );
5884                      // get amount of data                      // get amount of data
5885                      if( SQLGetData(hstmt, 1, SQL_C_BINARY, *value, 0, &length)                      if( SQLGetData(hstmt, 1, SQL_C_BINARY, *value, 0, &length)
# Line 5955  result_t getChangeLogs( sessionid_t sid, Line 5959  result_t getChangeLogs( sessionid_t sid,
5959      result_t ret = RES_ERROR;      result_t ret = RES_ERROR;
5960      SQLRETURN sqlcode;      SQLRETURN sqlcode;
5961      SQLHANDLE hstmt = NULL;      SQLHANDLE hstmt = NULL;
5962      SQLINTEGER count = 0;      SQLLEN count = 0;
5963      string sql;      string sql;
5964      SQLLEN len = 0;      SQLLEN len = 0;
5965      time_t log_date = 0;      time_t log_date = 0;
# Line 6477  result_t getUncertifiedLink( sessionid_t Line 6481  result_t getUncertifiedLink( sessionid_t
6481      indexid_t* dst_xids = 0;      indexid_t* dst_xids = 0;
6482      string sql;      string sql;
6483      SQLRETURN sqlcode;      SQLRETURN sqlcode;
6484      SQLINTEGER count = 0;      SQLLEN count = 0;
6485      userid_t sess_uid;      userid_t sess_uid;
6486            
6487      if( ( ret = sessionID2UID( sid, &sess_uid ) ) != RES_OK ) return ret;      if( ( ret = sessionID2UID( sid, &sess_uid ) ) != RES_OK ) return ret;
# Line 6547  result_t getItemTypes( const itemtype_t* Line 6551  result_t getItemTypes( const itemtype_t*
6551      itemtype_t* dst= 0;      itemtype_t* dst= 0;
6552      string sql;      string sql;
6553      SQLRETURN sqlcode;      SQLRETURN sqlcode;
6554      SQLINTEGER count = 0;      SQLLEN count = 0;
6555            
6556          sql = "SELECT item_type_id, name, mid, display_name ";          sql = "SELECT item_type_id, name, mid, display_name ";
6557          sql += " FROM " + dbprefix + "_xnpaccount_item_type order by item_type_id";          sql += " FROM " + dbprefix + "_xnpaccount_item_type order by item_type_id";
# Line 6607  result_t getIndexIDByItemID( sessionid_t Line 6611  result_t getIndexIDByItemID( sessionid_t
6611      result_t ret = RES_ERROR;      result_t ret = RES_ERROR;
6612      SQLRETURN sqlcode;      SQLRETURN sqlcode;
6613      SQLHANDLE hstmt = NULL;      SQLHANDLE hstmt = NULL;
6614      SQLINTEGER count = 0;      SQLLEN count = 0;
6615      string sql;      string sql;
6616      indexid_t xid = 0;      indexid_t xid = 0;
6617      SQLLEN len = 0;      SQLLEN len = 0;
# Line 6668  result_t getOwnPublicItemID( sessionid_t Line 6672  result_t getOwnPublicItemID( sessionid_t
6672      itemid_t* dst = 0;      itemid_t* dst = 0;
6673      string sql;      string sql;
6674      SQLRETURN sqlcode;      SQLRETURN sqlcode;
6675      SQLINTEGER count = 0;      SQLLEN count = 0;
6676      userid_t sess_uid;      userid_t sess_uid;
6677            
6678      if( ( ret = sessionID2UID( sid, &sess_uid ) ) != RES_OK ) return ret;      if( ( ret = sessionID2UID( sid, &sess_uid ) ) != RES_OK ) return ret;

Legend:
Removed from v.1.63  
changed lines
  Added in v.1.64

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