OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DBObjectKey Struct Reference

#include <DBObject.h>

Public Member Functions

bool operator< (const DBObjectKey &key) const
 
bool operator== (const DBObjectKey &key) const
 

Static Public Member Functions

static DBObjectKey fromString (const std::vector< std::string > &key, const DBObjectType &type)
 

Public Attributes

int32_t permissionType = -1
 
int32_t dbId = -1
 
int32_t objectId = -1
 

Static Public Attributes

static const size_t N_COLUMNS = 3
 

Detailed Description

Definition at line 52 of file DBObject.h.

Member Function Documentation

DBObjectKey DBObjectKey::fromString ( const std::vector< std::string > &  key,
const DBObjectType type 
)
static

Definition at line 271 of file DBObject.cpp.

References CHECK, DashboardDBObjectType, DatabaseDBObjectType, dbId, objectId, permissionType, ServerDBObjectType, TableDBObjectType, and ViewDBObjectType.

Referenced by Catalog_Namespace::SysCatalog::buildRoleMapUnlocked().

272  {
273  DBObjectKey objectKey;
274  switch (type) {
276  objectKey.permissionType = std::stoi(key[0]);
277  objectKey.dbId = std::stoi(key[1]);
278  break;
279  case ServerDBObjectType:
280  case TableDBObjectType:
281  case ViewDBObjectType:
283  objectKey.permissionType = std::stoi(key[0]);
284  objectKey.dbId = std::stoi(key[1]);
285  objectKey.objectId = std::stoi(key[2]);
286  break;
287  default:
288  CHECK(false);
289  }
290  return objectKey;
291 }
int32_t objectId
Definition: DBObject.h:55
int32_t dbId
Definition: DBObject.h:54
#define CHECK(condition)
Definition: Logger.h:291
int32_t permissionType
Definition: DBObject.h:53

+ Here is the caller graph for this function:

bool DBObjectKey::operator< ( const DBObjectKey key) const
inline

Definition at line 59 of file DBObject.h.

References dbId, N_COLUMNS, objectId, and permissionType.

59  {
60  int32_t ids_a[N_COLUMNS] = {permissionType, dbId, objectId};
61  int32_t ids_b[N_COLUMNS] = {key.permissionType, key.dbId, key.objectId};
62  return memcmp(ids_a, ids_b, N_COLUMNS * sizeof(int32_t)) < 0;
63  }
int32_t objectId
Definition: DBObject.h:55
static const size_t N_COLUMNS
Definition: DBObject.h:57
int32_t dbId
Definition: DBObject.h:54
int32_t permissionType
Definition: DBObject.h:53
bool DBObjectKey::operator== ( const DBObjectKey key) const
inline

Definition at line 65 of file DBObject.h.

References dbId, objectId, and permissionType.

65  {
66  return permissionType == key.permissionType && dbId == key.dbId &&
67  objectId == key.objectId;
68  }
int32_t objectId
Definition: DBObject.h:55
int32_t dbId
Definition: DBObject.h:54
int32_t permissionType
Definition: DBObject.h:53

Member Data Documentation

const size_t DBObjectKey::N_COLUMNS = 3
static

Definition at line 57 of file DBObject.h.

Referenced by operator<().


The documentation for this struct was generated from the following files: