OmniSciDB  d2f719934e
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DBHandler.cpp File Reference
#include "DBHandler.h"
#include "DistributedLoader.h"
#include "TokenCompletionHints.h"
#include "MapDRelease.h"
#include "Calcite/Calcite.h"
#include "gen-cpp/CalciteServer.h"
#include "QueryEngine/ErrorHandling.h"
#include "QueryEngine/RelAlgExecutor.h"
#include "Catalog/Catalog.h"
#include "Catalog/DdlCommandExecutor.h"
#include "DataMgr/ForeignStorage/ArrowForeignStorage.h"
#include "DataMgr/ForeignStorage/DummyForeignStorage.h"
#include "DistributedHandler.h"
#include "Fragmenter/InsertOrderFragmenter.h"
#include "Geospatial/Compression.h"
#include "Geospatial/GDAL.h"
#include "Geospatial/Transforms.h"
#include "Geospatial/Types.h"
#include "ImportExport/DistributedForeignDataImporter.h"
#include "ImportExport/Importer.h"
#include "LockMgr/LockMgr.h"
#include "OSDependent/omnisci_hostname.h"
#include "Parser/ParserWrapper.h"
#include "Parser/ReservedKeywords.h"
#include "Parser/parser.h"
#include "QueryEngine/ArrowResultSet.h"
#include "QueryEngine/CalciteAdapter.h"
#include "QueryEngine/Execute.h"
#include "QueryEngine/ExtensionFunctionsWhitelist.h"
#include "QueryEngine/GpuMemUtils.h"
#include "QueryEngine/JoinFilterPushDown.h"
#include "QueryEngine/JsonAccessors.h"
#include "QueryEngine/QueryDispatchQueue.h"
#include "QueryEngine/ResultSetBuilder.h"
#include "QueryEngine/TableFunctions/TableFunctionsFactory.h"
#include "QueryEngine/TableOptimizer.h"
#include "QueryEngine/ThriftSerializers.h"
#include "Shared/ArrowUtil.h"
#include "Shared/StringTransform.h"
#include "Shared/file_path_util.h"
#include "Shared/import_helpers.h"
#include "Shared/mapd_shared_mutex.h"
#include "Shared/measure.h"
#include "Shared/scope.h"
#include "UdfCompiler/UdfCompiler.h"
#include <fcntl.h>
#include <picosha2.h>
#include <sys/types.h>
#include <algorithm>
#include <boost/algorithm/string.hpp>
#include <boost/filesystem.hpp>
#include <boost/make_shared.hpp>
#include <boost/process/search_path.hpp>
#include <boost/program_options.hpp>
#include <boost/regex.hpp>
#include <boost/tokenizer.hpp>
#include <cmath>
#include <csignal>
#include <fstream>
#include <future>
#include <map>
#include <memory>
#include <random>
#include <regex>
#include <string>
#include <thread>
#include <typeinfo>
#include <arrow/api.h>
#include <arrow/io/api.h>
#include <arrow/ipc/api.h>

Go to the source code of this file.

Classes

struct  anonymous_namespace{DBHandler.cpp}::ForceDisconnect
 
struct  anonymous_namespace{DBHandler.cpp}::ProjectionTokensForCompletion
 

Namespaces

 anonymous_namespace{DBHandler.cpp}
 

Macros

#define ENABLE_GEO_IMPORT_COLUMN_MATCHING   0
 
#define INVALID_SESSION_ID   ""
 
#define THROW_MAPD_EXCEPTION(errstr)
 
#define ARROW_THRIFT_THROW_NOT_OK(s)
 
#define THROW_COLUMN_ATTR_MISMATCH_EXCEPTION(attr, got, expected)
 
#define EXPOSE_THRIFT_MAP(TYPENAME)
 

Typedefs

using RecordBatchVector = std::vector< std::shared_ptr< arrow::RecordBatch >>
 

Functions

SessionMap::iterator anonymous_namespace{DBHandler.cpp}::get_session_from_map (const TSessionId &session, SessionMap &session_map)
 
