void IdoPgsqlConnection::InternalActivateObject(const DbObject::Ptr& dbobj) { AssertOnWorkQueue(); if (!GetConnected()) return; DbReference dbref = GetObjectID(dbobj); std::ostringstream qbuf; if (!dbref.IsValid()) { if (!dbobj->GetName2().IsEmpty()) { qbuf << "INSERT INTO " + GetTablePrefix() + "objects (instance_id, objecttype_id, name1, name2, is_active) VALUES (" << static_cast<long>(m_InstanceID) << ", " << dbobj->GetType()->GetTypeID() << ", " << "E'" << Escape(dbobj->GetName1()) << "', E'" << Escape(dbobj->GetName2()) << "', 1)"; } else { qbuf << "INSERT INTO " + GetTablePrefix() + "objects (instance_id, objecttype_id, name1, is_active) VALUES (" << static_cast<long>(m_InstanceID) << ", " << dbobj->GetType()->GetTypeID() << ", " << "E'" << Escape(dbobj->GetName1()) << "', 1)"; } Query(qbuf.str()); SetObjectID(dbobj, GetSequenceValue(GetTablePrefix() + "objects", "object_id")); } else { qbuf << "UPDATE " + GetTablePrefix() + "objects SET is_active = 1 WHERE object_id = " << static_cast<long>(dbref); Query(qbuf.str()); } }
DbReference DbConnection::GetInsertID(const DbObject::Ptr& dbobj) const { return GetInsertID(dbobj->GetType(), GetObjectID(dbobj)); }
void DbConnection::SetInsertID(const DbObject::Ptr& dbobj, const DbReference& dbref) { SetInsertID(dbobj->GetType(), GetObjectID(dbobj), dbref); }
String DbConnection::GetConfigHash(const DbObject::Ptr& dbobj) const { return GetConfigHash(dbobj->GetType(), GetObjectID(dbobj)); }
void DbConnection::SetConfigHash(const DbObject::Ptr& dbobj, const String& hash) { SetConfigHash(dbobj->GetType(), GetObjectID(dbobj), hash); }