Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
SQLiteVersionsOfRoot.C File Reference

Detailed Description

View in nbviewer Open in SWAN
This tutorial demonstrates how TSQLServer can be used to create a connection with a SQlite3 database.

It accesses the Sqlite data base. Download from https://root.cern/files/root_download_stats.sqlite Then a TH1F histogram is created and filled using a expression which receives the recorded values in the "version" column of the sqlite3 database. The histogram shows the usage of the ROOT development version. This product includes GeoLite2 data created by MaxMind, available from http://www.maxmind.com.

#include <TSQLiteServer.h>
#include <TSQLiteResult.h>
#include <TSQLRow.h>
#include <TString.h>
TSQLServer *db = TSQLServer::Connect("sqlite://root_download_stats.sqlite", "", "");
const char *rootSourceVersion = "SELECT Version FROM accesslog;";
TH1F *hVersionOfRoot= new TH1F("hVersionOfRoot", "Development Versions of ROOT", 7, 0, -1);
while (TSQLRow *row = rootSourceVersionRes->Next()) {
TString rowVersion(row->GetField(0));
delete row;
}
hVersionOfRoot->GetXaxis()->LabelsOption("a");
hVersionOfRoot->LabelsDeflate("X");
hVersionOfRoot->Draw();
}
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
The Canvas class.
Definition TCanvas.h:23
1-D histogram with a float per channel (see TH1 documentation)
Definition TH1.h:645
static TSQLServer * Connect(const char *db, const char *uid, const char *pw)
The db should be of the form: <dbms>://<host>[:<port>][/<database>], e.g.: mysql://pcroot....
Basic string class.
Definition TString.h:139
Author
Alexandra-Maria Dobrescu 08/2018

Definition in file SQLiteVersionsOfRoot.C.