Warning, file /include/root/ROOT/RSqliteDS.hxx was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef ROOT_RSQLITEDS
0012 #define ROOT_RSQLITEDS
0013
0014 #include "ROOT/RDataFrame.hxx"
0015 #include "ROOT/RDataSource.hxx"
0016 #include <string_view>
0017
0018 #include <memory>
0019 #include <string>
0020 #include <vector>
0021
0022 namespace ROOT::Internal::RDF {
0023 class R__CLING_PTRCHECK(off) RSqliteDSColumnReader final : public ROOT::Detail::RDF::RColumnReaderBase {
0024 void *fValuePtr;
0025 void *GetImpl(Long64_t) final { return fValuePtr; }
0026
0027 public:
0028 RSqliteDSColumnReader(void *valuePtr) : fValuePtr(valuePtr) {}
0029 };
0030 }
0031
0032 namespace ROOT {
0033
0034 namespace RDF {
0035
0036 namespace Internal {
0037
0038 struct RSqliteDSDataSet;
0039 }
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061 class RSqliteDS final : public ROOT::RDF::RDataSource {
0062 private:
0063
0064
0065 enum class ETypes {
0066 kInteger,
0067 kReal,
0068 kText,
0069 kBlob,
0070 kNull
0071 };
0072
0073
0074
0075 struct Value_t {
0076 explicit Value_t(ETypes type);
0077
0078 ETypes fType;
0079 bool fIsActive;
0080 Long64_t fInteger;
0081 double fReal;
0082 std::string fText;
0083 std::vector<unsigned char> fBlob;
0084 void *fNull;
0085 void *fPtr;
0086 };
0087
0088 void SqliteError(int errcode);
0089
0090 std::unique_ptr<Internal::RSqliteDSDataSet> fDataSet;
0091 ULong64_t fNRow;
0092 std::vector<std::string> fColumnNames;
0093 std::vector<ETypes> fColumnTypes;
0094
0095 std::vector<Value_t> fValues;
0096
0097
0098
0099 static constexpr char const *fgTypeNames[] = {
0100 "Long64_t",
0101 "double",
0102 "std::string",
0103 "std::vector<unsigned char>",
0104 "void *"
0105 };
0106
0107
0108 public:
0109 RSqliteDS(const std::string &fileName, const std::string &query);
0110
0111 RSqliteDS(const RSqliteDS &) = delete;
0112 RSqliteDS &operator=(const RSqliteDS &) = delete;
0113 RSqliteDS(RSqliteDS &&) = delete;
0114 RSqliteDS &operator=(RSqliteDS &&) = delete;
0115 ~RSqliteDS() final;
0116
0117 void SetNSlots(unsigned int nSlots) final;
0118 const std::vector<std::string> &GetColumnNames() const final;
0119 bool HasColumn(std::string_view colName) const final;
0120 std::string GetTypeName(std::string_view colName) const final;
0121 std::vector<std::pair<ULong64_t, ULong64_t>> GetEntryRanges() final;
0122 bool SetEntry(unsigned int slot, ULong64_t entry) final;
0123 void Initialize() final;
0124 std::string GetLabel() final;
0125
0126 std::unique_ptr<ROOT::Detail::RDF::RColumnReaderBase>
0127 GetColumnReaders(unsigned int slot, std::string_view colName, const std::type_info &tid) final;
0128
0129 protected:
0130 Record_t GetColumnReadersImpl(std::string_view name, const std::type_info &) final;
0131 };
0132
0133 RDataFrame FromSqlite(std::string_view fileName, std::string_view query);
0134
0135 }
0136
0137 }
0138
0139 #endif