This file is indexed.

/usr/include/pqxx/tablereader.hxx is in libpqxx3-dev 1:3.1.1-0ubuntu4.

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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/*-------------------------------------------------------------------------
 *
 *   FILE
 *	pqxx/tablereader.hxx
 *
 *   DESCRIPTION
 *      definition of the pqxx::tablereader class.
 *   pqxx::tablereader enables optimized batch reads from a database table
 *   DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/tablereader instead.
 *
 * Copyright (c) 2001-2008, Jeroen T. Vermeulen <jtv@xs4all.nl>
 *
 * See COPYING for copyright license.  If you did not receive a file called
 * COPYING with this source code, please notify the distributor of this mistake,
 * or contact the author.
 *
 *-------------------------------------------------------------------------
 */
#ifndef PQXX_H_TABLEREADER
#define PQXX_H_TABLEREADER

#include "pqxx/compiler-public.hxx"
#include "pqxx/compiler-internal-pre.hxx"

#include "pqxx/result"
#include "pqxx/tablestream"

/* Methods tested in eg. self-test program test001 are marked with "//[t1]"
 */

namespace pqxx
{

/// Efficiently pull data directly out of a table.
/** A tablereader provides efficient read access to a database table.  This is
 * not as flexible as a normal query using the result class however:
 * <ul>
 * <li> Can only dump tables, not views or arbitrary queries
 * <li> Has no knowledge of metadata
 * <li> Is unable to reorder, rename, omit or enrich fields
 * <li> Does not support filtering of records
 * </ul>
 *
 * On the other hand, it can read rows of data and transform them into any
 * container or container-like object that supports STL back-inserters.  Since
 * the tablereader has no knowledge of the types of data expected, it treats
 * all fields as strings.
 */
class PQXX_LIBEXPORT tablereader : public tablestream
{
public:
  tablereader(transaction_base &,
      const PGSTD::string &Name,
      const PGSTD::string &Null=PGSTD::string());			//[t6]

  /// Read only the given sequence of columns
  /** @since PostgreSQL backend 7.3
   */
  template<typename ITER>
  tablereader(transaction_base &,
      const PGSTD::string &Name,
      ITER begincolumns,
      ITER endcolumns);							//[t80]

  template<typename ITER> tablereader(transaction_base &,
      const PGSTD::string &Name,
      ITER begincolumns,
      ITER endcolumns,
      const PGSTD::string &Null);					//[t80]

  ~tablereader() throw ();						//[t6]

  template<typename TUPLE> tablereader &operator>>(TUPLE &);		//[t8]

  operator bool() const throw () { return !m_Done; }			//[t6]
  bool operator!() const throw () { return m_Done; }			//[t6]

  /// Read a line of raw, unparsed table data
  /**
   * @param Line Variable to hold the raw data line read from the table.
   * @return Whether a line could be read
   */
  bool get_raw_line(PGSTD::string &Line);				//[t8]

  template<typename TUPLE>
  void tokenize(PGSTD::string, TUPLE &) const;				//[t8]

  /// Finish stream action, check for errors, and detach from transaction
  /** It is recommended that you call this function before the tablestream's
   * destructor is run.  This function will check any final errors which may not
   * become apparent until the transaction is committed otherwise.
   *
   * As an added benefit, this will free up the transaction while the
   * tablestream object itself still exists.
   */
  virtual void complete();						//[t8]

private:
  void setup(transaction_base &T,
      const PGSTD::string &RName,
      const PGSTD::string &Columns=PGSTD::string());
  void PQXX_PRIVATE reader_close();
  PGSTD::string extract_field(const PGSTD::string &,
      PGSTD::string::size_type &) const;

  bool m_Done;
};


// TODO: Find meaningful definition of input iterator


template<typename ITER> inline
tablereader::tablereader(transaction_base &T,
    const PGSTD::string &Name,
    ITER begincolumns,
    ITER endcolumns) :
  namedclass(Name, "tablereader"),
  tablestream(T, PGSTD::string()),
  m_Done(true)
{
  setup(T, Name, columnlist(begincolumns, endcolumns));
}

template<typename ITER> inline
tablereader::tablereader(transaction_base &T,
    const PGSTD::string &Name,
    ITER begincolumns,
    ITER endcolumns,
    const PGSTD::string &Null) :
  namedclass(Name, "tablereader"),
  tablestream(T, Null),
  m_Done(true)
{
  setup(T, Name, columnlist(begincolumns, endcolumns));
}


template<typename TUPLE>
inline void tablereader::tokenize(PGSTD::string Line, TUPLE &T) const
{
  PGSTD::back_insert_iterator<TUPLE> ins = PGSTD::back_inserter(T);

  // Filter and tokenize line, inserting tokens at end of T
  PGSTD::string::size_type here=0;
  while (here < Line.size()) *ins++ = extract_field(Line, here);
}


template<typename TUPLE>
inline tablereader &pqxx::tablereader::operator>>(TUPLE &T)
{
  PGSTD::string Line;
  if (get_raw_line(Line)) tokenize(Line, T);
  return *this;
}


} // namespace pqxx

#include "pqxx/compiler-internal-post.hxx"

#endif