00001
00002
00003
00004 #include "eirods_zone_info.h"
00005
00006 #include "rodsLog.h"
00007 #include "icatHighLevelRoutines.h"
00008 #include "icatMidLevelRoutines.h"
00009 #include "rodsDef.h"
00010
00011 namespace eirods {
00012
00013 zone_info* zone_info::the_instance_ = NULL;
00014
00015 zone_info* zone_info::get_instance(void) {
00016 if(the_instance_ == NULL) {
00017 the_instance_ = new zone_info();
00018 }
00019 return the_instance_;
00020 }
00021
00022 zone_info::zone_info(void) {
00023
00024 }
00025
00026 zone_info::~zone_info() {
00027
00028 }
00029
00030 error zone_info::get_local_zone(
00031 icatSessionStruct _icss,
00032 int _logSQL,
00033 std::string& _rtn_local_zone) {
00034 error result = SUCCESS();
00035 if (local_zone_.empty()) {
00036 if (_logSQL!=0) rodsLog(LOG_SQL, "getLocalZone SQL 1 ");
00037 char localZone[MAX_NAME_LEN];
00038 int status = cmlGetStringValueFromSql("select zone_name from R_ZONE_MAIN where zone_type_name=?",
00039 localZone, MAX_NAME_LEN, "local", 0, 0, &_icss);
00040 if (status != 0) {
00041 chlRollback(NULL);
00042 result = ERROR(status, "getLocalZone failure");
00043 }
00044 local_zone_ = std::string(localZone);
00045 }
00046 _rtn_local_zone = local_zone_;
00047 return result;
00048
00049 }
00050
00051 };