Changeset 18497
- Timestamp:
- 05/08/16 18:47:22 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/rootifysql.cc
r18491 r18497 27 27 ("tree,t", var<string>("Result"), "Name of the root tree") 28 28 ("display,d", po_switch(), "Displays contents on the screen (most usefull in combination with mysql statements as SHOW or EXPLAIN)") 29 ("no-out,n", po_switch(), "Redirect the output file to /dev/null") 29 30 ("delimiter", var<string>(""), "The delimiter used if contents are displayed with --display (default=\\t)") 30 31 ("verbose,v", var<uint16_t>(1), "Verbosity (0: quiet, 1: default, 2: more, 3, ...)") … … 43 44 cout << 44 45 "rootifysql - Converts the result of a mysql query into a root file\n" 46 "\n" 47 "For convenience, this documentation uses the extended version of the options, " 48 "refer to the output below to get the abbreviations.\n" 45 49 "\n" 46 50 "Writes the result of a mysql query into a root file. For each column, a branch is " … … 55 59 "This can be useful to create an ascii file or to show results as 'SHOW DATABASES' " 56 60 "or 'EXPLAIN table'. To redirect the contents into an ascii file, the option -v0 " 57 "is useful. \n"61 "is useful. To suppredd writing to an output file --no-out can be used.\n" 58 62 "\n" 59 63 "The default is to read the query from a file called rootify.sql. Except if a different " … … 93 97 const bool update = conf.Get<bool>("update"); 94 98 const bool display = conf.Get<bool>("display"); 99 const bool noout = conf.Get<bool>("no-out"); 95 100 const uint16_t verbose = conf.Get<uint16_t>("verbose"); 96 101 const uint16_t compression = conf.Get<uint16_t>("compression"); … … 129 134 // I am using root here instead of boost to be 130 135 // consistent with the access pattern by TFile 131 TString path( out.c_str());136 TString path(noout?"/dev/null":out.c_str()); 132 137 gSystem->ExpandPathName(path); 133 138 134 FileStat_t stat; 135 const Int_t exist = !gSystem->GetPathInfo(path, stat); 136 const Bool_t write = !gSystem->AccessPathName(path, kWritePermission) && R_ISREG(stat.fMode); 137 138 if ((update && !exist) || (update && exist && !write) || (force && exist && !write)) 139 { 140 cerr << "File '" << path << "' is not writable." << endl; 141 return 3; 142 } 143 144 if (!update && !force && exist) 145 { 146 cerr << "File '" << path << "' already exists." << endl; 147 return 4; 139 if (!noout) 140 { 141 FileStat_t stat; 142 const Int_t exist = !gSystem->GetPathInfo(path, stat); 143 const Bool_t write = !gSystem->AccessPathName(path, kWritePermission) && R_ISREG(stat.fMode); 144 145 if ((update && !exist) || (update && exist && !write) || (force && exist && !write)) 146 { 147 cerr << "File '" << path << "' is not writable." << endl; 148 return 3; 149 } 150 151 if (!update && !force && exist) 152 { 153 cerr << "File '" << path << "' already exists." << endl; 154 return 4; 155 } 148 156 } 149 157 // -------------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.