{ "cells": [ { "cell_type": "markdown", "id": "4506bb9e", "metadata": {}, "source": [ "# SQLiteVersionsOfRoot\n", "This tutorial demonstrates how TSQLServer can be used to create a connection with a SQlite3 database.\n", "It accesses the Sqlite data base.\n", "Download from https://root.cern/files/root_download_stats.sqlite\n", "Then a TH1F histogram is created and filled\n", "using a expression which receives the recorded\n", "values in the \"version\" column of the sqlite3 database.\n", "The histogram shows the usage of the ROOT development version.\n", "This product includes GeoLite2 data created by MaxMind, available from\n", "http://www.maxmind.com.\n", "\n", "\n", "\n", "\n", "**Author:** Alexandra-Maria Dobrescu 08/2018 \n", "This notebook tutorial was automatically generated with ROOTBOOK-izer from the macro found in the ROOT repository on Tuesday, May 19, 2026 at 08:16 PM." ] }, { "cell_type": "code", "execution_count": null, "id": "e2bbd8f9", "metadata": { "collapsed": false }, "outputs": [], "source": [ "TSQLServer *db = TSQLServer::Connect(\"sqlite://root_download_stats.sqlite\", \"\", \"\");\n", "\n", "const char *rootSourceVersion = \"SELECT Version FROM accesslog;\";\n", "\n", "TSQLResult *rootSourceVersionRes = db->Query(rootSourceVersion);\n", "\n", "TH1F *hVersionOfRoot= new TH1F(\"hVersionOfRoot\", \"Development Versions of ROOT\", 7, 0, -1);\n", "\n", "while (TSQLRow *row = rootSourceVersionRes->Next()) {\n", " TString rowVersion(row->GetField(0));\n", " TString shortVersion(rowVersion(0,4));\n", " hVersionOfRoot->Fill(shortVersion,1);\n", " delete row;\n", "}\n", "\n", "TCanvas *VersionOfRootHistogram = new TCanvas();\n", "\n", "hVersionOfRoot->GetXaxis()->LabelsOption(\"a\");\n", "hVersionOfRoot->LabelsDeflate(\"X\");\n", "hVersionOfRoot->Draw();" ] }, { "cell_type": "markdown", "id": "7bb3f89a", "metadata": {}, "source": [ "Draw all canvases " ] }, { "cell_type": "code", "execution_count": null, "id": "96d18326", "metadata": { "collapsed": false }, "outputs": [], "source": [ "%jsroot on\n", "gROOT->GetListOfCanvases()->Draw()" ] } ], "metadata": { "kernelspec": { "display_name": "ROOT C++", "language": "c++", "name": "root" }, "language_info": { "codemirror_mode": "text/x-c++src", "file_extension": ".C", "mimetype": " text/x-c++src", "name": "c++" } }, "nbformat": 4, "nbformat_minor": 5 }