OmniSciDB  b24e664e58
 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 53 of file DBObject.h.

Member Function Documentation

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

Definition at line 228 of file DBObject.cpp.

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

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

229  {
230  DBObjectKey objectKey;
231  switch (type) {
233  objectKey.permissionType = std::stoi(key[0]);
234  objectKey.dbId = std::stoi(key[1]);
235  break;
236  case TableDBObjectType:
237  case ViewDBObjectType:
239  objectKey.permissionType = std::stoi(key[0]);
240  objectKey.dbId = std::stoi(key[1]);
241  objectKey.objectId = std::stoi(key[2]);
242  break;
243  default:
244  CHECK(false);
245  }
246  return objectKey;
247 }
int32_t objectId
Definition: DBObject.h:56
CHECK(cgen_state)
int32_t dbId
Definition: DBObject.h:55
int32_t permissionType
Definition: DBObject.h:54

+ 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 60 of file DBObject.h.

References dbId, N_COLUMNS, objectId, and permissionType.

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

Definition at line 66 of file DBObject.h.

References dbId, objectId, and permissionType.

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

Member Data Documentation

const size_t DBObjectKey::N_COLUMNS = 3
static

Definition at line 58 of file DBObject.h.

Referenced by operator<().


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