This file is indexed.

/usr/include/dballe/db/v6/driver.h is in libdballe-dev 7.21-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
#ifndef DBALLE_DB_V6_DRIVER_H
#define DBALLE_DB_V6_DRIVER_H

#include <dballe/core/defs.h>
#include <dballe/db/defs.h>
#include <dballe/sql/fwd.h>
#include <wreport/var.h>
#include <memory>
#include <functional>
#include <vector>
#include <cstdio>

namespace dballe {
namespace db {
namespace v6 {
struct QueryBuilder;
struct Repinfo;
struct Station;
struct LevTr;
struct DataV6;
struct AttrV6;

/// Query results from SQL output
struct SQLRecordV6
{
    int out_lat;
    int out_lon;
    char out_ident[64];
    int out_ident_size; // -1 for NULL
    wreport::Varcode out_varcode;
    Datetime out_datetime;
    Datetime out_datetimemax;
    char out_value[255];
    int out_rep_cod;
    int out_ana_id;
    int out_id_ltr;
    int out_id_data;
    int priority;

    /**
     * Checks true if ana_id, id_ltr, datetime and varcode are the same in
     * both records
     *
     * @returns true if they match, false if they are different
     */
    bool querybest_fields_are_the_same(const SQLRecordV6& r);

    /// Dump the record as a single line to the given output stream
    void dump(FILE* out);
};

struct Driver
{
    sql::Connection& connection;

    Driver(sql::Connection& connection);
    virtual ~Driver();

    /// Precompiled queries to manipulate the repinfo table
    virtual std::unique_ptr<v6::Repinfo> create_repinfov6() = 0;

    /// Precompiled queries to manipulate the station table
    virtual std::unique_ptr<v6::Station> create_stationv6() = 0;

    /// Precompiled queries to manipulate the levtr table
    virtual std::unique_ptr<v6::LevTr> create_levtrv6() = 0;

    /// Precompiled queries to manipulate the data table
    virtual std::unique_ptr<v6::DataV6> create_datav6() = 0;

    /// Precompiled queries to manipulate the attr table
    virtual std::unique_ptr<v6::AttrV6> create_attrv6() = 0;

    /**
     * Run a query on the given statement, returning results as SQLRecordV6 objects
     *
     * SQLRecordV6 is filled with the output variables according to which sel_* is true.
     *
     * Query will dispatch to the right connector routines for the query, based on
     * the actual implementation of stm.
     */
    virtual void run_built_query_v6(const v6::QueryBuilder& qb, std::function<void(SQLRecordV6& rec)> dest) = 0;

    /// Create all missing tables for a DB with the given format
    void create_tables(db::Format format);

    /// Create all missing tables for V6 databases
    virtual void create_tables_v6() = 0;

    /// Delete all existing tables for a DB with the given format
    void delete_tables(db::Format format);

    /// Delete all existing tables for V6 databases
    virtual void delete_tables_v6() = 0;

    /// Empty all tables for a DB with the given format
    void remove_all(db::Format format);

    /// Empty all tables for V6 databases, assuming that they exist, without touching the repinfo table
    virtual void remove_all_v6();

    /// Perform database cleanup/maintenance on v6 databases
    virtual void vacuum_v6() = 0;

    /// Create a Driver for this connection
    static std::unique_ptr<Driver> create(sql::Connection& conn);
};

}
}
}
#endif