ROOT  6.06/09
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 #ifndef ROOT_TSQLServer
16 #include "TSQLServer.h"
17 #endif
18 
19 #if !defined(__CINT__)
20 #include <sqlite3.h>
21 #else
22 struct sqlite3;
23 #endif
24 
25 
26 
27 class TSQLiteServer : public TSQLServer {
28 
29  private:
30  TString fSrvInfo; // Server info string
31  sqlite3 *fSQLite; // connection to SQLite DB
32 
33  public:
34  TSQLiteServer(const char *db, const char *uid=NULL, const char *pw=NULL);
36 
37  void Close(Option_t *opt="");
39  TSQLResult *Query(const char *sql);
40  Bool_t Exec(const char *sql);
41  TSQLStatement *Statement(const char *sql, Int_t = 100);
42  Bool_t HasStatement() const;
43  Int_t SelectDataBase(const char *dbname);
44  TSQLResult *GetDataBases(const char *wild = 0);
45  TSQLResult *GetTables(const char *dbname, const char *wild = 0);
46  TSQLResult *GetColumns(const char *dbname, const char *table, const char *wild = 0);
47  TSQLTableInfo *GetTableInfo(const char* tablename);
48  Int_t CreateDataBase(const char *dbname);
49  Int_t DropDataBase(const char *dbname);
50  Int_t Reload();
51  Int_t Shutdown();
52  const char *ServerInfo();
53 
54  ClassDef(TSQLiteServer,0); // Connection to SQLite DB
55 };
56 
57 #endif
Bool_t Exec(const char *sql)
Execute SQL command which does not produce any result sets.
const char Option_t
Definition: RtypesCore.h:62
Bool_t HasStatement() const
We assume prepared statements work for all SQLite-versions.
TSQLResult * Query(const char *sql)
Execute SQL command.
Basic string class.
Definition: TString.h:137
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
Int_t Reload()
Reload permission tables.
sqlite3 * fSQLite
Definition: TSQLiteServer.h:31
TString fSrvInfo
Definition: TSQLiteServer.h:30
~TSQLiteServer()
Close SQLite DB.
ClassDef(TSQLiteServer, 0)
TSQLResult * GetColumns(const char *dbname, const char *table, const char *wild=0)
List all columns in specified table (database argument is ignored).
Int_t CreateDataBase(const char *dbname)
Create a database.
TSQLiteServer(const char *db, const char *uid=NULL, const char *pw=NULL)
Bool_t StartTransaction()
submit "START TRANSACTION" query to database return kTRUE, if successful
const char * ServerInfo()
Return server info, must be deleted by user.
Int_t Shutdown()
Shutdown the database server.
Int_t SelectDataBase(const char *dbname)
Select a database.
TSQLResult * GetDataBases(const char *wild=0)
List all available databases.
void Close(Option_t *opt="")
Close connection to SQLite DB.
TSQLStatement * Statement(const char *sql, Int_t=100)
Produce TSQLiteStatement.
#define NULL
Definition: Rtypes.h:82
TSQLResult * GetTables(const char *dbname, const char *wild=0)
List all tables in the specified database.
Int_t DropDataBase(const char *dbname)
Drop (i.e.
TSQLTableInfo * GetTableInfo(const char *tablename)
Produces SQL table info.