OmniSciDB  eb3a3d0a03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Catalog_Namespace Namespace Reference

Namespaces

 anonymous_namespace{Catalog.cpp}
 
 anonymous_namespace{SysCatalog.cpp}
 

Classes

struct  TableEpochInfo
 
class  Catalog
 class for a per-database catalog. also includes metadata for the current database and the current user. More...
 
struct  CustomExpression
 
class  read_lock
 
class  sqlite_lock
 
class  write_lock
 
class  SessionInfo
 
struct  UserMetadata
 
struct  DBMetadata
 
struct  DBSummary
 
class  CommonFileOperations
 
class  SysCatalog
 

Typedefs

using sys_read_lock = read_lock< SysCatalog >
 
using cat_read_lock = read_lock< Catalog >
 
using cat_write_lock = write_lock< Catalog >
 
using cat_sqlite_lock = sqlite_lock< Catalog >
 
using sys_write_lock = write_lock< SysCatalog >
 
using sys_sqlite_lock = sqlite_lock< SysCatalog >
 
using DBSummaryList = std::list< DBSummary >
 
using TableDescriptorMap = std::map< std::string, TableDescriptor * >
 
using TableDescriptorMapById = std::map< int, TableDescriptor * >
 
using LogicalToPhysicalTableMapById = std::map< int32_t, std::vector< int32_t >>
 
using ColumnKey = std::tuple< int, std::string >
 
using ColumnDescriptorMap = std::map< ColumnKey, ColumnDescriptor * >
 
using ColumnIdKey = std::tuple< int, int >
 
using ColumnDescriptorMapById = std::map< ColumnIdKey, ColumnDescriptor * >
 
using DictDescriptorMapById = std::map< DictRef, std::unique_ptr< DictDescriptor >>
 
using DashboardDescriptorMap = std::map< std::string, std::shared_ptr< DashboardDescriptor >>
 
using LinkDescriptorMap = std::map< std::string, LinkDescriptor * >
 
using LinkDescriptorMapById = std::map< int, LinkDescriptor * >
 
using DeletedColumnPerTableMap = std::unordered_map< const TableDescriptor *, const ColumnDescriptor * >
 
using ForeignServerMap = std::map< std::string, std::shared_ptr< foreign_storage::ForeignServer >>
 
using ForeignServerMapById = std::map< int, std::shared_ptr< foreign_storage::ForeignServer >>
 
using CustomExpressionMapById = std::map< int, std::unique_ptr< CustomExpression >>
 

Enumerations

enum  DataSourceType { DataSourceType::TABLE = 0 }
 

Functions

const TableDescriptorlookupTableDescriptor (Catalog *cat, std::map< std::string, int > &cachedTableMap, std::string &curTableName)
 
void replaceTableName (std::map< std::string, int > &cachedTableMap, std::string &curTableName, std::string &newTableName, int tableId)
 
bool contains_spaces (std::string_view str)
 returns true if the string contains one or more spaces More...
 
bool contains_sql_reserved_chars (std::string_view str, std::string_view chars="`~!@#$%^&*()-=+[{]}\\|;:'\",<.>/?")
 returns true if the string contains one or more OmniSci SQL reserved characters More...
 
bool is_reserved_sql_keyword (std::string_view str)
 returns true if the string equals an OmniSci SQL reserved keyword More...
 
std::ostream & operator<< (std::ostream &os, const SessionInfo &session_info)
 
static bool parseUserMetadataFromSQLite (const std::unique_ptr< SqliteConnector > &conn, UserMetadata &user, int row)
 

Variables

const int DEFAULT_INITIAL_VERSION = 1
 
const int MAPD_TEMP_TABLE_START_ID
 
const int MAPD_TEMP_DICT_START_ID
 
bool g_log_user_id {false}
 

Typedef Documentation

Definition at line 114 of file Catalog.cpp.

Definition at line 116 of file Catalog.cpp.

Definition at line 115 of file Catalog.cpp.

Definition at line 38 of file Types.h.