ProjectionTokensForCompletion anonymous_namespace{DBHandler.cpp}::extract_projection_tokens_for_completion (const std::string &sql)
 
static TDBObject serialize_db_object (const std::string &roleName, const DBObject &inObject)
 
std::string anonymous_namespace{DBHandler.cpp}::dump_table_col_names (const std::map< std::string, std::vector< std::string >> &table_col_names)
 
void anonymous_namespace{DBHandler.cpp}::check_table_not_sharded (const TableDescriptor *td)
 
void anonymous_namespace{DBHandler.cpp}::check_valid_column_names (const std::list< const ColumnDescriptor * > &descs, const std::vector< std::string > &column_names)
 
std::vector< int > anonymous_namespace{DBHandler.cpp}::column_ids_by_names (const std::list< const ColumnDescriptor * > &descs, const std::vector< std::string > &column_names)
 
size_t anonymous_namespace{DBHandler.cpp}::get_column_size (const TColumn &column)
 
RecordBatchVector anonymous_namespace{DBHandler.cpp}::loadArrowStream (const std::string &stream)
 
void anonymous_namespace{DBHandler.cpp}::add_vsi_network_prefix (std::string &path)
 
void anonymous_namespace{DBHandler.cpp}::add_vsi_geo_prefix (std::string &path)
 
void anonymous_namespace{DBHandler.cpp}::add_vsi_archive_prefix (std::string &path)
 
std::string anonymous_namespace{DBHandler.cpp}::remove_vsi_prefixes (const std::string &path_in)
 
bool anonymous_namespace{DBHandler.cpp}::path_is_relative (const std::string &path)
 
bool anonymous_namespace{DBHandler.cpp}::path_has_valid_filename (const std::string &path)
 
bool anonymous_namespace{DBHandler.cpp}::is_a_supported_geo_file (const std::string &path)
 
bool anonymous_namespace{DBHandler.cpp}::is_a_supported_archive_file (const std::string &path)
 
std::string anonymous_namespace{DBHandler.cpp}::find_first_geo_file_in_archive (const std::string &archive_path, const import_export::CopyParams &copy_params)
 
bool anonymous_namespace{DBHandler.cpp}::is_local_file (const std::string &file_path)
 
void anonymous_namespace{DBHandler.cpp}::validate_import_file_path_if_local (const std::string &file_path)
 
static bool is_allowed_on_dashboard (const Catalog_Namespace::SessionInfo &session_info, int32_t dashboard_id, AccessPrivileges requestedPermissions)
 
std::unique_ptr
< Catalog_Namespace::CustomExpression
anonymous_namespace{DBHandler.cpp}::create_custom_expr_from_thrift_obj (const TCustomExpression &t_custom_expr, const Catalog &catalog)
 
TCustomExpression anonymous_namespace{DBHandler.cpp}::create_thrift_obj_from_custom_expr (const CustomExpression &custom_expr, const Catalog &catalog)
 
bool anonymous_namespace{DBHandler.cpp}::is_info_schema_db (const std::string &db_name)
 
void anonymous_namespace{DBHandler.cpp}::check_not_info_schema_db (const std::string &db_name, bool throw_mapd_exception=false)
 
bool anonymous_namespace{DBHandler.cpp}::TTypeInfo_IsGeo (const TDatumType::type &t)
 
std::map< std::string,
std::string > 
get_device_parameters (bool cpu_only)
 
static std::unique_ptr
< RexLiteral
genLiteralStr (std::string val)
 

Variables

bool g_enable_system_tables
 
bool g_allow_system_dashboard_update {false}
 
std::mutex register_runtime_extension_functions_mutex
 

Macro Definition Documentation

#define ARROW_THRIFT_THROW_NOT_OK (   s)
Value:
do { \
::arrow::Status _s = (s); \
if (UNLIKELY(!_s.ok())) { \
TOmniSciException ex; \
ex.error_msg = _s.ToString(); \
LOG(ERROR) << s.ToString(); \
throw ex; \
} \
} while (0)
#define LOG(tag)
Definition: Logger.h:205
#define UNLIKELY(x)
Definition: likely.h:25
if(yyssp >=yyss+yystacksize-1)

Definition at line 3318 of file DBHandler.cpp.

Referenced by anonymous_namespace{DBHandler.cpp}::loadArrowStream().

#define ENABLE_GEO_IMPORT_COLUMN_MATCHING   0

Definition at line 110 of file DBHandler.cpp.

#define EXPOSE_THRIFT_MAP (   TYPENAME)
Value:
{ \
std::map<int, const char*>::const_iterator it = \
_##TYPENAME##_VALUES_TO_NAMES.begin(); \
while (it != _##TYPENAME##_VALUES_TO_NAMES.end()) { \
_return.insert(std::pair<std::string, std::string>( \
#TYPENAME "." + std::string(it->second), std::to_string(it->first))); \
it++; \
} \
}
std::string to_string(char const *&&v)

Definition at line 7240 of file DBHandler.cpp.

Referenced by DBHandler::get_device_parameters().

#define INVALID_SESSION_ID   ""

Definition at line 126 of file DBHandler.cpp.

Referenced by DBHandler::getInvalidSessionId().

#define THROW_COLUMN_ATTR_MISMATCH_EXCEPTION (   attr,
  got,
  expected 
)
Value:
THROW_MAPD_EXCEPTION("Could not append geo/raster file '" + \
file_path.filename().string() + "' to table '" + table_name + \
"'. Column '" + cd->columnName + "' " + attr + \
" mismatch (got '" + got + "', expected '" + expected + "')");
#define THROW_MAPD_EXCEPTION(errstr)
Definition: DBHandler.cpp:128

Definition at line 5017 of file DBHandler.cpp.

Referenced by DBHandler::import_geo_table_internal().

#define THROW_MAPD_EXCEPTION (   errstr)
Value:
{ \
TOmniSciException ex; \
ex.error_msg = errstr; \
LOG(ERROR) << ex.error_msg; \
throw ex; \
}
#define LOG(tag)
Definition: Logger.h:205

Definition at line 128 of file DBHandler.cpp.

Referenced by anonymous_namespace{DBHandler.cpp}::add_vsi_network_prefix(), DBHandler::broadcast_serialized_rows(), anonymous_namespace{DBHandler.cpp}::check_not_info_schema_db(), DBHandler::check_read_only(), DBHandler::check_table_consistency(), DBHandler::check_table_load_privileges(), anonymous_namespace{DBHandler.cpp}::check_valid_column_names(), DBHandler::clear_cpu_memory(), DBHandler::clear_gpu_memory(), DBHandler::clearRenderMemory(), DBHandler::clone_session(), anonymous_namespace{DBHandler.cpp}::column_ids_by_names(), DBHandler::connect(), DBHandler::connect_impl(), DBHandler::convertRows(), anonymous_namespace{DBHandler.cpp}::create_custom_expr_from_thrift_obj(), DBHandler::create_custom_expression(), DBHandler::create_dashboard(), DBHandler::create_link(), DBHandler::create_table(), DBHandler::delete_custom_expressions(), DBHandler::delete_dashboards(), DBHandler::detect_column_types(), DBHandler::execute_next_render_step(), DBHandler::execute_query_step(), DBHandler::fillGeoColumns(), DBHandler::get_all_files_in_archive(), DBHandler::get_dashboard(), DBHandler::get_dashboard_grantees(), DBHandler::get_db_object_privs(), DBHandler::get_db_objects_for_grantee(), DBHandler::get_first_geo_file_in_archive(), DBHandler::get_heap_profile(), DBHandler::get_layers_in_geo_file(), DBHandler::get_link_view(), DBHandler::get_result_row_for_pixel(), anonymous_namespace{DBHandler.cpp}::get_session_from_map(), DBHandler::get_session_it_unsafe(), DBHandler::get_table_details_impl(), DBHandler::get_table_epoch(), DBHandler::get_table_epoch_by_name(), DBHandler::get_tables_meta(), DBHandler::get_tables_meta_impl(), DBHandler::get_valid_groups(), DBHandler::getAllRolesForUserImpl(), DBHandler::has_dashboard_permission(), DBHandler::has_database_permission(), DBHandler::has_object_privilege(), DBHandler::has_role(), DBHandler::has_table_permission(), DBHandler::has_view_permission(), DBHandler::import_geo_table_internal(), DBHandler::import_table(), DBHandler::initialize(), DBHandler::insert_data(), DBHandler::internal_connect(), DBHandler::krb5_connect(), DBHandler::load_table(), DBHandler::load_table_binary(), DBHandler::load_table_binary_arrow(), DBHandler::load_table_binary_columnar_internal(), DBHandler::populateThriftColumnType(), DBHandler::prepare_loader_generic(), DBHandler::query_get_outer_fragment_count(), DBHandler::register_runtime_extension_functions(), DBHandler::render_vega(), DBHandler::replace_dashboard(), DBHandler::set_license_key(), DBHandler::set_table_epoch(), DBHandler::set_table_epoch_by_name(), DBHandler::set_table_epochs(), DBHandler::shareOrUnshareDashboards(), DBHandler::sql_execute(), DBHandler::sql_execute_df(), DBHandler::sql_execute_impl(), DBHandler::sql_validate(), DBHandler::start_heap_profile(), DBHandler::start_query(), DBHandler::start_render_query(), DBHandler::stop_heap_profile(), DBHandler::switch_database(), DBHandler::thrift_to_copyparams(), DBHandler::update_custom_expression(), DBHandler::validateDashboardIdsForSharing(), and DBHandler::validateGroups().

Typedef Documentation

using RecordBatchVector = std::vector<std::shared_ptr<arrow::RecordBatch>>

Definition at line 3316 of file DBHandler.cpp.

Function Documentation

static std::unique_ptr<RexLiteral> genLiteralStr ( std::string  val)
static

Definition at line 7369 of file DBHandler.cpp.

References kTEXT.

Referenced by anonymous_namespace{DdlCommandExecutor.cpp}::add_table_details(), ShowForeignServersCommand::execute(), ShowTablesCommand::execute(), ShowDatabasesCommand::execute(), ShowDiskCacheUsageCommand::execute(), ShowUserDetailsCommand::execute(), ShowRolesCommand::execute(), DBHandler::getQueries(), and DBHandler::getUserSessions().

7369  {
7370  return std::unique_ptr<RexLiteral>(
7371  new RexLiteral(val, SQLTypes::kTEXT, SQLTypes::kTEXT, 0, 0, 0, 0));
7372 }
Definition: sqltypes.h:52

+ Here is the caller graph for this function:

std::map<std::string, std::string> get_device_parameters ( bool  cpu_only)

Definition at line 914 of file NativeCodegen.cpp.

914  {
915  std::map<std::string, std::string> result;
916 
917  result.insert(std::make_pair("cpu_name", llvm::sys::getHostCPUName()));
918  result.insert(std::make_pair("cpu_triple", llvm::sys::getProcessTriple()));
919  result.insert(
920  std::make_pair("cpu_cores", std::to_string(llvm::sys::getHostNumPhysicalCores())));
921  result.insert(std::make_pair("cpu_threads", std::to_string(cpu_threads())));
922 
923  // https://en.cppreference.com/w/cpp/language/types
924  std::string sizeof_types;
925  sizeof_types += "bool:" + std::to_string(sizeof(bool)) + ";";
926  sizeof_types += "size_t:" + std::to_string(sizeof(size_t)) + ";";
927  sizeof_types += "ssize_t:" + std::to_string(sizeof(ssize_t)) + ";";
928  sizeof_types += "char:" + std::to_string(sizeof(char)) + ";";
929  sizeof_types += "uchar:" + std::to_string(sizeof(unsigned char)) + ";";
930  sizeof_types += "short:" + std::to_string(sizeof(short)) + ";";
931  sizeof_types += "ushort:" + std::to_string(sizeof(unsigned short int)) + ";";
932  sizeof_types += "int:" + std::to_string(sizeof(int)) + ";";
933  sizeof_types += "uint:" + std::to_string(sizeof(unsigned int)) + ";";
934  sizeof_types += "long:" + std::to_string(sizeof(long int)) + ";";
935  sizeof_types += "ulong:" + std::to_string(sizeof(unsigned long int)) + ";";
936  sizeof_types += "longlong:" + std::to_string(sizeof(long long int)) + ";";
937  sizeof_types += "ulonglong:" + std::to_string(sizeof(unsigned long long int)) + ";";
938  sizeof_types += "float:" + std::to_string(sizeof(float)) + ";";
939  sizeof_types += "double:" + std::to_string(sizeof(double)) + ";";
940  sizeof_types += "longdouble:" + std::to_string(sizeof(long double)) + ";";
941  sizeof_types += "voidptr:" + std::to_string(sizeof(void*)) + ";";
942 
943  result.insert(std::make_pair("type_sizeof", sizeof_types));
944 
945  std::string null_values;
946  null_values += "boolean1:" + std::to_string(serialized_null_value<bool>()) + ";";
947  null_values += "boolean8:" + std::to_string(serialized_null_value<int8_t>()) + ";";
948  null_values += "int8:" + std::to_string(serialized_null_value<int8_t>()) + ";";
949  null_values += "int16:" + std::to_string(serialized_null_value<int16_t>()) + ";";
950  null_values += "int32:" + std::to_string(serialized_null_value<int32_t>()) + ";";
951  null_values += "int64:" + std::to_string(serialized_null_value<int64_t>()) + ";";
952  null_values += "uint8:" + std::to_string(serialized_null_value<uint8_t>()) + ";";
953  null_values += "uint16:" + std::to_string(serialized_null_value<uint16_t>()) + ";";
954  null_values += "uint32:" + std::to_string(serialized_null_value<uint32_t>()) + ";";
955  null_values += "uint64:" + std::to_string(serialized_null_value<uint64_t>()) + ";";
956  null_values += "float32:" + std::to_string(serialized_null_value<float>()) + ";";
957  null_values += "float64:" + std::to_string(serialized_null_value<double>()) + ";";
958  null_values +=
959  "Array<boolean8>:" + std::to_string(serialized_null_value<int8_t, true>()) + ";";
960  null_values +=
961  "Array<int8>:" + std::to_string(serialized_null_value<int8_t, true>()) + ";";
962  null_values +=
963  "Array<int16>:" + std::to_string(serialized_null_value<int16_t, true>()) + ";";
964  null_values +=
965  "Array<int32>:" + std::to_string(serialized_null_value<int32_t, true>()) + ";";
966  null_values +=
967  "Array<int64>:" + std::to_string(serialized_null_value<int64_t, true>()) + ";";
968  null_values +=
969  "Array<float32>:" + std::to_string(serialized_null_value<float, true>()) + ";";
970  null_values +=
971  "Array<float64>:" + std::to_string(serialized_null_value<double, true>()) + ";";
972 
973  result.insert(std::make_pair("null_values", null_values));
974 
975  llvm::StringMap<bool> cpu_features;
976  if (llvm::sys::getHostCPUFeatures(cpu_features)) {
977  std::string features_str = "";
978  for (auto it = cpu_features.begin(); it != cpu_features.end(); ++it) {
979  features_str += (it->getValue() ? " +" : " -");
980  features_str += it->getKey().str();
981  }
982  result.insert(std::make_pair("cpu_features", features_str));
983  }
984 
985  result.insert(std::make_pair("llvm_version",
986  std::to_string(LLVM_VERSION_MAJOR) + "." +
987  std::to_string(LLVM_VERSION_MINOR) + "." +
988  std::to_string(LLVM_VERSION_PATCH)));
989 
990 #ifdef HAVE_CUDA
991  if (!cpu_only) {
992  int device_count = 0;
993  checkCudaErrors(cuDeviceGetCount(&device_count));
994  if (device_count) {
995  CUdevice device{};
996  char device_name[256];
997  int major = 0, minor = 0;
998  int driver_version;
999  checkCudaErrors(cuDeviceGet(&device, 0)); // assuming homogeneous multi-GPU system
1000  checkCudaErrors(cuDeviceGetName(device_name, 256, device));
1001  checkCudaErrors(cuDeviceGetAttribute(
1002  &major, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, device));
1003  checkCudaErrors(cuDeviceGetAttribute(
1004  &minor, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR, device));
1005  checkCudaErrors(cuDriverGetVersion(&driver_version));
1006 
1007  result.insert(std::make_pair("gpu_name", device_name));
1008  result.insert(std::make_pair("gpu_count", std::to_string(device_count)));
1009  result.insert(std::make_pair("gpu_compute_capability",
1010  std::to_string(major) + "." + std::to_string(minor)));
1011  result.insert(std::make_pair("gpu_triple", get_gpu_target_triple_string()));
1012  result.insert(std::make_pair("gpu_datalayout", get_gpu_data_layout()));
1013  result.insert(std::make_pair("gpu_driver",
1014  "CUDA " + std::to_string(driver_version / 1000) + "." +
1015  std::to_string((driver_version % 1000) / 10)));
1016  }
1017  }
1018 #endif
1019 
1020  return result;
1021 }
void checkCudaErrors(CUresult err)
Definition: sample.cpp:38
llvm::StringRef get_gpu_data_layout()
std::string to_string(char const *&&v)
llvm::StringRef get_gpu_target_triple_string()
int CUdevice
Definition: nocuda.h:20
int cpu_threads()
Definition: thread_count.h:24
static bool is_allowed_on_dashboard ( const Catalog_Namespace::SessionInfo session_info,
int32_t  dashboard_id,
AccessPrivileges  requestedPermissions 
)
static

Definition at line 4220 of file DBHandler.cpp.

References DashboardDBObjectType, Catalog_Namespace::SessionInfo::get_currentUser(), and Catalog_Namespace::SessionInfo::getCatalog().

Referenced by DBHandler::get_dashboard(), DBHandler::get_dashboards(), and DBHandler::replace_dashboard().

4222  {
4223  DBObject object(dashboard_id, DashboardDBObjectType);
4224  auto& catalog = session_info.getCatalog();
4225  auto& user = session_info.get_currentUser();
4226  object.loadKey(catalog);
4227  object.setPrivileges(requestedPermissions);
4228  std::vector<DBObject> privs = {object};
4229  return SysCatalog::instance().checkPrivileges(user, privs);
4230 }
Catalog & getCatalog() const
Definition: SessionInfo.h:67
const UserMetadata & get_currentUser() const
Definition: SessionInfo.h:73

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static TDBObject serialize_db_object ( const std::string &  roleName,
const DBObject inObject 
)
static

Definition at line 1839 of file DBHandler.cpp.

References DatabasePrivileges::ACCESS, ServerPrivileges::ALTER_SERVER, TablePrivileges::ALTER_TABLE, CHECK, DashboardPrivileges::CREATE_DASHBOARD, DatabasePrivileges::CREATE_DATABASE, ServerPrivileges::CREATE_SERVER, TablePrivileges::CREATE_TABLE, ViewPrivileges::CREATE_VIEW, DashboardDBObjectType, DatabaseDBObjectType, DashboardPrivileges::DELETE_DASHBOARD, TablePrivileges::DELETE_FROM_TABLE, ViewPrivileges::DELETE_FROM_VIEW, DatabasePrivileges::DROP_DATABASE, ServerPrivileges::DROP_SERVER, TablePrivileges::DROP_TABLE, ViewPrivileges::DROP_VIEW, DashboardPrivileges::EDIT_DASHBOARD, DBObject::getName(), DBObject::getObjectKey(), DBObject::getPrivileges(), DBObject::getType(), TablePrivileges::INSERT_INTO_TABLE, ViewPrivileges::INSERT_INTO_VIEW, DBObjectKey::objectId, DBObjectKey::permissionType, TablePrivileges::SELECT_FROM_TABLE, ViewPrivileges::SELECT_FROM_VIEW, ServerPrivileges::SERVER_USAGE, ServerDBObjectType, TableDBObjectType, TablePrivileges::TRUNCATE_TABLE, run_benchmark_import::type, TablePrivileges::UPDATE_IN_TABLE, ViewPrivileges::UPDATE_IN_VIEW, DashboardPrivileges::VIEW_DASHBOARD, DatabasePrivileges::VIEW_SQL_EDITOR, and ViewDBObjectType.

Referenced by DBHandler::get_db_object_privs(), and DBHandler::get_db_objects_for_grantee().

1840  {
1841  TDBObject outObject;
1842  outObject.objectName = inObject.getName();
1843  outObject.grantee = roleName;
1844  outObject.objectId = inObject.getObjectKey().objectId;
1845  const auto ap = inObject.getPrivileges();
1846  switch (inObject.getObjectKey().permissionType) {
1847  case DatabaseDBObjectType:
1848  outObject.privilegeObjectType = TDBObjectType::DatabaseDBObjectType;
1849  outObject.privs.push_back(ap.hasPermission(DatabasePrivileges::CREATE_DATABASE));
1850  outObject.privs.push_back(ap.hasPermission(DatabasePrivileges::DROP_DATABASE));
1851  outObject.privs.push_back(ap.hasPermission(DatabasePrivileges::VIEW_SQL_EDITOR));
1852  outObject.privs.push_back(ap.hasPermission(DatabasePrivileges::ACCESS));
1853 
1854  break;
1855  case TableDBObjectType:
1856  outObject.privilegeObjectType = TDBObjectType::TableDBObjectType;
1857  outObject.privs.push_back(ap.hasPermission(TablePrivileges::CREATE_TABLE));
1858  outObject.privs.push_back(ap.hasPermission(TablePrivileges::DROP_TABLE));
1859  outObject.privs.push_back(ap.hasPermission(TablePrivileges::SELECT_FROM_TABLE));
1860  outObject.privs.push_back(ap.hasPermission(TablePrivileges::INSERT_INTO_TABLE));
1861  outObject.privs.push_back(ap.hasPermission(TablePrivileges::UPDATE_IN_TABLE));
1862  outObject.privs.push_back(ap.hasPermission(TablePrivileges::DELETE_FROM_TABLE));
1863  outObject.privs.push_back(ap.hasPermission(TablePrivileges::TRUNCATE_TABLE));
1864  outObject.privs.push_back(ap.hasPermission(TablePrivileges::ALTER_TABLE));
1865 
1866  break;
1867  case DashboardDBObjectType:
1868  outObject.privilegeObjectType = TDBObjectType::DashboardDBObjectType;
1869  outObject.privs.push_back(ap.hasPermission(DashboardPrivileges::CREATE_DASHBOARD));
1870  outObject.privs.push_back(ap.hasPermission(DashboardPrivileges::DELETE_DASHBOARD));
1871  outObject.privs.push_back(ap.hasPermission(DashboardPrivileges::VIEW_DASHBOARD));
1872  outObject.privs.push_back(ap.hasPermission(DashboardPrivileges::EDIT_DASHBOARD));
1873 
1874  break;
1875  case ViewDBObjectType:
1876  outObject.privilegeObjectType = TDBObjectType::ViewDBObjectType;
1877  outObject.privs.push_back(ap.hasPermission(ViewPrivileges::CREATE_VIEW));
1878  outObject.privs.push_back(ap.hasPermission(ViewPrivileges::DROP_VIEW));
1879  outObject.privs.push_back(ap.hasPermission(ViewPrivileges::SELECT_FROM_VIEW));
1880  outObject.privs.push_back(ap.hasPermission(ViewPrivileges::INSERT_INTO_VIEW));
1881  outObject.privs.push_back(ap.hasPermission(ViewPrivileges::UPDATE_IN_VIEW));
1882  outObject.privs.push_back(ap.hasPermission(ViewPrivileges::DELETE_FROM_VIEW));
1883 
1884  break;
1885  case ServerDBObjectType:
1886  outObject.privilegeObjectType = TDBObjectType::ServerDBObjectType;
1887  outObject.privs.push_back(ap.hasPermission(ServerPrivileges::CREATE_SERVER));
1888  outObject.privs.push_back(ap.hasPermission(ServerPrivileges::DROP_SERVER));
1889  outObject.privs.push_back(ap.hasPermission(ServerPrivileges::ALTER_SERVER));
1890  outObject.privs.push_back(ap.hasPermission(ServerPrivileges::SERVER_USAGE));
1891 
1892  break;
1893  default:
1894  CHECK(false);
1895  }
1896  const int type_val = static_cast<int>(inObject.getType());
1897  CHECK(type_val >= 0 && type_val < 6);
1898  outObject.objectType = static_cast<TDBObjectType::type>(type_val);
1899  return outObject;
1900 }
static const int32_t SERVER_USAGE
Definition: DBObject.h:131
static const int32_t DROP_VIEW
Definition: DBObject.h:115
static const int32_t ALTER_SERVER
Definition: DBObject.h:130
DBObjectKey getObjectKey() const
Definition: DBObject.h:223
static const int32_t SELECT_FROM_VIEW
Definition: DBObject.h:116
static const int32_t UPDATE_IN_VIEW
Definition: DBObject.h:118
static const int32_t CREATE_VIEW
Definition: DBObject.h:114
int32_t objectId
Definition: DBObject.h:57
static const int32_t ALTER_TABLE
Definition: DBObject.h:95
static const int32_t DROP_DATABASE
Definition: DBObject.h:81
static const int32_t DELETE_FROM_TABLE
Definition: DBObject.h:93
static const int32_t TRUNCATE_TABLE
Definition: DBObject.h:94
std::string getName() const
Definition: DBObject.h:221
static const int32_t EDIT_DASHBOARD
Definition: DBObject.h:106
static const int32_t DELETE_DASHBOARD
Definition: DBObject.h:104
static const int32_t INSERT_INTO_TABLE
Definition: DBObject.h:91
DBObjectType getType() const
Definition: DBObject.h:222
static const int32_t CREATE_SERVER
Definition: DBObject.h:128
const AccessPrivileges & getPrivileges() const
Definition: DBObject.h:228
static const int32_t ACCESS
Definition: DBObject.h:83
static const int32_t CREATE_DATABASE
Definition: DBObject.h:80
static const int32_t VIEW_DASHBOARD
Definition: DBObject.h:105
static const int32_t VIEW_SQL_EDITOR
Definition: DBObject.h:82
static const int32_t DROP_TABLE
Definition: DBObject.h:89
static const int32_t INSERT_INTO_VIEW
Definition: DBObject.h:117
#define CHECK(condition)
Definition: Logger.h:211
static const int32_t DELETE_FROM_VIEW
Definition: DBObject.h:119
static const int32_t CREATE_TABLE
Definition: DBObject.h:88
static const int32_t CREATE_DASHBOARD
Definition: DBObject.h:103
int32_t permissionType
Definition: DBObject.h:55
static const int32_t SELECT_FROM_TABLE
Definition: DBObject.h:90
static const int32_t UPDATE_IN_TABLE
Definition: DBObject.h:92
static const int32_t DROP_SERVER
Definition: DBObject.h:129

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

bool g_allow_system_dashboard_update {false}
bool g_enable_system_tables

Definition at line 65 of file SysCatalog.cpp.

std::mutex register_runtime_extension_functions_mutex

Definition at line 7265 of file DBHandler.cpp.