|
BrRdbmDbclass description - source file - inheritance tree class BrRdbmDb : public BrVirtualDbprotected: Data Membersprotected: Class DescriptionBase class for BRAHMS databases. Individual database classes can inherit from this and then define the mathods in needs. E.g., a calibration databse classs, can define the methods "BrCalibObj* GetAround(time_t t)" to get calibration valid around the unix_timestamp t, and a run database could define "BrRunInfo* GetRun(int no)" etc. The actual database name is stored on the TNamed::fTitle, while the symbolic name is stored in TNamed::fName BrRdbmDb(const Char_t* name, const Char_t* title) : BrVirtualDb(name, title) Protected constructor. ~BrRdbmDb() Bool_t Connect(Option_t* option) Connect to the database. If we're already connected, just return the connection. This method fails and returns 0 (zero) if: Server host name isn't set Database isn't set Can't get the password (See ReadUserPasswd) Can't get the username (See ReadUserPasswd) Some DB server/client error Options: NONE void Close(Option_t* option) Clsoe the database connection Bool_t ReadUserPasswd() See ReadBratDbRc, PromptUser, and PromptPasswd Bool_t ReadBratDbRc() Read ~/.bratdbrc to look for a valid host, db, user, and password entry. The file MUST be read-write for user ONLY! Format of file is host db user passwd Lines starting with '#' are ignored. Bool_t PromptUser() Prompt the user for a user name Bool_t PromptPasswd() Prompt the user for a user name Bool_t IsConnected(void) const Checks to see if we're still connected to the server. Throws a BrException on error. void LockTables(const Char_t* writetables, int) Lock the tables specifed as a comma sepearated string, present in the table. Throws BrException. void UnLockTables(void) Unlock previous locked tables. Throws BrException. Int_t Increment(void) Increment sequnne in the database, and return the new number. Should _always_ be inside the scope of a LockTables("sequence, ...")! Throws a BrException. void CreateSequence(void) Create the sequnce table in the database. This table is needed to make unigue id's TSQLResult* Query(BrDbQuery* query) TSQLRow* GetSingle(const Char_t* tablename, const Char_t* condition) Get a single instance of a table. the first argument should be a valid SQL command, like "SELECT * FROM Persons WHERE", the second SQL where-like condition(s) e.g., "name like '%%%s%%'" The third is a (optional) list of variadic arguments - akin to printf(...) et al. Please note indiviual Get... methods for valid fields. NB: Double "%%" is used to mean single "%" in the SQL query - that is, a C escape of "%" variadic functions. TSQLResult* GetMultiple(const Char_t* tablename, const Char_t* condition) As above, but a result set is returned. Inline FunctionsTObject* GetConnection() TClass* Class() TClass* IsA() const void ShowMembers(TMemberInspector& insp, char* parent) void Streamer(TBuffer& b) void StreamerNVirtual(TBuffer& b) BrRdbmDb BrRdbmDb(BrRdbmDb&) |
||||||
This page automatically generated by script docBrat by Christian Holm |
Copyright ; 2002 BRAHMS Collaboration
<brahmlib@rcf.rhic.bnl.gov>
|