Definition at line 40 of file Types.h.

using Catalog_Namespace::ColumnIdKey = typedef std::tuple<int, int>

Definition at line 39 of file Types.h.

using Catalog_Namespace::ColumnKey = typedef std::tuple<int, std::string>

Definition at line 37 of file Types.h.

using Catalog_Namespace::CustomExpressionMapById = typedef std::map<int, std::unique_ptr<CustomExpression>>

Definition at line 52 of file Types.h.

using Catalog_Namespace::DashboardDescriptorMap = typedef std::map<std::string, std::shared_ptr<DashboardDescriptor>>

Definition at line 43 of file Types.h.

using Catalog_Namespace::DBSummaryList = typedef std::list<DBSummary>

Definition at line 149 of file SysCatalog.h.

Definition at line 47 of file Types.h.

using Catalog_Namespace::DictDescriptorMapById = typedef std::map<DictRef, std::unique_ptr<DictDescriptor>>

Definition at line 41 of file Types.h.

using Catalog_Namespace::ForeignServerMap = typedef std::map<std::string, std::shared_ptr<foreign_storage::ForeignServer>>

Definition at line 49 of file Types.h.

using Catalog_Namespace::ForeignServerMapById = typedef std::map<int, std::shared_ptr<foreign_storage::ForeignServer>>

Definition at line 51 of file Types.h.

using Catalog_Namespace::LinkDescriptorMap = typedef std::map<std::string, LinkDescriptor*>

Definition at line 44 of file Types.h.

Definition at line 45 of file Types.h.

using Catalog_Namespace::LogicalToPhysicalTableMapById = typedef std::map<int32_t, std::vector<int32_t>>

Definition at line 36 of file Types.h.

Definition at line 113 of file Catalog.cpp.

Definition at line 122 of file SysCatalog.cpp.

Definition at line 121 of file SysCatalog.cpp.

using Catalog_Namespace::TableDescriptorMap = typedef std::map<std::string, TableDescriptor*>

Definition at line 34 of file Types.h.

Definition at line 35 of file Types.h.

Enumeration Type Documentation

Enumerator
TABLE 

Definition at line 22 of file CustomExpression.h.

22 { TABLE = 0 };
#define TABLE

Function Documentation

bool Catalog_Namespace::contains_spaces ( std::string_view  str)
inline

returns true if the string contains one or more spaces

Definition at line 4575 of file Catalog.cpp.

Referenced by Catalog_Namespace::Catalog::quoteIfRequired().

4575  {
4576  return std::find_if(str.begin(), str.end(), [](const unsigned char& ch) {
4577  return std::isspace(ch);
4578  }) != str.end();
4579 }

+ Here is the caller graph for this function:

bool Catalog_Namespace::contains_sql_reserved_chars ( std::string_view  str,
std::string_view  chars = "`~!@#$%^&*()-=+[{]}\\|;:'\",<.>/?" 
)
inline

returns true if the string contains one or more OmniSci SQL reserved characters

Definition at line 4582 of file Catalog.cpp.

Referenced by Catalog_Namespace::Catalog::quoteIfRequired().

4584  {]}\\|;:'\",<.>/?") {
4585  return str.find_first_of(chars) != std::string_view::npos;
4586 }

+ Here is the caller graph for this function:

bool Catalog_Namespace::is_reserved_sql_keyword ( std::string_view  str)
inline

returns true if the string equals an OmniSci SQL reserved keyword

Definition at line 4589 of file Catalog.cpp.

References reserved_keywords, and to_upper().

Referenced by Catalog_Namespace::Catalog::quoteIfRequired().

4589  {
4590  return reserved_keywords.find(to_upper(std::string(str))) != reserved_keywords.end();
4591 }
static std::set< std::string > reserved_keywords
std::string to_upper(const std::string &str)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const TableDescriptor* Catalog_Namespace::lookupTableDescriptor ( Catalog *  cat,
std::map< std::string, int > &  cachedTableMap,
std::string &  curTableName 
)

