Warning, file /include/root/TSQLServer.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TSQLServer
0013 #define ROOT_TSQLServer
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033 #include "TObject.h"
0034 #include "TString.h"
0035
0036 class TSQLResult;
0037 class TSQLStatement;
0038 class TSQLTableInfo;
0039 class TList;
0040
0041 class TSQLServer : public TObject {
0042
0043 protected:
0044 TString fType;
0045 TString fHost;
0046 TString fDB;
0047 Int_t fPort{-1};
0048 Int_t fErrorCode{0};
0049 TString fErrorMsg;
0050 Bool_t fErrorOut{kTRUE};
0051
0052 TSQLServer() {}
0053
0054 void ClearError();
0055 void SetError(Int_t code, const char* msg, const char *method = nullptr);
0056
0057 static const char* fgFloatFmt;
0058
0059 public:
0060 enum ESQLDataTypes {
0061 kSQL_NONE = -1,
0062 kSQL_CHAR = 1,
0063 kSQL_VARCHAR = 2,
0064 kSQL_INTEGER = 3,
0065 kSQL_FLOAT = 4,
0066 kSQL_DOUBLE = 5,
0067 kSQL_NUMERIC = 6,
0068 kSQL_BINARY = 7,
0069 kSQL_TIMESTAMP = 8
0070 };
0071
0072 virtual ~TSQLServer() { }
0073
0074 virtual void Close(Option_t *option = "") = 0;
0075 virtual TSQLResult *Query(const char *sql) = 0;
0076 virtual Bool_t Exec(const char* sql);
0077 virtual TSQLStatement *Statement(const char*, Int_t = 100)
0078 { AbstractMethod("Statement"); return nullptr; }
0079 virtual Bool_t HasStatement() const { return kFALSE; }
0080 virtual Int_t SelectDataBase(const char *dbname) = 0;
0081 virtual TSQLResult *GetDataBases(const char *wild = nullptr) = 0;
0082 virtual TSQLResult *GetTables(const char *dbname, const char *wild = nullptr) = 0;
0083 virtual TList *GetTablesList(const char* wild = nullptr);
0084 virtual Bool_t HasTable(const char* tablename);
0085 virtual TSQLTableInfo *GetTableInfo(const char* tablename);
0086 virtual TSQLResult *GetColumns(const char *dbname, const char *table, const char *wild = nullptr) = 0;
0087 virtual Int_t GetMaxIdentifierLength() { return 20; }
0088 virtual Int_t CreateDataBase(const char *dbname) = 0;
0089 virtual Int_t DropDataBase(const char *dbname) = 0;
0090 virtual Int_t Reload() = 0;
0091 virtual Int_t Shutdown() = 0;
0092 virtual const char *ServerInfo() = 0;
0093 virtual Bool_t IsConnected() const { return fPort == -1 ? kFALSE : kTRUE; }
0094 const char *GetDBMS() const { return fType.Data(); }
0095 const char *GetDB() const { return fDB.Data(); }
0096 const char *GetHost() const { return fHost.Data(); }
0097 Int_t GetPort() const { return fPort; }
0098
0099 virtual Bool_t IsError() const { return GetErrorCode() != 0; }
0100 virtual Int_t GetErrorCode() const;
0101 virtual const char* GetErrorMsg() const;
0102 virtual void EnableErrorOutput(Bool_t on = kTRUE) { fErrorOut = on; }
0103
0104 virtual Bool_t StartTransaction();
0105 virtual Bool_t HasTransactionInFlight();
0106 virtual Bool_t Commit();
0107 virtual Bool_t Rollback();
0108
0109 virtual Bool_t PingVerify() { return kFALSE; }
0110 virtual Int_t Ping() { return -9999; }
0111
0112 static TSQLServer *Connect(const char *db, const char *uid, const char *pw);
0113
0114 static void SetFloatFormat(const char* fmt = "%e");
0115 static const char* GetFloatFormat();
0116
0117 ClassDefOverride(TSQLServer,0)
0118 };
0119
0120 #endif