BOOL CMExerciseList::GetTrainList(const char* sTrainId) { if(IsRunning()) return FALSE; n_sTrainID = sTrainId; if(CMGlobal::TheOne().IsOffline()) { LoadFromDB(); if (m_pListener) m_pListener->OnUpdateDataFinish(m_UserData, TResult::ESuccess); return TRUE; } else { char sParam[200]; memset(sParam, 0, 200); snprintf(sParam, 200, "id=%s",sTrainId); return Request(SERVICE_GETMYTRAINEXERCISELIST,sParam); } }
bool Corpse::LoadFromDB(uint32 lowguid, QueryResult *result) { bool external = (result != NULL); if (!external) // 0 1 2 3 4 5 6 7 8 result = CharacterDatabase.PQuery("SELECT position_x,position_y,position_z,orientation,map,data,time,corpse_type,instance FROM corpse WHERE guid = '%u'", lowguid); if( !result ) { sLog.outError("Corpse (GUID: %u) not found in table `corpse`, can't load. ", lowguid); return false; } Field *fields = result->Fetch(); if (!LoadFromDB(lowguid, fields)) { if (!external) delete result; return false; } if (!external) delete result; return true; }
void FNAnalyseMgr::Excute() { if (!IsFileExist()) { SaveToDB(); } LoadFromDB(); RunOnCondition(); }
Clip::Clip(sqlite3 *db, sqlite3_int64 clip_id) : m_db(db) , m_id(clip_id) , m_num_frames(0) , m_joints_per_frame(0) , m_fps(0) , m_frame_data(0) , m_root_offsets(0) , m_root_orientations(0) { if(!LoadFromDB()) { m_id = 0; } }
bool IDataManager::Init() { do { if (m_bLoadFromDB) if (!LoadFromDB()) break; else if (!LoadFromFile()) break; return true; } while(false); return false; }
bool Corpse::LoadFromDB(uint32 guid, QueryResultAutoPtr result, uint32 InstanceId) { if (! result) // 0 1 2 3 4 5 6 7 8 result = RealmDataDatabase.PQuery("SELECT position_x,position_y,position_z,orientation,map,data,time,corpse_type,instance FROM corpse WHERE guid = '%u'",guid); if (! result) { sLog.outLog(LOG_DEFAULT, "ERROR: Corpse (GUID: %u) not found in table `corpse`, can't load. ",guid); return false; } Field *fields = result->Fetch(); if (!LoadFromDB(guid,fields)) return false; return true; }
BOOL CMExerciseList::GetList() { if (IsRunning()) return FALSE; n_sTrainID = ""; if(CMGlobal::TheOne().IsOffline()) { LoadFromDB(); if (m_pListener) m_pListener->OnUpdateDataFinish(m_UserData, TResult::ESuccess); return TRUE; } else { return Request(SERVICE_GETEXERCISELIST, ""); } }
// Open the database file bool cGraph::OpenDB( const std::wstring& n ) { theDB.Close(); theDB.Open( n ); if( theDB.myError ) return false; theDB.Query( L"CREATE TABLE IF NOT EXISTS vertex " L"( vertex_id INTEGER PRIMARY KEY, " L"name, X, Y, pinned );"); theDB.Query( L"CREATE TABLE IF NOT EXISTS edge " L"( edge_id INTEGER PRIMARY KEY, " L"a, b );"); LoadFromDB(); return true; }
void WardenMgr::Initialize(const char *addr, u_short port, bool IsBanning) { // Save the address and port m_WardendAddress = addr; m_WardendPort = port; m_Banning = IsBanning; if (!LoadFromDB()) { sLog->outError("Warden Daemon has no modules, disabling it"); m_Enabled = false; return; } if (m_Disconnected = !InitializeCommunication()) { sLog->outError("Warden Daemon not reachable, trying to connect in the background"); m_PingOut = true; } m_PingTimer.SetInterval(10 * IN_MILLISECONDS); m_PingTimer.Reset(); }
HTTPLiveStream::HTTPLiveStream(int streamid) : m_writing(false), m_streamid(streamid) { LoadFromDB(); }
AuctionMgr::AuctionMgr() { LoadFromDB(); }
BOOL COnhookMgr::Init() { return LoadFromDB(); }
BOOL CDrugUpradePropMgr::Init() { return LoadFromDB(); }
BOOL CCropSeedPropMgr::Init() { return LoadFromDB(); }
BOOL CHPGridMgr::Init() { m_byMaxGridNum = CSinglePramMgr::Instance()->GetMaxHPGridNum(); m_wMaxPlayerLevel = CSinglePramMgr::Instance()->GetMaxPlayerLevel(); return LoadFromDB(); }
void CMExerciseList::OnSessionCmd(unsigned int nCmdID, unsigned int nCode, TiXmlDocument* pDoc) { INT32 result = TResult::EUnknownError; if (nCode == MER_OK) { //获得根元素res。 TiXmlElement *pItem = pDoc->RootElement(); if(pItem) { INT32 nCmdID = 0; pItem->QueryIntAttribute("no", &nCmdID); INT32 nErr = 0; if(pItem->QueryIntAttribute("errno", &nErr) == TIXML_SUCCESS) { if (nErr == 0) { if (nCmdID == SERVICE_GETEXERCISELIST || nCmdID == SERVICE_GETEXERCISEBYID||nCmdID == SERVICE_GETMYTRAINEXERCISELIST) { sqlite3* db = CheckTable(); if(db) { DoCreate(db); } pItem = pItem->FirstChildElement("item"); char* errorMsg; if (m_lstItem) { m_lstItem->clear(); } if (db != NULL && sqlite3_exec(db, "BEGIN TRANSACTION;", 0,0, &errorMsg) != SQLITE_OK) { CM_ERRP("BEGIN TRANSACTION failed.error:%s", errorMsg); } while(pItem) { TExerciseListItem a; if (DoPutItem(pItem, db, a)) { m_lstItem->push_back(a); } pItem = pItem->NextSiblingElement("item"); } if (db != NULL && sqlite3_exec(db, "COMMIT TRANSACTION;", 0,0, &errorMsg) != SQLITE_OK) { CM_ERRP("COMMIT TRANSACTION failed.error:%s", errorMsg); } if(GetItemCount() > 0) result = TResult::ESuccess; else result = TResult::ENothing; } } else { result = TResult::ENetDisconnect; LoadFromDB(); } } } } else { LoadFromDB(); result = TResult::ENetDisconnect; } if(m_pListener) m_pListener->OnUpdateDataFinish(m_UserData, result); }