Definition at line 3716 of file Catalog.cpp.

References Catalog_Namespace::Catalog::getMetadataForTable().

Referenced by Catalog_Namespace::Catalog::renameTable().

3718  {
3719  auto iter = cachedTableMap.find(curTableName);
3720  if ((iter != cachedTableMap.end())) {
3721  // get the cached tableId
3722  // and use that to lookup the TableDescriptor
3723  int tableId = (*iter).second;
3724  if (tableId == -1)
3725  return NULL;
3726  else
3727  return cat->getMetadataForTable(tableId);
3728  }
3729 
3730  // else ... lookup in standard location
3731  return cat->getMetadataForTable(curTableName);
3732 }
std::string cat(Ts &&...args)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::ostream & Catalog_Namespace::operator<< ( std::ostream &  os,
const SessionInfo &  session_info 
)

Definition at line 53 of file SessionInfo.cpp.

References Catalog_Namespace::SessionInfo::get_public_session_id().

53  {
54  os << session_info.get_public_session_id();
55  return os;
56 }

+ Here is the call graph for this function:

static bool Catalog_Namespace::parseUserMetadataFromSQLite ( const std::unique_ptr< SqliteConnector > &  conn,
UserMetadata &  user,
int  row 
)
static

Definition at line 1393 of file SysCatalog.cpp.

References Catalog_Namespace::UserMetadata::can_login, Catalog_Namespace::UserMetadata::defaultDbId, g_log_user_id, Catalog_Namespace::UserMetadata::isSuper, LOG, Catalog_Namespace::UserMetadata::passwd_hash, Catalog_Namespace::UserMetadata::userId, Catalog_Namespace::UserMetadata::userLoggable(), Catalog_Namespace::UserMetadata::userName, and logger::WARNING.

Referenced by Catalog_Namespace::anonymous_namespace{SysCatalog.cpp}::get_users(), Catalog_Namespace::SysCatalog::getMetadataForUser(), and Catalog_Namespace::SysCatalog::getMetadataForUserById().

1395  {
1396  int numRows = conn->getNumRows();
1397  if (numRows == 0) {
1398  return false;
1399  }
1400  user.userId = conn->getData<int>(row, 0);
1401  user.userName = conn->getData<string>(row, 1);
1402  user.passwd_hash = conn->getData<string>(row, 2);
1403  user.isSuper = conn->getData<bool>(row, 3);
1404  user.defaultDbId = conn->isNull(row, 4) ? -1 : conn->getData<int>(row, 4);
1405  if (conn->isNull(row, 5)) {
1406  LOG(WARNING)
1407  << "User property 'can_login' not set for user " << user.userLoggable()
1408  << ". Disabling login ability. Set the users login ability with \"ALTER USER "
1409  << (g_log_user_id ? std::string("[username]") : user.userName)
1410  << " (can_login='true');\".";
1411  }
1412  user.can_login = conn->isNull(row, 5) ? false : conn->getData<bool>(row, 5);
1413  return true;
1414 }
#define LOG(tag)
Definition: Logger.h:203

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Catalog_Namespace::replaceTableName ( std::map< std::string, int > &  cachedTableMap,
std::string &  curTableName,
std::string &  newTableName,
int  tableId 
)

Definition at line 3734 of file Catalog.cpp.

Referenced by Catalog_Namespace::Catalog::renameTable().

3737  {
3738  // mark old/cur name as deleted
3739  cachedTableMap[curTableName] = -1;
3740 
3741  // insert the 'new' name
3742  cachedTableMap[newTableName] = tableId;
3743 }

+ Here is the caller graph for this function:

Variable Documentation

const int Catalog_Namespace::MAPD_TEMP_DICT_START_ID
Initial value:
=
1073741824

Definition at line 106 of file Catalog.cpp.

const int Catalog_Namespace::MAPD_TEMP_TABLE_START_ID
Initial value:
=
1073741824

Definition at line 104 of file Catalog.cpp.