Auxiliary class for connection to data base.  
 More...
#include <JDB.hh>
 | 
| static JDB &  | get () | 
|   | Get connection to database.  More...
  | 
|   | 
| static void  | reset () | 
|   | Reset connection to database.  More...
  | 
|   | 
| static void  | reset (const std::string &usr, const std::string &pwd) | 
|   | Reset connection to database.  More...
  | 
|   | 
| static void  | reset (const std::string &cookie) | 
|   | Reset connection to database.  More...
  | 
|   | 
| static void  | reset (const std::string &usr, const std::string &pwd, const std::string &cookie) | 
|   | Reset connection to database.  More...
  | 
|   | 
Auxiliary class for connection to data base. 
Definition at line 87 of file JDB.hh.
 
◆ JDB() [1/2]
Default constructor. 
Definition at line 200 of file JDB.hh.
 
 
◆ JDB() [2/2]
  
  
      
        
          | JDATABASE::JDB::JDB  | 
          ( | 
          const JDB &  | 
           | ) | 
           | 
         
       
   | 
  
private   | 
  
 
 
◆ get()
  
  
      
        
          | static JDB& JDATABASE::JDB::get  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inlinestatic   | 
  
 
Get connection to database. 
- Returns
 - database connection 
 
Definition at line 96 of file JDB.hh.
 
 
◆ reset() [1/4]
  
  
      
        
          | static void JDATABASE::JDB::reset  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inlinestatic   | 
  
 
Reset connection to database. 
Definition at line 107 of file JDB.hh.
  111       if (db.
get() != NULL) {
 
  113         static_cast<std::shared_ptr<Client>&
>(db).
reset();
 
 
 
 
◆ reset() [2/4]
  
  
      
        
          | static void JDATABASE::JDB::reset  | 
          ( | 
          const std::string &  | 
          usr,  | 
         
        
           | 
           | 
          const std::string &  | 
          pwd  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
inlinestatic   | 
  
 
Reset connection to database. 
- Parameters
 - 
  
    | usr | user name  | 
    | pwd | pass word  | 
  
   
Definition at line 124 of file JDB.hh.
  127       static_cast<std::shared_ptr<Client>&
>(
JDB::get()) = Client::Create(Server::Default, usr.c_str(), pwd.c_str());
 
 
 
 
◆ reset() [3/4]
  
  
      
        
          | static void JDATABASE::JDB::reset  | 
          ( | 
          const std::string &  | 
          cookie | ) | 
           | 
         
       
   | 
  
inlinestatic   | 
  
 
Reset connection to database. 
- Parameters
 - 
  
  
 
Definition at line 136 of file JDB.hh.
  141       string buffer = cookie;
 
  145         ifstream in(cookie.c_str());
 
  154       if (pos != string::npos) {
 
  155         buffer.erase(0, pos);
 
  158       static_cast<std::shared_ptr<Client>&
>(
JDB::get()) = Client::Create(Server::Default, buffer.c_str());
 
 
 
 
◆ reset() [4/4]
  
  
      
        
          | static void JDATABASE::JDB::reset  | 
          ( | 
          const std::string &  | 
          usr,  | 
         
        
           | 
           | 
          const std::string &  | 
          pwd,  | 
         
        
           | 
           | 
          const std::string &  | 
          cookie  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
inlinestatic   | 
  
 
Reset connection to database. 
An attempt to make a connection to the database is made in the following order, using:
- user name and password, if neither empty;
 
- given cookie, if not empty;
 
- private cookie file (created with JCookie.sh);
 
- public cookie (defined by environment variable DBCOOKIE);
 
- Parameters
 - 
  
    | usr | user name  | 
    | pwd | password  | 
    | cookie | persistent cookie  | 
  
   
Definition at line 176 of file JDB.hh.
  183       if      (usr != 
"" && pwd != 
"")
 
  185       else if (cookie != 
"")
 
  192         THROW(JDatabaseException, 
"Missing user name / password or cookie file.");
 
 
 
 
◆ operator=()
  
  
      
        
          | JDB& JDATABASE::JDB::operator=  | 
          ( | 
          const JDB &  | 
           | ) | 
           | 
         
       
   | 
  
private   | 
  
 
 
The documentation for this class was generated from the following file: