OmniSciDB  8fa3bf436f
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DBHandler.cpp File Reference
#include "DBHandler.h"
#include "DistributedLoader.h"
#include "QueryEngine/UDFCompiler.h"
#include "TokenCompletionHints.h"
#include "MapDRelease.h"
#include "Calcite/Calcite.h"
#include "gen-cpp/CalciteServer.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/GDAL.h"
#include "Geospatial/Transforms.h"
#include "Geospatial/Types.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/import_helpers.h"
#include "Shared/mapd_shared_mutex.h"
#include "Shared/measure.h"
#include "Shared/scope.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 include_gz)
 
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)
 
TCustomExpression anonymous_namespace{DBHandler.cpp}::create_thrift_obj_from_custom_expr (const CustomExpression &custom_expr)
 
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)
 

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:194
#define UNLIKELY(x)
Definition: likely.h:25
if(yyssp >=yyss+yystacksize-1)

Definition at line 3127 of file DBHandler.cpp.

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

#define ENABLE_GEO_IMPORT_COLUMN_MATCHING   0

Definition at line 103 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 6686 of file DBHandler.cpp.

Referenced by DBHandler::get_device_parameters().

#define INVALID_SESSION_ID   ""

Definition at line 108 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 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:110

Definition at line 4659 of file DBHandler.cpp.

Referenced by DBHandler::import_geo_table().

#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:194

Definition at line 110 of file DBHandler.cpp.

Referenced by anonymous_namespace{DBHandler.cpp}::add_vsi_network_prefix(), DBHandler::broadcast_serialized_rows(), 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::clone_session(), anonymous_namespace{DBHandler.cpp}::column_ids_by_names(), DBHandler::connect(), DBHandler::connect_impl(), DBHandler::convertRows(), 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::get_all_files_in_archive(), DBHandler::get_all_roles_for_user(), 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::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(), 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 3125 of file DBHandler.cpp.

Function Documentation

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

Definition at line 6799 of file DBHandler.cpp.

References kTEXT.

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

6799  {
6800  return std::unique_ptr<RexLiteral>(
6801  new RexLiteral(val, SQLTypes::kTEXT, SQLTypes::kTEXT, 0, 0, 0, 0));
6802 }
Definition: sqltypes.h:51

+ Here is the caller graph for this function:

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

Definition at line 866 of file NativeCodegen.cpp.

866  {
867  std::map<std::string, std::string> result;
868 
869  result.insert(std::make_pair("cpu_name", llvm::sys::getHostCPUName()));
870  result.insert(std::make_pair("cpu_triple", llvm::sys::getProcessTriple()));
871  result.insert(
872  std::make_pair("cpu_cores", std::to_string(llvm::sys::getHostNumPhysicalCores())));
873  result.insert(std::make_pair("cpu_threads", std::to_string(cpu_threads())));
874 
875  // https://en.cppreference.com/w/cpp/language/types
876  std::string sizeof_types;
877  sizeof_types += "bool:" + std::to_string(sizeof(bool)) + ";";
878  sizeof_types += "size_t:" + std::to_string(sizeof(size_t)) + ";";
879  sizeof_types += "ssize_t:" + std::to_string(sizeof(ssize_t)) + ";";
880  sizeof_types += "char:" + std::to_string(sizeof(char)) + ";";
881  sizeof_types += "uchar:" + std::to_string(sizeof(unsigned char)) + ";";
882  sizeof_types += "short:" + std::to_string(sizeof(short)) + ";";
883  sizeof_types += "ushort:" + std::to_string(sizeof(unsigned short int)) + ";";
884  sizeof_types += "int:" + std::to_string(sizeof(int)) + ";";
885  sizeof_types += "uint:" + std::to_string(sizeof(unsigned int)) + ";";
886  sizeof_types += "long:" + std::to_string(sizeof(long int)) + ";";
887  sizeof_types += "ulong:" + std::to_string(sizeof(unsigned long int)) + ";";
888  sizeof_types += "longlong:" + std::to_string(sizeof(long long int)) + ";";
889  sizeof_types += "ulonglong:" + std::to_string(sizeof(unsigned long long int)) + ";";
890  sizeof_types += "float:" + std::to_string(sizeof(float)) + ";";
891  sizeof_types += "double:" + std::to_string(sizeof(double)) + ";";
892  sizeof_types += "longdouble:" + std::to_string(sizeof(long double)) + ";";
893  sizeof_types += "voidptr:" + std::to_string(sizeof(void*)) + ";";
894 
895  result.insert(std::make_pair("type_sizeof", sizeof_types));
896 
897  std::string null_values;
898  null_values += "boolean1:" + std::to_string(serialized_null_value<bool>()) + ";";
899  null_values += "boolean8:" + std::to_string(serialized_null_value<int8_t>()) + ";";
900  null_values += "int8:" + std::to_string(serialized_null_value<int8_t>()) + ";";
901  null_values += "int16:" + std::to_string(serialized_null_value<int16_t>()) + ";";
902  null_values += "int32:" + std::to_string(serialized_null_value<int32_t>()) + ";";
903  null_values += "int64:" + std::to_string(serialized_null_value<int64_t>()) + ";";
904  null_values += "uint8:" + std::to_string(serialized_null_value<uint8_t>()) + ";";
905  null_values += "uint16:" + std::to_string(serialized_null_value<uint16_t>()) + ";";
906  null_values += "uint32:" + std::to_string(serialized_null_value<uint32_t>()) + ";";
907  null_values += "uint64:" + std::to_string(serialized_null_value<uint64_t>()) + ";";
908  null_values += "float32:" + std::to_string(serialized_null_value<float>()) + ";";
909  null_values += "float64:" + std::to_string(serialized_null_value<double>()) + ";";
910  null_values +=
911  "Array<boolean8>:" + std::to_string(serialized_null_value<int8_t, true>()) + ";";
912  null_values +=
913  "Array<int8>:" + std::to_string(serialized_null_value<int8_t, true>()) + ";";
914  null_values +=
915  "Array<int16>:" + std::to_string(serialized_null_value<int16_t, true>()) + ";";
916  null_values +=
917  "Array<int32>:" + std::to_string(serialized_null_value<int32_t, true>()) + ";";
918  null_values +=
919  "Array<int64>:" + std::to_string(serialized_null_value<int64_t, true>()) + ";";
920  null_values +=
921  "Array<float32>:" + std::to_string(serialized_null_value<float, true>()) + ";";
922  null_values +=
923  "Array<float64>:" + std::to_string(serialized_null_value<double, true>()) + ";";
924 
925  result.insert(std::make_pair("null_values", null_values));
926 
927  llvm::StringMap<bool> cpu_features;
928  if (llvm::sys::getHostCPUFeatures(cpu_features)) {
929  std::string features_str = "";
930  for (auto it = cpu_features.begin(); it != cpu_features.end(); ++it) {
931  features_str += (it->getValue() ? " +" : " -");
932  features_str += it->getKey().str();
933  }
934  result.insert(std::make_pair("cpu_features", features_str));
935  }
936 
937  result.insert(std::make_pair("llvm_version",
938  std::to_string(LLVM_VERSION_MAJOR) + "." +
939  std::to_string(LLVM_VERSION_MINOR) + "." +
940  std::to_string(LLVM_VERSION_PATCH)));
941 
942 #ifdef HAVE_CUDA
943  if (!cpu_only) {
944  int device_count = 0;
945  checkCudaErrors(cuDeviceGetCount(&device_count));
946  if (device_count) {
947  CUdevice device{};
948  char device_name[256];
949  int major = 0, minor = 0;
950  int driver_version;
951  checkCudaErrors(cuDeviceGet(&device, 0)); // assuming homogeneous multi-GPU system
952  checkCudaErrors(cuDeviceGetName(device_name, 256, device));
953  checkCudaErrors(cuDeviceGetAttribute(
954  &major, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, device));
955  checkCudaErrors(cuDeviceGetAttribute(
956  &minor, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR, device));
957  checkCudaErrors(cuDriverGetVersion(&driver_version));
958 
959  result.insert(std::make_pair("gpu_name", device_name));
960  result.insert(std::make_pair("gpu_count", std::to_string(device_count)));
961  result.insert(std::make_pair("gpu_compute_capability",
962  std::to_string(major) + "." + std::to_string(minor)));
963  result.insert(std::make_pair("gpu_triple", get_gpu_target_triple_string()));
964  result.insert(std::make_pair("gpu_datalayout", get_gpu_data_layout()));
965  result.insert(std::make_pair("gpu_driver",
966  "CUDA " + std::to_string(driver_version / 1000) + "." +
967  std::to_string((driver_version % 1000) / 10)));
968  }
969  }
970 #endif
971 
972  return result;
973 }
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 3901 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().

3903  {
3904  DBObject object(dashboard_id, DashboardDBObjectType);
3905  auto& catalog = session_info.getCatalog();
3906  auto& user = session_info.get_currentUser();
3907  object.loadKey(catalog);
3908  object.setPrivileges(requestedPermissions);
3909  std::vector<DBObject> privs = {object};
3910  return SysCatalog::instance().checkPrivileges(user, privs);
3911 }
Catalog & getCatalog() const
Definition: SessionInfo.h:66
const UserMetadata & get_currentUser() const
Definition: SessionInfo.h:72

