POCO_DATA_INVALID_ROW constant and Constants.h header

This commit is contained in:
Aleksandar Fabijanic 2008-03-20 17:57:24 +00:00
parent c07cc04912
commit 405e2e5cba
8 changed files with 76 additions and 13 deletions

View File

@ -414,6 +414,10 @@
RelativePath=".\include\Poco\Data\Connector.h"
>
</File>
<File
RelativePath=".\include\Poco\Data\Constants.h"
>
</File>
<File
RelativePath=".\include\Poco\Data\Data.h"
>

View File

@ -40,6 +40,7 @@
#define Data_ODBC_Extractor_INCLUDED
#include "Poco/Data/Constants.h"
#include "Poco/Data/ODBC/ODBC.h"
#include "Poco/Data/AbstractExtractor.h"
#include "Poco/Data/ODBC/Preparation.h"
@ -52,7 +53,7 @@
#include "Poco/Exception.h"
#include <map>
#ifdef POCO_OS_FAMILY_WINDOWS
#include <windows.h>
#include <windows.h>
#endif
#include <sqltypes.h>
@ -322,7 +323,7 @@ public:
Preparation::DataExtraction getDataExtraction() const;
/// Returns data extraction mode.
bool isNull(std::size_t col, std::size_t row = Preparation::INVALID_ROW);
bool isNull(std::size_t col, std::size_t row = POCO_DATA_INVALID_ROW);
/// Returns true if the value at [col,row] is null.
void reset();

View File

@ -40,6 +40,7 @@
#define Data_ODBC_Preparation_INCLUDED
#include "Poco/Data/Constants.h"
#include "Poco/Data/ODBC/ODBC.h"
#include "Poco/Data/ODBC/Handle.h"
#include "Poco/Data/ODBC/ODBCMetaColumn.h"
@ -101,8 +102,6 @@ public:
DE_BOUND
};
static const std::size_t INVALID_ROW;
enum DataType
{
DT_BOOL,
@ -386,7 +385,7 @@ public:
/// Returned length for variable length fields is the one
/// supported by this implementation, not the underlying DB.
std::size_t actualDataSize(std::size_t col, std::size_t row = INVALID_ROW) const;
std::size_t actualDataSize(std::size_t col, std::size_t row = POCO_DATA_INVALID_ROW) const;
/// Returns the returned length for the column and row specified.
/// This is usually equal to the column size, except for
/// variable length fields (BLOB and variable length strings).

View File

@ -43,9 +43,6 @@ namespace Data {
namespace ODBC {
const std::size_t Preparation::INVALID_ROW = std::numeric_limits<std::size_t>::max();
Preparation::Preparation(const StatementHandle& rStmt,
const std::string& statement,
std::size_t maxFieldSize,
@ -170,7 +167,7 @@ std::size_t Preparation::maxDataSize(std::size_t pos) const
std::size_t Preparation::actualDataSize(std::size_t col, std::size_t row) const
{
SQLLEN size = (INVALID_ROW == row) ? _lengths.at(col) :
SQLLEN size = (POCO_DATA_INVALID_ROW == row) ? _lengths.at(col) :
_lenLengths.at(col).at(row);
// workaround for drivers returning negative length

View File

@ -41,6 +41,7 @@
#include "Poco/Data/Data.h"
#include "Poco/Data/Constants.h"
#include <vector>
#include <deque>
#include <list>
@ -317,7 +318,7 @@ public:
virtual bool extract(std::size_t pos, std::list<DynamicAny>& val);
/// Extracts a DynamicAny list.
virtual bool isNull(std::size_t col, std::size_t row = -1) = 0;
virtual bool isNull(std::size_t col, std::size_t row = POCO_DATA_INVALID_ROW) = 0;
/// Returns true if the value at [col,row] position is null.
virtual void reset();

View File

@ -0,0 +1,58 @@
//
// Data.h
//
// $Id: //poco/Main/Data/include/Poco/Data/Constants.h#4 $
//
// Library: Data
// Package: DataCore
// Module: Constants
//
// Constant definitions for the Poco Data library.
//
// 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.
//
#ifndef Data_Constants_INCLUDED
#define Data_Constants_INCLUDED
#undef max
#include <limits>
#include <cstddef>
namespace Poco {
namespace Data {
static const std::size_t POCO_DATA_INVALID_ROW = std::numeric_limits<std::size_t>::max();
} } // namespace Poco::Data
#endif // Data_Constants_INCLUDED

View File

@ -764,7 +764,7 @@ private:
template <typename T>
Extraction<T>* into(T& t)
inline Extraction<T>* into(T& t)
/// Convenience function to allow for a more compact creation of an extraction object.
{
return new Extraction<T>(t);
@ -772,7 +772,7 @@ Extraction<T>* into(T& t)
template <typename T>
Extraction<T>* into(T& t, const Position& pos)
inline Extraction<T>* into(T& t, const Position& pos)
/// Convenience function to allow for a more compact creation of an extraction object
/// with multiple recordset support.
{
@ -781,7 +781,7 @@ Extraction<T>* into(T& t, const Position& pos)
template <typename T>
Extraction<T>* into(T& t, const Position& pos, const T& def)
inline Extraction<T>* into(T& t, const Position& pos, const T& def)
/// Convenience function to allow for a more compact creation of an extraction object with the given default
{
return new Extraction<T>(t, def, pos);

View File

@ -1,6 +1,9 @@
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Foundation", "Foundation_vs90.vcproj", "{8164D41D-B053-405B-826C-CF37AC0EF176}"
ProjectSection(ProjectDependencies) = postProject
{AA986945-F3B6-4381-94BB-14DD49202B40} = {AA986945-F3B6-4381-94BB-14DD49202B40}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestSuite", "testsuite\TestSuite_vs90.vcproj", "{F1EE93DF-347F-4CB3-B191-C4E63F38E972}"
ProjectSection(ProjectDependencies) = postProject