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
00020 return the_instance_;
00021 }
00022
00023 zone_info::zone_info(void) {
00024
00025 }
00026
00027 zone_info::~zone_info() {
00028
00029 }
00030
00031 error zone_info::get_local_zone(
00032 icatSessionStruct _icss,
00033 int _logSQL,
00034 std::string& _rtn_local_zone) {
00035 error result = SUCCESS();
00036 if (local_zone_.empty()) {
00037 if (_logSQL!=0) rodsLog(LOG_SQL, "getLocalZone SQL 1 ");
00038 char localZone[MAX_NAME_LEN];
00039 int status = cmlGetStringValueFromSql("select zone_name from R_ZONE_MAIN where zone_type_name=?",
00040 localZone, MAX_NAME_LEN, "local", 0, 0, &_icss);
00041 if (status != 0) {
00042 chlRollback(NULL);
00043 result = ERROR(status, "getLocalZone failure");
00044 }
00045
00046 local_zone_ = localZone;
00047 }
00048
00049 _rtn_local_zone = local_zone_;
00050 return result;
00051
00052 }
00053
00054 };