This file is indexed.

/usr/include/Poco/Data/BulkExtraction.h is in libpoco-dev 1.8.0.1-1ubuntu4.

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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
//
// BulkExtraction.h
//
// Library: Data
// Package: DataCore
// Module:  BulkExtraction
//
// Definition of the BulkExtraction class.
//
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier:	BSL-1.0
//


#ifndef Data_BulkExtraction_INCLUDED
#define Data_BulkExtraction_INCLUDED


#include "Poco/Data/Data.h"
#include "Poco/Data/AbstractExtraction.h"
#include "Poco/Data/Bulk.h"
#include "Poco/Data/Preparation.h"
#include <vector>


namespace Poco {
namespace Data {


template <class C>
class BulkExtraction: public AbstractExtraction
	/// Specialization for bulk extraction of values from a query result set.
	/// Bulk extraction support is provided only for following STL containers:
	/// - std::vector
	/// - std::deque
	/// - std::list
{
public:
	typedef C                       ValType;
	typedef typename C::value_type  CValType;
	typedef SharedPtr<ValType>      ValPtr;
	typedef BulkExtraction<ValType> Type;
	typedef SharedPtr<Type>         Ptr;

	BulkExtraction(C& result, Poco::UInt32 limit, const Position& pos = Position(0)): 
		AbstractExtraction(limit, pos.value(), true),
		_rResult(result), 
		_default()
	{
		if (static_cast<Poco::UInt32>(result.size()) != limit)
			result.resize(limit);
	}

	BulkExtraction(C& result, const CValType& def, Poco::UInt32 limit, const Position& pos = Position(0)): 
		AbstractExtraction(limit, pos.value(), true),
		_rResult(result), 
		_default(def)
	{
		if (static_cast<Poco::UInt32>(result.size()) != limit)
			result.resize(limit);
	}

	virtual ~BulkExtraction()
	{
	}

	std::size_t numOfColumnsHandled() const
	{
		return TypeHandler<C>::size();
	}

	std::size_t numOfRowsHandled() const
	{
		return _rResult.size();
	}

	std::size_t numOfRowsAllowed() const
	{
		return getLimit();
	}

	bool isNull(std::size_t row) const
	{
		try
		{
			return _nulls.at(row);
		}
		catch (std::out_of_range& ex)
		{ 
			throw RangeException(ex.what()); 
		}
	}

	std::size_t extract(std::size_t col)
	{
		AbstractExtractor::Ptr pExt = getExtractor();
		TypeHandler<C>::extract(col, _rResult, _default, pExt);
		typename C::iterator it = _rResult.begin();
		typename C::iterator end = _rResult.end();
		for (int row = 0; it !=end; ++it, ++row)
		{
			_nulls.push_back(isValueNull(*it, pExt->isNull(col, row)));
		}

		return _rResult.size();
	}

	virtual void reset()
	{
	}

	AbstractPreparation::Ptr createPreparation(AbstractPreparator::Ptr& pPrep, std::size_t col)
	{
		Poco::UInt32 limit = getLimit();
		if (limit != _rResult.size()) _rResult.resize(limit);
		pPrep->setLength(limit);
		pPrep->setBulk(true);
		return new Preparation<C>(pPrep, col, _rResult);
	}

protected:
	const C& result() const
	{
		return _rResult;
	}

private:
	C&               _rResult;
	CValType         _default;
	std::deque<bool> _nulls;
};


template <class C>
class InternalBulkExtraction: public BulkExtraction<C>
	/// Container Data Type specialization extension for extraction of values from a query result set.
	///
	/// This class is intended for PocoData internal use - it is used by StatementImpl 
	/// to automaticaly create internal BulkExtraction in cases when statement returns data and no external storage
	/// was supplied. It is later used by RecordSet to retrieve the fetched data after statement execution.
	/// It takes ownership of the Column pointer supplied as constructor argument. Column object, in turn
	/// owns the data container pointer.
	///
	/// InternalBulkExtraction objects can not be copied or assigned.
{
public:
	typedef C                               ValType;
	typedef typename C::value_type          CValType;
	typedef SharedPtr<ValType>              ValPtr;
	typedef InternalBulkExtraction<ValType> Type;
	typedef SharedPtr<Type>                 Ptr;

	InternalBulkExtraction(C& result,
		Column<C>* pColumn,
		Poco::UInt32 limit,
		const Position& pos = Position(0)): 
		BulkExtraction<C>(result, CValType(), limit, pos), 
		_pColumn(pColumn)
		/// Creates InternalBulkExtraction.
	{
	}

	~InternalBulkExtraction()
		/// Destroys InternalBulkExtraction.
	{
		delete _pColumn;
	}

	void reset()
	{
		_pColumn->reset();
	}	

	const CValType& value(int index) const
	{
		try
		{ 
			return BulkExtraction<C>::result().at(index); 
		}
		catch (std::out_of_range& ex)
		{ 
			throw RangeException(ex.what()); 
		}
	}

	bool isNull(std::size_t row) const
	{
		return BulkExtraction<C>::isNull(row);
	}

	const Column<C>& column() const
	{
		return *_pColumn;
	}

private:
	InternalBulkExtraction();
	InternalBulkExtraction(const InternalBulkExtraction&);
	InternalBulkExtraction& operator = (const InternalBulkExtraction&);

	Column<C>* _pColumn;
};


namespace Keywords {


template <typename T> 
AbstractExtraction::Ptr into(std::vector<T>& t, const Bulk& bulk, const Position& pos = Position(0))
	/// Convenience function to allow for a more compact creation of an extraction object
	/// with std::vector bulk extraction support.
{
	return new BulkExtraction<std::vector<T> >(t, bulk.size(), pos);
}


template <typename T> 
AbstractExtraction::Ptr into(std::vector<T>& t, BulkFnType, const Position& pos = Position(0))
	/// Convenience function to allow for a more compact creation of an extraction object
	/// with std::vector bulk extraction support.
{
	Poco::UInt32 size = static_cast<Poco::UInt32>(t.size());
	if (0 == size) throw InvalidArgumentException("Zero length not allowed.");
	return new BulkExtraction<std::vector<T> >(t, size, pos);
}


template <typename T> 
AbstractExtraction::Ptr into(std::deque<T>& t, const Bulk& bulk, const Position& pos = Position(0))
	/// Convenience function to allow for a more compact creation of an extraction object
	/// with std::deque bulk extraction support.
{
	return new BulkExtraction<std::deque<T> >(t, bulk.size(), pos);
}


template <typename T> 
AbstractExtraction::Ptr into(std::deque<T>& t, BulkFnType, const Position& pos = Position(0))
	/// Convenience function to allow for a more compact creation of an extraction object
	/// with std::deque bulk extraction support.
{
	Poco::UInt32 size = static_cast<Poco::UInt32>(t.size());
	if (0 == size) throw InvalidArgumentException("Zero length not allowed.");
	return new BulkExtraction<std::deque<T> >(t, size, pos);
}


template <typename T> 
AbstractExtraction::Ptr into(std::list<T>& t, const Bulk& bulk, const Position& pos = Position(0))
	/// Convenience function to allow for a more compact creation of an extraction object
	/// with std::list bulk extraction support.
{
	return new BulkExtraction<std::list<T> >(t, bulk.size(), pos);
}


template <typename T> 
AbstractExtraction::Ptr into(std::list<T>& t, BulkFnType, const Position& pos = Position(0))
	/// Convenience function to allow for a more compact creation of an extraction object
	/// with std::list bulk extraction support.
{
	Poco::UInt32 size = static_cast<Poco::UInt32>(t.size());
	if (0 == size) throw InvalidArgumentException("Zero length not allowed.");
	return new BulkExtraction<std::list<T> >(t, size, pos);
}


} // namespace Keywords


} } // namespace Poco::Data


#endif // Data_BulkExtraction_INCLUDED