OmniSciDB  ba1bac9284
 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 261 of file DBObject.cpp.

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

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

262  {
263  DBObjectKey objectKey;
264  switch (type) {
266  objectKey.permissionType = std::stoi(key[0]);
267  objectKey.dbId = std::stoi(key[1]);
268  break;
269  case ServerDBObjectType:
270  case TableDBObjectType:
271  case ViewDBObjectType:
273  objectKey.permissionType = std::stoi(key[0]);
274  objectKey.dbId = std::stoi(key[1]);
275  objectKey.objectId = std::stoi(key[2]);
276  break;
277  default:
278  CHECK(false);
279  }
280  return objectKey;
281 }
int32_t objectId
Definition: DBObject.h:57
int32_t dbId
Definition: DBObject.h:56
#define CHECK(condition)
Definition: Logger.h:206
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: