OmniSciDB  0fdbebe030
 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 257 of file DBObject.cpp.

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

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

258  {
259  DBObjectKey objectKey;
260  switch (type) {
262  objectKey.permissionType = std::stoi(key[0]);
263  objectKey.dbId = std::stoi(key[1]);
264  break;
265  case ServerDBObjectType:
266  case TableDBObjectType:
267  case ViewDBObjectType:
269  objectKey.permissionType = std::stoi(key[0]);
270  objectKey.dbId = std::stoi(key[1]);
271  objectKey.objectId = std::stoi(key[2]);
272  break;
273  default:
274  CHECK(false);
275  }
276  return objectKey;
277 }
int32_t objectId
Definition: DBObject.h:57
CHECK(cgen_state)
int32_t dbId
Definition: DBObject.h:56
int32_t permissionType
Definition: DBObject.h:55

+ Here is the call graph for this function:

+ 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: