Logo ROOT  
Reference Guide
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
17#include <sqlite3.h>
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;
31 TSQLResult *Query(const char *sql) final;
32 Bool_t Exec(const char *sql) final;
33 TSQLStatement *Statement(const char *sql, Int_t = 100) final;
34 Bool_t HasStatement() const final;
35 Int_t SelectDataBase(const char *dbname) final;
36 TSQLResult *GetDataBases(const char *wild = nullptr) final;
37 TSQLResult *GetTables(const char *dbname, const char *wild = nullptr) final;
38 TSQLResult *GetColumns(const char *dbname, const char *table, const char *wild = nullptr) final;
39 TSQLTableInfo *GetTableInfo(const char* tablename) final;
40 Int_t CreateDataBase(const char *dbname) final;
41 Int_t DropDataBase(const char *dbname) final;
42 Int_t Reload() final;
43 Int_t Shutdown() final;
44 const char *ServerInfo() final;
45
46 ClassDefOverride(TSQLiteServer,0); // Connection to SQLite DB
47};
48
49#endif
int Int_t
Definition: RtypesCore.h:43
bool Bool_t
Definition: RtypesCore.h:61
const char Option_t
Definition: RtypesCore.h:64
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.
TSQLResult * Query(const char *sql) final
Execute SQL command.
const char * ServerInfo() final
Return server info, must be deleted by user.
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
Definition: TSQLiteServer.h:23
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.
TSQLiteServer(const char *db, const char *uid=nullptr, const char *pw=nullptr)
Open a connection to an SQLite DB server.
ClassDefOverride(TSQLiteServer, 0)
Bool_t StartTransaction() final
submit "START TRANSACTION" query to database return kTRUE, if successful
TString fSrvInfo
Definition: TSQLiteServer.h:22
TSQLTableInfo * GetTableInfo(const char *tablename) final
Produces SQL table info.
Basic string class.
Definition: TString.h:131