mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-27 19:10:20 +01:00
committed Data
This commit is contained in:
102
Data/src/RecordSet.cpp
Normal file
102
Data/src/RecordSet.cpp
Normal file
@@ -0,0 +1,102 @@
|
||||
//
|
||||
// RecordSet.cpp
|
||||
//
|
||||
// $Id: //poco/Main/Data/src/RecordSet.cpp#2 $
|
||||
//
|
||||
// Library: Data
|
||||
// Package: DataCore
|
||||
// Module: RecordSet
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person or organization
|
||||
// obtaining a copy of the software and accompanying documentation covered by
|
||||
// this license (the "Software") to use, reproduce, display, distribute,
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/Data/RecordSet.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace Data {
|
||||
|
||||
|
||||
RecordSet::RecordSet(const Statement& rStatement):
|
||||
Statement(rStatement),
|
||||
_currentRow(1)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
RecordSet::~RecordSet()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
DynamicAny RecordSet::value(std::size_t col, std::size_t row) const
|
||||
{
|
||||
switch (columnType(col))
|
||||
{
|
||||
case MetaColumn::FDT_BOOL:
|
||||
case MetaColumn::FDT_INT8: return value<Int8>(col, row); break;
|
||||
case MetaColumn::FDT_UINT8: return value<UInt8>(col, row); break;
|
||||
case MetaColumn::FDT_INT16: return value<Int16>(col, row); break;
|
||||
case MetaColumn::FDT_UINT16: return value<UInt16>(col, row); break;
|
||||
case MetaColumn::FDT_INT32: return value<Int32>(col, row); break;
|
||||
case MetaColumn::FDT_UINT32: return value<UInt32>(col, row); break;
|
||||
case MetaColumn::FDT_INT64: return value<Int64>(col, row); break;
|
||||
case MetaColumn::FDT_UINT64: return value<UInt64>(col, row); break;
|
||||
case MetaColumn::FDT_FLOAT: return value<float>(col, row); break;
|
||||
case MetaColumn::FDT_DOUBLE: return value<double>(col, row); break;
|
||||
case MetaColumn::FDT_STRING: return value<std::string>(col, row); break;
|
||||
case MetaColumn::FDT_BLOB: return value<BLOB>(col, row); break;
|
||||
default:
|
||||
throw Poco::InvalidArgumentException("Data type not supported.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DynamicAny RecordSet::value(const std::string& name, std::size_t row) const
|
||||
{
|
||||
switch (columnType(name))
|
||||
{
|
||||
case MetaColumn::FDT_BOOL:
|
||||
case MetaColumn::FDT_INT8: return value<Int8>(name, row); break;
|
||||
case MetaColumn::FDT_UINT8: return value<UInt8>(name, row); break;
|
||||
case MetaColumn::FDT_INT16: return value<Int16>(name, row); break;
|
||||
case MetaColumn::FDT_UINT16: return value<UInt16>(name, row); break;
|
||||
case MetaColumn::FDT_INT32: return value<Int32>(name, row); break;
|
||||
case MetaColumn::FDT_UINT32: return value<UInt32>(name, row); break;
|
||||
case MetaColumn::FDT_INT64: return value<Int64>(name, row); break;
|
||||
case MetaColumn::FDT_UINT64: return value<UInt64>(name, row); break;
|
||||
case MetaColumn::FDT_FLOAT: return value<float>(name, row); break;
|
||||
case MetaColumn::FDT_DOUBLE: return value<double>(name, row); break;
|
||||
case MetaColumn::FDT_STRING: return value<std::string>(name, row); break;
|
||||
case MetaColumn::FDT_BLOB: return value<BLOB>(name, row); break;
|
||||
default:
|
||||
throw Poco::InvalidArgumentException("Data type not supported.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::Data
|
||||
Reference in New Issue
Block a user