//todo: CreatePlayerDataContext 구현 bool CreatePlayerDataContext::OnSQLExecute() { DBHelper dbHelper; /* dbHelper.BindParamText( mPlayerName ); dbHelper.BindResultColumnInt( &mPlayerId ); if ( dbHelper.Execute( SQL_CreatePlayer ) ) { if ( dbHelper.FetchRow() ) { return true; } } */ dbHelper.BindParamText(mPlayerName); dbHelper.BindResultColumnInt( &mPlayerId ); if (dbHelper.Execute(SQL_CreatePlayer)) { if (dbHelper.FetchRow()) { /// 적용받은 행이 하나도 없다면, 실패라고 간주하자 return mPlayerId != -1; } } return false; }
//todo: DeletePlayerDataContext 구현 bool DeletePlayerDataContext::OnSQLExecute() { DBHelper dbHelper; /* dbHelper.BindParamInt( &mPlayerId ); if ( dbHelper.Execute( SQL_DeletePlayer ) ) { if ( dbHelper.FetchRow() ) { return true; } } */ int result = 0; dbHelper.BindParamInt(&mPlayerId); dbHelper.BindResultColumnInt(&result); if (dbHelper.Execute(SQL_DeletePlayer)) { if (dbHelper.FetchRow()) { /// 적용받은 행이 하나도 없다면, 실패라고 간주하자 return result != 0; } } return false; }
bool UpdatePlayerCommentContext::OnSQLExecute() { DBHelper dbHelper; int result = 0; dbHelper.BindParamInt(&mPlayerId); dbHelper.BindParamText(mComment); dbHelper.BindResultColumnInt(&result); if (dbHelper.Execute(SQL_UpdatePlayerComment)) { if (dbHelper.FetchRow()) { return result != 0; } } return false; }
bool UpdatePlayerPositionContext::OnSQLExecute() { DBHelper dbHelper; int result = 0; dbHelper.BindParamInt(&mPlayerId); dbHelper.BindParamFloat(&mPosX); dbHelper.BindParamFloat(&mPosY); dbHelper.BindParamFloat(&mPosZ); dbHelper.BindResultColumnInt(&result); if (dbHelper.Execute(SQL_UpdatePlayerPosition)) { if (dbHelper.FetchRow()) { return result != 0; } } return false; }