OmniSciDB  340b00dbf6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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 54 of file DBObject.h.

Member Function Documentation

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

Definition at line 259 of file DBObject.cpp.

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

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

260  {
261  DBObjectKey objectKey;
262  switch (type) {
264  objectKey.permissionType = std::stoi(key[0]);
265  objectKey.dbId = std::stoi(key[1]);
266  break;
267  case ServerDBObjectType:
268  case TableDBObjectType:
269  case ViewDBObjectType:
271  objectKey.permissionType = std::stoi(key[0]);
272  objectKey.dbId = std::stoi(key[1]);
273  objectKey.objectId = std::stoi(key[2]);
274  break;
275  default:
276  CHECK(false);
277  }
278  return objectKey;
279 }
int32_t objectId
Definition: DBObject.h:57
int32_t dbId
Definition: DBObject.h:56
#define CHECK(condition)
Definition: Logger.h:197
int32_t permissionType
Definition: DBObject.h:55

+ Here is the caller graph for this function:

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

Definition at line 61 of file DBObject.h.

References dbId, N_COLUMNS, objectId, and permissionType.

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

Definition at line 67 of file DBObject.h.

References dbId, objectId, and permissionType.

67  {
68  return permissionType == key.permissionType && dbId == key.dbId &&
69  objectId == key.objectId;
70  }
int32_t objectId
Definition: DBObject.h:57
int32_t dbId
Definition: DBObject.h:56
int32_t permissionType
Definition: DBObject.h:55

Member Data Documentation

const size_t DBObjectKey::N_COLUMNS = 3
static

Definition at line 59 of file DBObject.h.

Referenced by operator<().


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