Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TSQLiteServer.h
Go to the documentation of this file.
1// @(#)root/sqlite:$Id$
2// Author: o.freyermuth <o.f@cern.ch>, 01/06/2013
3
4/*************************************************************************
5 * Copyright (C) 1995-2013, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TSQLiteServer
13#define ROOT_TSQLiteServer
14
15#include "TSQLServer.h"
16
17class sqlite3;
18
19class TSQLiteServer : public TSQLServer {
20
21 private:
22 TString fSrvInfo; // Server info string
23 sqlite3 *fSQLite{nullptr}; // connection to SQLite DB
24
25 public:
26 TSQLiteServer(const char *db, const char *uid = nullptr, const char *pw = nullptr);
28
29 void Close(Option_t *opt = "") final;
32 Bool_t Commit() final;
33 Bool_t Rollback() final;
34 TSQLResult *Query(const char *sql) final;
35 Bool_t Exec(const char *sql) final;
36 TSQLStatement *Statement(const char *sql, Int_t = 100) final;
37 Bool_t HasStatement() const final;
38 Int_t SelectDataBase(const char *dbname) final;
39 TSQLResult *GetDataBases(const char *wild = nullptr) final;
40 TSQLResult *GetTables(const char *dbname, const char *wild = nullptr) final;
41 TSQLResult *GetColumns(const char *dbname, const char *table, const char *wild = nullptr) final;
42 TSQLTableInfo *GetTableInfo(const char* tablename) final;
43 Int_t CreateDataBase(const char *dbname) final;
44 Int_t DropDataBase(const char *dbname) final;
45 Int_t Reload() final;
46 Int_t Shutdown() final;
47 const char *ServerInfo() final;
48
49 ClassDefOverride(TSQLiteServer,0); // Connection to SQLite DB
50};
51
52#endif
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
Int_t SelectDataBase(const char *dbname) final
Select a database.
TSQLStatement * Statement(const char *sql, Int_t=100) final
Produce TSQLiteStatement.
Bool_t HasStatement() const final
We assume prepared statements work for all SQLite-versions.
Int_t DropDataBase(const char *dbname) final
Drop (i.e.
TSQLResult * GetTables(const char *dbname, const char *wild=nullptr) final
List all tables in the specified database.
Bool_t Commit() final
submit "COMMIT TRANSACTION" query to database return kTRUE, if successful
TSQLResult * Query(const char *sql) final
Execute SQL command.
Bool_t HasTransactionInFlight() final
returns kTRUE when transaction is running
const char * ServerInfo() final
Return server info, must be deleted by user.
Bool_t Rollback() final
submit "ROLLBACK TRANSACTION" query to database return kTRUE, if successful
TSQLResult * GetColumns(const char *dbname, const char *table, const char *wild=nullptr) final
List all columns in specified table (database argument is ignored).
Int_t Shutdown() final
Shutdown the database server.
Bool_t Exec(const char *sql) final
Execute SQL command which does not produce any result sets.
Int_t Reload() final
Reload permission tables.
sqlite3 * fSQLite
TSQLResult * GetDataBases(const char *wild=nullptr) final
List all available databases.
Int_t CreateDataBase(const char *dbname) final
Create a database.
~TSQLiteServer()
Close SQLite DB.
void Close(Option_t *opt="") final
Close connection to SQLite DB.
Bool_t StartTransaction() final
submit "BEGIN TRANSACTION" query to database return kTRUE, if successful
TSQLTableInfo * GetTableInfo(const char *tablename) final
Produces SQL table info.
Basic string class.
Definition TString.h:139