+ 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 1786 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().

1787  {
1788  TDBObject outObject;
1789  outObject.objectName = inObject.getName();
1790  outObject.grantee = roleName;
1791  outObject.objectId = inObject.getObjectKey().objectId;
1792  const auto ap = inObject.getPrivileges();
1793  switch (inObject.getObjectKey().permissionType) {
1794  case DatabaseDBObjectType:
1795  outObject.privilegeObjectType = TDBObjectType::DatabaseDBObjectType;
1796  outObject.privs.push_back(ap.hasPermission(DatabasePrivileges::CREATE_DATABASE));
1797  outObject.privs.push_back(ap.hasPermission(DatabasePrivileges::DROP_DATABASE));
1798  outObject.privs.push_back(ap.hasPermission(DatabasePrivileges::VIEW_SQL_EDITOR));
1799  outObject.privs.push_back(ap.hasPermission(DatabasePrivileges::ACCESS));
1800 
1801  break;
1802  case TableDBObjectType:
1803  outObject.privilegeObjectType = TDBObjectType::TableDBObjectType;
1804  outObject.privs.push_back(ap.hasPermission(TablePrivileges::CREATE_TABLE));
1805  outObject.privs.push_back(ap.hasPermission(TablePrivileges::DROP_TABLE));
1806  outObject.privs.push_back(ap.hasPermission(TablePrivileges::SELECT_FROM_TABLE));
1807  outObject.privs.push_back(ap.hasPermission(TablePrivileges::INSERT_INTO_TABLE));
1808  outObject.privs.push_back(ap.hasPermission(TablePrivileges::UPDATE_IN_TABLE));
1809  outObject.privs.push_back(ap.hasPermission(TablePrivileges::DELETE_FROM_TABLE));
1810  outObject.privs.push_back(ap.hasPermission(TablePrivileges::TRUNCATE_TABLE));
1811  outObject.privs.push_back(ap.hasPermission(TablePrivileges::ALTER_TABLE));
1812 
1813  break;
1814  case DashboardDBObjectType:
1815  outObject.privilegeObjectType = TDBObjectType::DashboardDBObjectType;
1816  outObject.privs.push_back(ap.hasPermission(DashboardPrivileges::CREATE_DASHBOARD));
1817  outObject.privs.push_back(ap.hasPermission(DashboardPrivileges::DELETE_DASHBOARD));
1818  outObject.privs.push_back(ap.hasPermission(DashboardPrivileges::VIEW_DASHBOARD));
1819  outObject.privs.push_back(ap.hasPermission(DashboardPrivileges::EDIT_DASHBOARD));
1820 
1821  break;
1822  case ViewDBObjectType:
1823  outObject.privilegeObjectType = TDBObjectType::ViewDBObjectType;
1824  outObject.privs.push_back(ap.hasPermission(ViewPrivileges::CREATE_VIEW));
1825  outObject.privs.push_back(ap.hasPermission(ViewPrivileges::DROP_VIEW));
1826  outObject.privs.push_back(ap.hasPermission(ViewPrivileges::SELECT_FROM_VIEW));
1827  outObject.privs.push_back(ap.hasPermission(ViewPrivileges::INSERT_INTO_VIEW));
1828  outObject.privs.push_back(ap.hasPermission(ViewPrivileges::UPDATE_IN_VIEW));
1829  outObject.privs.push_back(ap.hasPermission(ViewPrivileges::DELETE_FROM_VIEW));
1830 
1831  break;
1832  case ServerDBObjectType:
1833  outObject.privilegeObjectType = TDBObjectType::ServerDBObjectType;
1834  outObject.privs.push_back(ap.hasPermission(ServerPrivileges::CREATE_SERVER));
1835  outObject.privs.push_back(ap.hasPermission(ServerPrivileges::DROP_SERVER));
1836  outObject.privs.push_back(ap.hasPermission(ServerPrivileges::ALTER_SERVER));
1837  outObject.privs.push_back(ap.hasPermission(ServerPrivileges::SERVER_USAGE));
1838 
1839  break;
1840  default:
1841  CHECK(false);
1842  }
1843  const int type_val = static_cast<int>(inObject.getType());
1844  CHECK(type_val >= 0 && type_val < 6);
1845  outObject.objectType = static_cast<TDBObjectType::type>(type_val);
1846  return outObject;
1847 }
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:213
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:211
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:212
static const int32_t CREATE_SERVER
Definition: DBObject.h:128
const AccessPrivileges & getPrivileges() const
Definition: DBObject.h:218
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:203
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: