inline command::command(const std::string& srv_, const std::string& usr_, const std::string& pwd_) : m_autocommit(true) { using namespace std; using namespace brig::unicode; const u16string srv(transform<char16_t>(srv_)), usr(transform<char16_t>(usr_)), pwd(transform<char16_t>(pwd_)), type_schema(transform<char16_t>("MDSYS")), type_name(transform<char16_t>("SDO_GEOMETRY")); try { if (lib::singleton().empty()) throw runtime_error("OCI error"); OCIEnv* env(0); m_hnd.check(lib::singleton().p_OCIEnvNlsCreate(&env, OCI_THREADED|OCI_NO_MUTEX|OCI_OBJECT, 0, 0, 0, 0, 0, 0, OCI_UTF16ID, OCI_UTF16ID)); m_hnd.env = env; m_hnd.alloc_handle((void**)&m_hnd.err, OCI_HTYPE_ERROR); m_hnd.alloc_handle((void**)&m_hnd.srv, OCI_HTYPE_SERVER); m_hnd.alloc_handle((void**)&m_hnd.svc, OCI_HTYPE_SVCCTX); m_hnd.alloc_handle((void**)&m_hnd.ses, OCI_HTYPE_SESSION); m_hnd.check(lib::singleton().p_OCIServerAttach(m_hnd.srv, m_hnd.err, (const text*)srv.c_str(), ub4(srv.size() * sizeof(char16_t)), OCI_DEFAULT)); m_hnd.check(lib::singleton().p_OCIAttrSet(m_hnd.svc, OCI_HTYPE_SVCCTX, (void*)m_hnd.srv, 0, OCI_ATTR_SERVER, m_hnd.err)); m_hnd.check(lib::singleton().p_OCIAttrSet(m_hnd.ses, OCI_HTYPE_SESSION, (void*)usr.c_str(), ub4(usr.size() * sizeof(char16_t)), OCI_ATTR_USERNAME, m_hnd.err)); m_hnd.check(lib::singleton().p_OCIAttrSet(m_hnd.ses, OCI_HTYPE_SESSION, (void*)pwd.c_str(), ub4(pwd.size() * sizeof(char16_t)), OCI_ATTR_PASSWORD, m_hnd.err)); m_hnd.check(lib::singleton().p_OCISessionBegin(m_hnd.svc, m_hnd.err, m_hnd.ses, OCI_CRED_RDBMS, OCI_DEFAULT)); m_hnd.check(lib::singleton().p_OCIAttrSet(m_hnd.svc, OCI_HTYPE_SVCCTX, (void*)m_hnd.ses, 0, OCI_ATTR_SESSION, m_hnd.err)); OCIType* type(0); m_hnd.check(lib::singleton().p_OCITypeByName ( m_hnd.env, m_hnd.err, m_hnd.svc , (const text*)type_schema.c_str(), ub4(type_schema.size() * sizeof(char16_t)) , (const text*)type_name.c_str(), ub4(type_name.size() * sizeof(char16_t)) , (const text*)0, 0, OCI_DURATION_SESSION, OCI_TYPEGET_HEADER, &type)); m_hnd.geom = type; } catch (const exception&) { close_all(); throw; } }
HRESULT CGUIContainer::Render(GUIState* pGUIState, float fElapsedTime) { SetDirty(false); m_objResource->SetActiveLayer(); m_objResource->SetCurrentState(); if (m_position.IsRelativeTo3DObject()) { BeginDepthTest(pGUIState); UpdateRects(); } RECT rcScreen;//rcScreen is the rect of this container //render background first rcScreen = m_objResource->GetDrawingRects(2); if (m_objResource->GetLayerType() == GUILAYER::ONE_ELEMENT) { DrawElement(m_objResource->GetTextureElement(0), &rcScreen, &rcScreen); } else if (m_objResource->GetLayerType() == GUILAYER::NINE_ELEMENT) { for (int e = 0; e < 9; ++e) { auto rc = m_objResource->GetDrawingRects(e + 3); DrawElement(m_objResource->GetTextureElement(e), &rc, &rcScreen, pGUIState); } } GUIBase_List_Type::iterator iter, iterend; iterend = this->GetChildren()->end(); bool bRender = false; if (m_bBatching) { RECT rctext; SetRect(&rctext, 5, 5, 60, 30); static u16string sText; if (sText.empty()) StringHelper::UTF8ToUTF16_Safe("Updating", sText); GetPainter(pGUIState)->DrawText(sText.c_str(), m_objResource->GetFontElement(0), &rctext, m_position.GetDepth()); } else { for (iter = this->GetChildren()->begin(); iter != iterend; iter++) { CGUIBase* pObjChild = *iter; /// skip any node that is not visible if (!(pObjChild->m_bIsVisible)) continue; RECT rcChild; bRender = false; if (!pObjChild->GetPosition()->IsRelativeTo3DObject()) { if (pObjChild->m_bNeedUpdate) pObjChild->UpdateRects(); rcChild = pObjChild->m_objResource->GetDrawingRects(0); if (GetFastRender() || RectIntersect(rcChild, rcScreen)){ bRender = true; } else bRender = false; } if (bRender) { pObjChild->DoRender(pGUIState, fElapsedTime); } } } if (m_position.IsRelativeTo3DObject()) { EndDepthTest(pGUIState); } OnFrameMove(fElapsedTime); return S_OK; }