OmniSciDB  c0231cc57d
 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 270 of file DBObject.cpp.

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

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

271  {
272  DBObjectKey objectKey;
273  switch (type) {
275  objectKey.permissionType = std::stoi(key[0]);
276  objectKey.dbId = std::stoi(key[1]);
277  break;
278  case ServerDBObjectType:
279  case TableDBObjectType:
280  case ViewDBObjectType:
282  objectKey.permissionType = std::stoi(key[0]);
283  objectKey.dbId = std::stoi(key[1]);
284  objectKey.objectId = std::stoi(key[2]);
285  break;
286  default:
287  CHECK(false);
288  }
289  return objectKey;
290 }
int32_t objectId
Definition: DBObject.h:55
int32_t dbId
Definition: DBObject.h:54
#define CHECK(condition)
Definition: Logger.h:222
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: