Ticket #263: lock_1.patch
File lock_1.patch, 2.3 KB (added by , 11 years ago) |
---|
-
ATOOLS/Org/My_File.C
103 103 #endif 104 104 } 105 105 else { 106 int res=sqlite3_open(file.c_str(),&db); 106 int res=0; 107 if (s_sqlopenflag.length()==0) res=sqlite3_open(file.c_str(),&db); 108 else res=sqlite3_open_v2(file.c_str(),&db,SQLITE_OPEN_READWRITE| 109 SQLITE_OPEN_CREATE,s_sqlopenflag.c_str()); 107 110 if (res!=SQLITE_OK) { 108 111 msg_IODebugging()<<METHOD<<"(): '"<<file<<"' returns '" 109 112 <<sqlite3_errmsg(db)<<"'."<<std::endl; … … 130 133 #ifdef USING__MPI 131 134 } 132 135 #endif 133 int res=sqlite3_open(file.c_str(),&db); 136 int res=0; 137 if (s_sqlopenflag.length()==0) res=sqlite3_open(file.c_str(),&db); 138 else res=sqlite3_open_v2(file.c_str(),&db,SQLITE_OPEN_READWRITE, 139 s_sqlopenflag.c_str()); 134 140 if (res!=SQLITE_OK) { 135 141 msg_IODebugging()<<METHOD<<"(): '"<<file<<"' returns '" 136 142 <<sqlite3_errmsg(db)<<"'."<<std::endl; … … 430 436 return m_mode; 431 437 } 432 438 439 template <class FileType> 440 std::string My_File<FileType>::s_sqlopenflag=""; 441 433 442 namespace ATOOLS { 434 443 435 444 template class My_In_File; -
ATOOLS/Org/My_File.H
44 44 45 45 fom::code m_mode; 46 46 47 static std::string s_sqlopenflag; 48 47 49 public: 48 50 49 51 // constructor … … 79 81 const std::string &cmd); 80 82 static bool CopyInDB(std::string oldfile, std::string newfile); 81 83 84 inline static void SetSQLOpenFlag(const std::string &flag) 85 { s_sqlopenflag=flag; } 86 82 87 };// end of class My_File 83 88 84 89 template<class FileType> -
ATOOLS/Org/Run_Parameter.C
240 240 dr.SetAllowUnits(false); 241 241 s_loader->AddPath(rpa->gen.Variable("SHERPA_RUN_PATH")); 242 242 243 std::string sqlopenflag=dr.GetValue<std::string>("SQLITE_OPEN_FLAG",""); 244 My_In_File::SetSQLOpenFlag(sqlopenflag); 245 My_Out_File::SetSQLOpenFlag(sqlopenflag); 243 246 // read only if defined (no error message if not defined) 244 247 long int seed; 245 248 std::vector<long int> seeds;