data housekeeping

- removed naked pointers from Data interfaces
- fixed GH #82: name conflict in Data::Keywords::bind
- fixed GH #157: MySQL: cannot bind to 'long' data type on
Windows/Visual C++
- fixed GH #158: MySQL: MYSQL_BIND 'is_unsigned' member is not set
This commit is contained in:
Aleksandar Fabijanic 2013-04-28 12:34:07 -05:00
parent c6207985d8
commit a50823c5a8
34 changed files with 669 additions and 597 deletions

View File

@ -39,6 +39,10 @@ Release 1.5.2 (2013-04-29)
- fixed GH #141: Application::run() documentation/implementation discrepancy
- changed RowFormatter to SharedPtr<RowFormatter> in Data::RecordSet interface (breaking change!)
- fixed GH #144: Poco::Dynamic emits invalid JSON
- removed naked pointers from Data interfaces
- fixed GH #82: name conflict in Data::Keywords::bind
- fixed GH #157: MySQL: cannot bind to 'long' data type on Windows/Visual C++
- fixed GH #158: MySQL: MYSQL_BIND 'is_unsigned' member is not set
Release 1.5.1 (2013-01-11)
==========================

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="debug_shared|Win32">
@ -32,82 +32,86 @@
<RootNamespace>MySQL</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
<PropertyGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|Win32&apos;" Label="Configuration">
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release_static_md|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|Win32&apos;" Label="Configuration">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_md|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|Win32&apos;" Label="Configuration">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release_static_mt|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|Win32&apos;" Label="Configuration">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|Win32&apos;" Label="Configuration">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release_shared|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|Win32&apos;" Label="Configuration">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
<ImportGroup Label="ExtensionSettings"/>
<ImportGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|Win32&apos;" Label="PropertySheets">
<Import Condition="exists(&apos;$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props&apos;)" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings" />
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='release_static_md|Win32'" Label="PropertySheets">
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup>
<ImportGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|Win32&apos;" Label="PropertySheets">
<Import Condition="exists(&apos;$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props&apos;)" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_md|Win32'" Label="PropertySheets">
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup>
<ImportGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|Win32&apos;" Label="PropertySheets">
<Import Condition="exists(&apos;$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props&apos;)" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='release_static_mt|Win32'" Label="PropertySheets">
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup>
<ImportGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|Win32&apos;" Label="PropertySheets">
<Import Condition="exists(&apos;$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props&apos;)" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|Win32'" Label="PropertySheets">
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup>
<ImportGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|Win32&apos;" Label="PropertySheets">
<Import Condition="exists(&apos;$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props&apos;)" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='release_shared|Win32'" Label="PropertySheets">
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup>
<ImportGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|Win32&apos;" Label="PropertySheets">
<Import Condition="exists(&apos;$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props&apos;)" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'" Label="PropertySheets">
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros"/>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
<OutDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|Win32&apos;">..\..\bin\</OutDir>
<IntDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|Win32&apos;">obj\$(Configuration)\</IntDir>
<LinkIncremental Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|Win32&apos;">true</LinkIncremental>
<OutDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|Win32&apos;">..\..\bin\</OutDir>
<IntDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|Win32&apos;">obj\$(Configuration)\</IntDir>
<LinkIncremental Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|Win32&apos;">false</LinkIncremental>
<OutDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|Win32&apos;">..\..\lib\</OutDir>
<IntDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|Win32&apos;">obj\$(Configuration)\</IntDir>
<OutDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|Win32&apos;">..\..\lib\</OutDir>
<IntDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|Win32&apos;">obj\$(Configuration)\</IntDir>
<OutDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|Win32&apos;">..\..\lib\</OutDir>
<IntDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|Win32&apos;">obj\$(Configuration)\</IntDir>
<OutDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|Win32&apos;">..\..\lib\</OutDir>
<IntDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|Win32&apos;">obj\$(Configuration)\</IntDir>
<TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|Win32&apos;">PocoDataMySQLd</TargetName>
<TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|Win32&apos;">PocoDataMySQLmdd</TargetName>
<TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|Win32&apos;">PocoDataMySQLmtd</TargetName>
<TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|Win32&apos;">PocoDataMySQL</TargetName>
<TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|Win32&apos;">PocoDataMySQLmd</TargetName>
<TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|Win32&apos;">PocoDataMySQLmt</TargetName>
<OutDir Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'">..\..\bin\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'">obj\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='release_shared|Win32'">..\..\bin\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='release_shared|Win32'">obj\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='release_shared|Win32'">false</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|Win32'">..\..\lib\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|Win32'">obj\$(Configuration)\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='release_static_mt|Win32'">..\..\lib\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='release_static_mt|Win32'">obj\$(Configuration)\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='debug_static_md|Win32'">..\..\lib\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='debug_static_md|Win32'">obj\$(Configuration)\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='release_static_md|Win32'">..\..\lib\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='release_static_md|Win32'">obj\$(Configuration)\</IntDir>
<TargetName Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'">PocoDataMySQLd</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='debug_static_md|Win32'">PocoDataMySQLmdd</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|Win32'">PocoDataMySQLmtd</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='release_shared|Win32'">PocoDataMySQL</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='release_static_md|Win32'">PocoDataMySQLmd</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='release_static_mt|Win32'">PocoDataMySQLmt</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|Win32&apos;">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'">
<IncludePath>C:\Program Files (x86)\MySQL\Connector C 6.0.2\include;$(IncludePath)</IncludePath>
<LibraryPath>C:\Program Files (x86)\MySQL\Connector C 6.0.2\lib\debug;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.\include;..\..\Foundation\include;..\..\Data\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -120,7 +124,7 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CompileAs>Default</CompileAs>
@ -138,7 +142,7 @@
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|Win32&apos;">
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release_shared|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
@ -153,9 +157,9 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat/>
<DebugInformationFormat />
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
@ -172,7 +176,7 @@
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|Win32&apos;">
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.\include;..\..\Foundation\include;..\..\Data\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -185,7 +189,7 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/>
<PrecompiledHeader />
<ProgramDataBaseFileName>..\..\lib\PocoDataMySQLmtd.pdb</ProgramDataBaseFileName>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
@ -196,7 +200,7 @@
<OutputFile>..\..\lib\PocoDataMySQLmtd.lib</OutputFile>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|Win32&apos;">
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release_static_mt|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
@ -211,9 +215,9 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat/>
<DebugInformationFormat />
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
@ -221,7 +225,7 @@
<OutputFile>..\..\lib\PocoDataMySQLmt.lib</OutputFile>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|Win32&apos;">
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_md|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.\include;..\..\Foundation\include;..\..\Data\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -234,7 +238,7 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/>
<PrecompiledHeader />
<ProgramDataBaseFileName>..\..\lib\PocoDataMySQLmdd.pdb</ProgramDataBaseFileName>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
@ -245,7 +249,7 @@
<OutputFile>..\..\lib\PocoDataMySQLmdd.lib</OutputFile>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|Win32&apos;">
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release_static_md|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
@ -260,10 +264,10 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/>
<PrecompiledHeader />
<ProgramDataBaseFileName>..\..\lib\PocoDataMySQLmd.pdb</ProgramDataBaseFileName>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat/>
<DebugInformationFormat />
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
@ -273,28 +277,28 @@
</Lib>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="src\Binder.cpp"/>
<ClCompile Include="src\Connector.cpp"/>
<ClCompile Include="src\Extractor.cpp"/>
<ClCompile Include="src\MySQLException.cpp"/>
<ClCompile Include="src\MySQLStatementImpl.cpp"/>
<ClCompile Include="src\ResultMetadata.cpp"/>
<ClCompile Include="src\SessionHandle.cpp"/>
<ClCompile Include="src\SessionImpl.cpp"/>
<ClCompile Include="src\StatementExecutor.cpp"/>
<ClCompile Include="src\Binder.cpp" />
<ClCompile Include="src\Connector.cpp" />
<ClCompile Include="src\Extractor.cpp" />
<ClCompile Include="src\MySQLException.cpp" />
<ClCompile Include="src\MySQLStatementImpl.cpp" />
<ClCompile Include="src\ResultMetadata.cpp" />
<ClCompile Include="src\SessionHandle.cpp" />
<ClCompile Include="src\SessionImpl.cpp" />
<ClCompile Include="src\StatementExecutor.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\Poco\Data\MySQL\Binder.h"/>
<ClInclude Include="include\Poco\Data\MySQL\Connector.h"/>
<ClInclude Include="include\Poco\Data\MySQL\Extractor.h"/>
<ClInclude Include="include\Poco\Data\MySQL\MySQL.h"/>
<ClInclude Include="include\Poco\Data\MySQL\MySQLException.h"/>
<ClInclude Include="include\Poco\Data\MySQL\MySQLStatementImpl.h"/>
<ClInclude Include="include\Poco\Data\MySQL\ResultMetadata.h"/>
<ClInclude Include="include\Poco\Data\MySQL\SessionHandle.h"/>
<ClInclude Include="include\Poco\Data\MySQL\SessionImpl.h"/>
<ClInclude Include="include\Poco\Data\MySQL\StatementExecutor.h"/>
<ClInclude Include="include\Poco\Data\MySQL\Binder.h" />
<ClInclude Include="include\Poco\Data\MySQL\Connector.h" />
<ClInclude Include="include\Poco\Data\MySQL\Extractor.h" />
<ClInclude Include="include\Poco\Data\MySQL\MySQL.h" />
<ClInclude Include="include\Poco\Data\MySQL\MySQLException.h" />
<ClInclude Include="include\Poco\Data\MySQL\MySQLStatementImpl.h" />
<ClInclude Include="include\Poco\Data\MySQL\ResultMetadata.h" />
<ClInclude Include="include\Poco\Data\MySQL\SessionHandle.h" />
<ClInclude Include="include\Poco\Data\MySQL\SessionImpl.h" />
<ClInclude Include="include\Poco\Data\MySQL\StatementExecutor.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
<ImportGroup Label="ExtensionTargets"/>
</Project>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets" />
</Project>

View File

@ -54,54 +54,53 @@ class MySQL_API Binder: public Poco::Data::AbstractBinder
/// Binds placeholders in the sql query to the provided values. Performs data types mapping.
{
public:
typedef SharedPtr<Binder> Ptr;
Binder();
/// Creates the Binder.
virtual ~Binder();
/// Destroys the Binder.
virtual void bind(std::size_t pos, const Poco::Int8& val, Direction dir);
/// Binds an Int8.
virtual void bind(std::size_t pos, const Poco::UInt8& val, Direction dir);
/// Binds an UInt8.
virtual void bind(std::size_t pos, const Poco::Int16& val, Direction dir);
/// Binds an Int16.
virtual void bind(std::size_t pos, const Poco::UInt16& val, Direction dir);
/// Binds an UInt16.
virtual void bind(std::size_t pos, const Poco::Int32& val, Direction dir);
/// Binds an Int32.
virtual void bind(std::size_t pos, const Poco::UInt32& val, Direction dir);
/// Binds an UInt32.
virtual void bind(std::size_t pos, const Poco::Int64& val, Direction dir);
/// Binds an Int64.
virtual void bind(std::size_t pos, const Poco::UInt64& val, Direction dir);
/// Binds an UInt64.
#ifndef POCO_LONG_IS_64_BIT
virtual void bind(std::size_t pos, const long& val, Direction dir = PD_IN);
/// Binds a long.
virtual void bind(std::size_t pos, const unsigned long& val, Direction dir = PD_IN);
/// Binds an unsigned long.
#endif
virtual void bind(std::size_t pos, const bool& val, Direction dir);
/// Binds a boolean.
virtual void bind(std::size_t pos, const float& val, Direction dir);
/// Binds a float.
virtual void bind(std::size_t pos, const double& val, Direction dir);
/// Binds a double.
virtual void bind(std::size_t pos, const char& val, Direction dir);
/// Binds a single character.
@ -154,27 +153,27 @@ public:
virtual void bind(std::size_t pos, const std::vector<Poco::Int32>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::deque<Poco::Int32>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::list<Poco::Int32>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::vector<Poco::UInt32>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::deque<Poco::UInt32>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::list<Poco::UInt32>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::vector<Poco::Int64>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::deque<Poco::Int64>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::list<Poco::Int64>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::vector<Poco::UInt64>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::deque<Poco::UInt64>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::list<Poco::UInt64>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::vector<bool>& val, Direction dir = PD_IN);
virtual void bind(std::size_t pos, const std::deque<bool>& val, Direction dir = PD_IN);
@ -261,7 +260,7 @@ private:
{
}
void realBind(std::size_t pos, enum_field_types type, const void* buffer, int length);
void realBind(std::size_t pos, enum_field_types type, const void* buffer, int length, bool isUnsigned = false);
/// Common bind implementation
private:

View File

@ -62,6 +62,8 @@ class MySQL_API Extractor: public Poco::Data::AbstractExtractor
/// If NULL is received, the incoming val value is not changed and false is returned
{
public:
typedef SharedPtr<Extractor> Ptr;
Extractor(StatementExecutor& st, ResultMetadata& md);
/// Creates the Extractor.

View File

@ -59,7 +59,6 @@ class MySQL_API MySQLStatementImpl: public Poco::Data::StatementImpl
/// Implements statement functionality needed for MySQL
{
public:
MySQLStatementImpl(SessionImpl& s);
/// Creates the MySQLStatementImpl.
@ -69,7 +68,7 @@ public:
protected:
virtual std::size_t columnsReturned() const;
/// Returns number of columns returned by query.
/// Returns number of columns returned by query.
virtual std::size_t affectedRowCount() const;
/// Returns the number of affected rows.
@ -97,10 +96,10 @@ protected:
virtual void bindImpl();
/// Binds parameters
virtual AbstractExtractor& extractor();
virtual Poco::Data::AbstractExtractor::Ptr extractor();
/// Returns the concrete extractor used by the statement.
virtual AbstractBinder& binder();
virtual Poco::Data::AbstractBinder::Ptr binder();
/// Returns the concrete binder used by the statement.
private:
@ -113,8 +112,8 @@ private:
StatementExecutor _stmt;
ResultMetadata _metadata;
Binder _binder;
Extractor _extractor;
Binder::Ptr _pBinder;
Extractor::Ptr _pExtractor;
int _hasNext;
};

View File

@ -49,11 +49,11 @@ Binder::Binder()
Binder::~Binder()
{
for (std::vector<MYSQL_TIME*>::iterator it = _dates.begin(); it != _dates.end(); ++it)
{
delete *it;
*it = 0;
}
for (std::vector<MYSQL_TIME*>::iterator it = _dates.begin(); it != _dates.end(); ++it)
{
delete *it;
*it = 0;
}
}
@ -67,7 +67,7 @@ void Binder::bind(std::size_t pos, const Poco::Int8& val, Direction dir)
void Binder::bind(std::size_t pos, const Poco::UInt8& val, Direction dir)
{
poco_assert(dir == PD_IN);
realBind(pos, MYSQL_TYPE_TINY, &val, 0);
realBind(pos, MYSQL_TYPE_TINY, &val, 0, true);
}
@ -81,7 +81,7 @@ void Binder::bind(std::size_t pos, const Poco::Int16& val, Direction dir)
void Binder::bind(std::size_t pos, const Poco::UInt16& val, Direction dir)
{
poco_assert(dir == PD_IN);
realBind(pos, MYSQL_TYPE_SHORT, &val, 0);
realBind(pos, MYSQL_TYPE_SHORT, &val, 0, true);
}
@ -95,7 +95,7 @@ void Binder::bind(std::size_t pos, const Poco::Int32& val, Direction dir)
void Binder::bind(std::size_t pos, const Poco::UInt32& val, Direction dir)
{
poco_assert(dir == PD_IN);
realBind(pos, MYSQL_TYPE_LONG, &val, 0);
realBind(pos, MYSQL_TYPE_LONG, &val, 0, true);
}
@ -109,24 +109,30 @@ void Binder::bind(std::size_t pos, const Poco::Int64& val, Direction dir)
void Binder::bind(std::size_t pos, const Poco::UInt64& val, Direction dir)
{
poco_assert(dir == PD_IN);
realBind(pos, MYSQL_TYPE_LONGLONG, &val, 0);
realBind(pos, MYSQL_TYPE_LONGLONG, &val, 0, true);
}
#ifndef POCO_LONG_IS_64_BIT
void Binder::bind(std::size_t pos, const long& val, Direction dir)
{
poco_assert(dir == PD_IN);
#ifdef POCO_LONG_IS_64_BIT
realBind(pos, MYSQL_TYPE_LONGLONG, &val, 0);
#else
realBind(pos, MYSQL_TYPE_LONG, &val, 0);
#endif
}
void Binder::bind(std::size_t pos, const unsigned long& val, Direction dir)
{
poco_assert(dir == PD_IN);
realBind(pos, MYSQL_TYPE_LONGLONG, &val, 0);
}
#ifdef POCO_LONG_IS_64_BIT
realBind(pos, MYSQL_TYPE_LONGLONG, &val, 0, true);
#else
realBind(pos, MYSQL_TYPE_LONG, &val, 0, true);
#endif
}
void Binder::bind(std::size_t pos, const bool& val, Direction dir)
@ -290,7 +296,7 @@ MYSQL_BIND* Binder::getBindArray() const
//
////////////////////
void Binder::realBind(std::size_t pos, enum_field_types type, const void* buffer, int length)
void Binder::realBind(std::size_t pos, enum_field_types type, const void* buffer, int length, bool isUnsigned)
{
if (pos >= _bindArray.size())
{
@ -303,8 +309,9 @@ void Binder::realBind(std::size_t pos, enum_field_types type, const void* buffer
MYSQL_BIND b = {0};
b.buffer_type = type;
b.buffer = const_cast<void*>(buffer);
b.buffer = const_cast<void*>(buffer);
b.buffer_length = length;
b.is_unsigned = isUnsigned;
_bindArray[pos] = b;
}

View File

@ -44,7 +44,8 @@ namespace MySQL {
MySQLStatementImpl::MySQLStatementImpl(SessionImpl& h) :
Poco::Data::StatementImpl(h),
_stmt(h.handle()),
_extractor(_stmt, _metadata),
_pBinder(new Binder),
_pExtractor(new Extractor(_stmt, _metadata)),
_hasNext(NEXT_DONTKNOW)
{
}
@ -160,21 +161,21 @@ void MySQLStatementImpl::bindImpl()
pos += (*it)->numOfColumnsHandled();
}
_stmt.bindParams(_binder.getBindArray(), _binder.size());
_stmt.bindParams(_pBinder->getBindArray(), _pBinder->size());
_stmt.execute();
_hasNext = NEXT_DONTKNOW;
}
AbstractExtractor& MySQLStatementImpl::extractor()
Poco::Data::AbstractExtractor::Ptr MySQLStatementImpl::extractor()
{
return _extractor;
return _pExtractor;
}
AbstractBinder& MySQLStatementImpl::binder()
Poco::Data::AbstractBinder::Ptr MySQLStatementImpl::binder()
{
return _binder;
return _pBinder;
}

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="debug_shared|Win32">
@ -32,92 +32,96 @@
<RootNamespace>TestSuite</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
<PropertyGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|Win32&apos;" Label="Configuration">
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release_static_md|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>Dynamic</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|Win32&apos;" Label="Configuration">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_md|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>Dynamic</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|Win32&apos;" Label="Configuration">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release_static_mt|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>Static</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|Win32&apos;" Label="Configuration">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>Static</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|Win32&apos;" Label="Configuration">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release_shared|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>Dynamic</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|Win32&apos;" Label="Configuration">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseOfMfc>Dynamic</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
<ImportGroup Label="ExtensionSettings"/>
<ImportGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|Win32&apos;" Label="PropertySheets">
<Import Condition="exists(&apos;$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props&apos;)" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings" />
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='release_static_md|Win32'" Label="PropertySheets">
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup>
<ImportGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|Win32&apos;" Label="PropertySheets">
<Import Condition="exists(&apos;$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props&apos;)" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_md|Win32'" Label="PropertySheets">
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup>
<ImportGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|Win32&apos;" Label="PropertySheets">
<Import Condition="exists(&apos;$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props&apos;)" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='release_static_mt|Win32'" Label="PropertySheets">
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup>
<ImportGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|Win32&apos;" Label="PropertySheets">
<Import Condition="exists(&apos;$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props&apos;)" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|Win32'" Label="PropertySheets">
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup>
<ImportGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|Win32&apos;" Label="PropertySheets">
<Import Condition="exists(&apos;$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props&apos;)" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='release_shared|Win32'" Label="PropertySheets">
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup>
<ImportGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|Win32&apos;" Label="PropertySheets">
<Import Condition="exists(&apos;$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props&apos;)" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'" Label="PropertySheets">
<Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros"/>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
<OutDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|Win32&apos;">bin\</OutDir>
<IntDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|Win32&apos;">obj\$(Configuration)\</IntDir>
<LinkIncremental Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|Win32&apos;">true</LinkIncremental>
<OutDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|Win32&apos;">bin\</OutDir>
<IntDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|Win32&apos;">obj\$(Configuration)\</IntDir>
<LinkIncremental Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|Win32&apos;">false</LinkIncremental>
<OutDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|Win32&apos;">bin\static_mt\</OutDir>
<IntDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|Win32&apos;">obj\$(Configuration)\</IntDir>
<LinkIncremental Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|Win32&apos;">true</LinkIncremental>
<OutDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|Win32&apos;">bin\static_mt\</OutDir>
<IntDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|Win32&apos;">obj\$(Configuration)\</IntDir>
<LinkIncremental Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|Win32&apos;">false</LinkIncremental>
<OutDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|Win32&apos;">bin\static_md\</OutDir>
<IntDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|Win32&apos;">obj\$(Configuration)\</IntDir>
<LinkIncremental Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|Win32&apos;">true</LinkIncremental>
<OutDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|Win32&apos;">bin\static_md\</OutDir>
<IntDir Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|Win32&apos;">obj\$(Configuration)\</IntDir>
<LinkIncremental Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|Win32&apos;">false</LinkIncremental>
<TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|Win32&apos;">TestSuited</TargetName>
<TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|Win32&apos;">TestSuited</TargetName>
<TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|Win32&apos;">TestSuited</TargetName>
<TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|Win32&apos;">TestSuite</TargetName>
<TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|Win32&apos;">TestSuite</TargetName>
<TargetName Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|Win32&apos;">TestSuite</TargetName>
<OutDir Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'">bin\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'">obj\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='release_shared|Win32'">bin\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='release_shared|Win32'">obj\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='release_shared|Win32'">false</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|Win32'">bin\static_mt\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|Win32'">obj\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|Win32'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='release_static_mt|Win32'">bin\static_mt\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='release_static_mt|Win32'">obj\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='release_static_mt|Win32'">false</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='debug_static_md|Win32'">bin\static_md\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='debug_static_md|Win32'">obj\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='debug_static_md|Win32'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='release_static_md|Win32'">bin\static_md\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='release_static_md|Win32'">obj\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='release_static_md|Win32'">false</LinkIncremental>
<TargetName Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'">TestSuited</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='debug_static_md|Win32'">TestSuited</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|Win32'">TestSuited</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='release_shared|Win32'">TestSuite</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='release_static_md|Win32'">TestSuite</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='release_static_mt|Win32'">TestSuite</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_shared|Win32&apos;">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'">
<IncludePath>C:\Program Files (x86)\MySQL\Connector C 6.0.2\include;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);</IncludePath>
<LibraryPath>C:\Program Files (x86)\MySQL\Connector C 6.0.2\lib\debug;$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSDK_LibraryPath_x86);</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug_shared|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\include;..\..\..\CppUnit\include;..\..\..\CppUnit\WinTestRunner\include;..\..\..\Foundation\include;..\..\..\Data\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -130,7 +134,7 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CompileAs>Default</CompileAs>
@ -147,7 +151,7 @@
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_shared|Win32&apos;">
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release_shared|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
@ -162,9 +166,9 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat/>
<DebugInformationFormat />
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
@ -179,7 +183,7 @@
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_mt|Win32&apos;">
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_mt|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\include;..\..\..\CppUnit\include;..\..\..\CppUnit\WinTestRunner\include;..\..\..\Foundation\include;..\..\..\Data\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -192,7 +196,7 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CompileAs>Default</CompileAs>
@ -210,7 +214,7 @@
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_mt|Win32&apos;">
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release_static_mt|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
@ -225,9 +229,9 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat/>
<DebugInformationFormat />
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
@ -243,7 +247,7 @@
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;debug_static_md|Win32&apos;">
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug_static_md|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\include;..\..\..\CppUnit\include;..\..\..\CppUnit\WinTestRunner\include;..\..\..\Foundation\include;..\..\..\Data\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -256,7 +260,7 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CompileAs>Default</CompileAs>
@ -273,7 +277,7 @@
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="&apos;$(Configuration)|$(Platform)&apos;==&apos;release_static_md|Win32&apos;">
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release_static_md|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
@ -288,9 +292,9 @@
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader/>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat/>
<DebugInformationFormat />
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
@ -306,16 +310,16 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="src\MySQLTest.h"/>
<ClInclude Include="src\SQLExecutor.h"/>
<ClInclude Include="src\MySQLTestSuite.h"/>
<ClInclude Include="src\MySQLTest.h" />
<ClInclude Include="src\SQLExecutor.h" />
<ClInclude Include="src\MySQLTestSuite.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\MySQLTest.cpp"/>
<ClCompile Include="src\SQLExecutor.cpp"/>
<ClCompile Include="src\MySQLTestSuite.cpp"/>
<ClCompile Include="src\WinDriver.cpp"/>
<ClCompile Include="src\MySQLTest.cpp" />
<ClCompile Include="src\SQLExecutor.cpp" />
<ClCompile Include="src\MySQLTestSuite.cpp" />
<ClCompile Include="src\WinDriver.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
<ImportGroup Label="ExtensionTargets"/>
</Project>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets" />
</Project>

View File

@ -71,8 +71,10 @@ class ODBC_API Extractor: public Poco::Data::AbstractExtractor
/// If NULL is received, the incoming val value is not changed and false is returned
{
public:
typedef Preparator::Ptr PreparatorPtr;
Extractor(const StatementHandle& rStmt,
Preparator& rPreparator);
Preparator::Ptr pPreparator);
/// Creates the Extractor.
~Extractor();
@ -370,8 +372,8 @@ private:
bool extractBoundImpl(std::size_t pos, T& val)
{
if (isNull(pos)) return false;
poco_assert_dbg (typeid(T) == _rPreparator[pos].type());
val = *AnyCast<T>(&_rPreparator[pos]);
poco_assert_dbg (typeid(T) == _pPreparator->at(pos).type());
val = *AnyCast<T>(&_pPreparator->at(pos));
return true;
}
@ -382,8 +384,8 @@ private:
bool extractBoundImplContainer(std::size_t pos, C& val)
{
typedef typename C::value_type Type;
poco_assert_dbg (typeid(std::vector<Type>) == _rPreparator[pos].type());
std::vector<Type>& v = RefAnyCast<std::vector<Type> >(_rPreparator[pos]);
poco_assert_dbg (typeid(std::vector<Type>) == _pPreparator->at(pos).type());
std::vector<Type>& v = RefAnyCast<std::vector<Type> >(_pPreparator->at(pos));
val.assign(v.begin(), v.end());
return true;
}
@ -405,14 +407,14 @@ private:
typedef typename C::iterator ItType;
typedef typename StringType::value_type CharType;
CharType** pc = AnyCast<CharType*>(&_rPreparator[pos]);
CharType** pc = AnyCast<CharType*>(&(_pPreparator->at(pos)));
poco_assert_dbg (pc);
poco_assert_dbg (_rPreparator.bulkSize() == values.size());
poco_assert_dbg (_pPreparator->bulkSize() == values.size());
std::size_t colWidth = columnSize(pos);
ItType it = values.begin();
ItType end = values.end();
for (int row = 0; it != end; ++it, ++row)
it->assign(*pc + row * colWidth, _rPreparator.actualDataSize(pos, row));
it->assign(*pc + row * colWidth, _pPreparator->actualDataSize(pos, row));
return true;
}
@ -424,14 +426,14 @@ private:
typedef typename LOBType::ValueType CharType;
typedef typename C::iterator ItType;
CharType** pc = AnyCast<CharType*>(&_rPreparator[pos]);
CharType** pc = AnyCast<CharType*>(&(_pPreparator->at(pos)));
poco_assert_dbg (pc);
poco_assert_dbg (_rPreparator.bulkSize() == values.size());
std::size_t colWidth = _rPreparator.maxDataSize(pos);
poco_assert_dbg (_pPreparator->bulkSize() == values.size());
std::size_t colWidth = _pPreparator->maxDataSize(pos);
ItType it = values.begin();
ItType end = values.end();
for (int row = 0; it != end; ++it, ++row)
it->assignRaw(*pc + row * colWidth, _rPreparator.actualDataSize(pos, row));
it->assignRaw(*pc + row * colWidth, _pPreparator->actualDataSize(pos, row));
return true;
}
@ -441,9 +443,9 @@ private:
{
if (isNull(pos)) return false;
std::size_t dataSize = _rPreparator.actualDataSize(pos);
std::size_t dataSize = _pPreparator->actualDataSize(pos);
checkDataSize(dataSize);
T* sp = AnyCast<T*>(_rPreparator[pos]);
T* sp = AnyCast<T*>(_pPreparator->at(pos));
val.assignRaw(sp, dataSize);
return true;
@ -569,10 +571,10 @@ private:
SQLINTEGER columnSize(std::size_t pos) const;
const StatementHandle& _rStmt;
Preparator& _rPreparator;
const StatementHandle& _rStmt;
PreparatorPtr _pPreparator;
Preparator::DataExtraction _dataExtraction;
std::vector<SQLLEN> _lengths;
std::vector<SQLLEN> _lengths;
};
@ -654,7 +656,7 @@ inline bool Extractor::extractBoundImplContainer(std::size_t pos,
inline void Extractor::setDataExtraction(Preparator::DataExtraction ext)
{
_rPreparator.setDataExtraction(_dataExtraction = ext);
_pPreparator->setDataExtraction(_dataExtraction = ext);
}
@ -686,7 +688,7 @@ inline bool Extractor::isNullLengthIndicator(SQLLEN val) const
inline SQLINTEGER Extractor::columnSize(std::size_t pos) const
{
std::size_t size = ODBCMetaColumn(_rStmt, pos).length();
std::size_t maxSize = _rPreparator.maxDataSize(pos);
std::size_t maxSize = _pPreparator->maxDataSize(pos);
if (size > maxSize) size = maxSize;
return (SQLINTEGER) size;
}

View File

@ -104,10 +104,10 @@ protected:
void bindImpl();
/// Binds all parameters and executes the statement.
AbstractExtractor& extractor();
AbstractExtraction::ExtractorPtr extractor();
/// Returns the concrete extractor used by the statement.
AbstractBinder& binder();
AbstractBinding::BinderPtr binder();
/// Returns the concrete binder used by the statement.
std::string nativeSQL();
@ -181,18 +181,18 @@ private:
//
// inlines
//
inline AbstractExtractor& ODBCStatementImpl::extractor()
inline AbstractExtraction::ExtractorPtr ODBCStatementImpl::extractor()
{
poco_assert_dbg (currentDataSet() < _extractors.size());
poco_assert_dbg (_extractors[currentDataSet()]);
return *_extractors[currentDataSet()];
return _extractors[currentDataSet()];
}
inline AbstractBinder& ODBCStatementImpl::binder()
inline AbstractBinding::BinderPtr ODBCStatementImpl::binder()
{
poco_assert_dbg (_pBinder);
return *_pBinder;
poco_assert_dbg (!_pBinder.isNull());
return _pBinder;
}

View File

@ -81,9 +81,9 @@ class ODBC_API Preparator : public AbstractPreparator
///
/// Preparator object is used to :
///
/// 1) Prepare SQL statement.
/// 2) Provide and contain the memory locations where retrieved values are placed during recordset iteration.
/// 3) Keep count of returned number of columns with their respective datatypes and sizes.
/// 1) Prepare SQL statement.
/// 2) Provide and contain the memory locations where retrieved values are placed during recordset iteration.
/// 3) Keep count of returned number of columns with their respective datatypes and sizes.
///
/// Notes:
///
@ -94,6 +94,7 @@ class ODBC_API Preparator : public AbstractPreparator
{
public:
typedef std::vector<char*> CharArray;
typedef SharedPtr<Preparator> Ptr;
enum DataExtraction
{
@ -390,6 +391,9 @@ public:
Poco::Any& operator [] (std::size_t pos);
/// Returns reference to column data.
Poco::Any& at(std::size_t pos);
/// Returns reference to column data.
void setMaxFieldSize(std::size_t size);
/// Sets maximum supported field size.
@ -1224,6 +1228,12 @@ inline Preparator::DataExtraction Preparator::getDataExtraction() const
inline Poco::Any& Preparator::operator [] (std::size_t pos)
{
return at(pos);
}
inline Poco::Any& Preparator::at(std::size_t pos)
{
return _values.at(pos);
}

View File

@ -55,10 +55,10 @@ const std::string Extractor::FLD_SIZE_EXCEEDED_FMT = "Specified data size (%z by
Extractor::Extractor(const StatementHandle& rStmt,
Preparator& rPreparator):
Preparator::Ptr pPreparator):
_rStmt(rStmt),
_rPreparator(rPreparator),
_dataExtraction(rPreparator.getDataExtraction())
_pPreparator(pPreparator),
_dataExtraction(pPreparator->getDataExtraction())
{
}
@ -73,8 +73,8 @@ bool Extractor::extractBoundImpl<std::string>(std::size_t pos, std::string& val)
{
if (isNull(pos)) return false;
std::size_t dataSize = _rPreparator.actualDataSize(pos);
char* sp = AnyCast<char*>(_rPreparator[pos]);
std::size_t dataSize = _pPreparator->actualDataSize(pos);
char* sp = AnyCast<char*>(_pPreparator->at(pos));
std::size_t len = std::strlen(sp);
if (len < dataSize) dataSize = len;
checkDataSize(dataSize);
@ -88,7 +88,7 @@ template<>
bool Extractor::extractBoundImpl<Poco::Data::Date>(std::size_t pos, Poco::Data::Date& val)
{
if (isNull(pos)) return false;
SQL_DATE_STRUCT& ds = *AnyCast<SQL_DATE_STRUCT>(&_rPreparator[pos]);
SQL_DATE_STRUCT& ds = *AnyCast<SQL_DATE_STRUCT>(&(_pPreparator->at(pos)));
Utility::dateSync(val, ds);
return true;
}
@ -98,7 +98,7 @@ template<>
bool Extractor::extractBoundImplContainer<std::vector<Poco::Data::Date> >(std::size_t pos,
std::vector<Poco::Data::Date>& val)
{
std::vector<SQL_DATE_STRUCT>& ds = RefAnyCast<std::vector<SQL_DATE_STRUCT> >(_rPreparator[pos]);
std::vector<SQL_DATE_STRUCT>& ds = RefAnyCast<std::vector<SQL_DATE_STRUCT> >(_pPreparator->at(pos));
Utility::dateSync(val, ds);
return true;
}
@ -108,7 +108,7 @@ template<>
bool Extractor::extractBoundImplContainer<std::deque<Poco::Data::Date> >(std::size_t pos,
std::deque<Poco::Data::Date>& val)
{
std::vector<SQL_DATE_STRUCT>& ds = RefAnyCast<std::vector<SQL_DATE_STRUCT> >(_rPreparator[pos]);
std::vector<SQL_DATE_STRUCT>& ds = RefAnyCast<std::vector<SQL_DATE_STRUCT> >(_pPreparator->at(pos));
Utility::dateSync(val, ds);
return true;
}
@ -118,7 +118,7 @@ template<>
bool Extractor::extractBoundImplContainer<std::list<Poco::Data::Date> >(std::size_t pos,
std::list<Poco::Data::Date>& val)
{
std::vector<SQL_DATE_STRUCT>& ds = RefAnyCast<std::vector<SQL_DATE_STRUCT> >(_rPreparator[pos]);
std::vector<SQL_DATE_STRUCT>& ds = RefAnyCast<std::vector<SQL_DATE_STRUCT> >(_pPreparator->at(pos));
Utility::dateSync(val, ds);
return true;
}
@ -129,9 +129,9 @@ bool Extractor::extractBoundImpl<Poco::Data::Time>(std::size_t pos, Poco::Data::
{
if (isNull(pos)) return false;
std::size_t dataSize = _rPreparator.actualDataSize(pos);
std::size_t dataSize = _pPreparator->actualDataSize(pos);
checkDataSize(dataSize);
SQL_TIME_STRUCT& ts = *AnyCast<SQL_TIME_STRUCT>(&_rPreparator[pos]);
SQL_TIME_STRUCT& ts = *AnyCast<SQL_TIME_STRUCT>(&_pPreparator->at(pos));
Utility::timeSync(val, ts);
return true;
@ -142,7 +142,7 @@ template<>
bool Extractor::extractBoundImplContainer<std::vector<Poco::Data::Time> >(std::size_t pos,
std::vector<Poco::Data::Time>& val)
{
std::vector<SQL_TIME_STRUCT>& ds = RefAnyCast<std::vector<SQL_TIME_STRUCT> >(_rPreparator[pos]);
std::vector<SQL_TIME_STRUCT>& ds = RefAnyCast<std::vector<SQL_TIME_STRUCT> >(_pPreparator->at(pos));
Utility::timeSync(val, ds);
return true;
}
@ -152,7 +152,7 @@ template<>
bool Extractor::extractBoundImplContainer<std::deque<Poco::Data::Time> >(std::size_t pos,
std::deque<Poco::Data::Time>& val)
{
std::vector<SQL_TIME_STRUCT>& ds = RefAnyCast<std::vector<SQL_TIME_STRUCT> >(_rPreparator[pos]);
std::vector<SQL_TIME_STRUCT>& ds = RefAnyCast<std::vector<SQL_TIME_STRUCT> >(_pPreparator->at(pos));
Utility::timeSync(val, ds);
return true;
}
@ -162,7 +162,7 @@ template<>
bool Extractor::extractBoundImplContainer<std::list<Poco::Data::Time> >(std::size_t pos,
std::list<Poco::Data::Time>& val)
{
std::vector<SQL_TIME_STRUCT>& ds = RefAnyCast<std::vector<SQL_TIME_STRUCT> >(_rPreparator[pos]);
std::vector<SQL_TIME_STRUCT>& ds = RefAnyCast<std::vector<SQL_TIME_STRUCT> >(_pPreparator->at(pos));
Utility::timeSync(val, ds);
return true;
}
@ -173,9 +173,9 @@ bool Extractor::extractBoundImpl<Poco::DateTime>(std::size_t pos, Poco::DateTime
{
if (isNull(pos)) return false;
std::size_t dataSize = _rPreparator.actualDataSize(pos);
std::size_t dataSize = _pPreparator->actualDataSize(pos);
checkDataSize(dataSize);
SQL_TIMESTAMP_STRUCT& tss = *AnyCast<SQL_TIMESTAMP_STRUCT>(&_rPreparator[pos]);
SQL_TIMESTAMP_STRUCT& tss = *AnyCast<SQL_TIMESTAMP_STRUCT>(&_pPreparator->at(pos));
Utility::dateTimeSync(val, tss);
return true;
@ -186,7 +186,7 @@ template<>
bool Extractor::extractBoundImplContainer<std::vector<Poco::DateTime> >(std::size_t pos,
std::vector<Poco::DateTime>& val)
{
std::vector<SQL_TIMESTAMP_STRUCT>& ds = RefAnyCast<std::vector<SQL_TIMESTAMP_STRUCT> >(_rPreparator[pos]);
std::vector<SQL_TIMESTAMP_STRUCT>& ds = RefAnyCast<std::vector<SQL_TIMESTAMP_STRUCT> >(_pPreparator->at(pos));
Utility::dateTimeSync(val, ds);
return true;
}
@ -196,7 +196,7 @@ template<>
bool Extractor::extractBoundImplContainer<std::deque<Poco::DateTime> >(std::size_t pos,
std::deque<Poco::DateTime>& val)
{
std::vector<SQL_TIMESTAMP_STRUCT>& ds = RefAnyCast<std::vector<SQL_TIMESTAMP_STRUCT> >(_rPreparator[pos]);
std::vector<SQL_TIMESTAMP_STRUCT>& ds = RefAnyCast<std::vector<SQL_TIMESTAMP_STRUCT> >(_pPreparator->at(pos));
Utility::dateTimeSync(val, ds);
return true;
}
@ -206,7 +206,7 @@ template<>
bool Extractor::extractBoundImplContainer<std::list<Poco::DateTime> >(std::size_t pos,
std::list<Poco::DateTime>& val)
{
std::vector<SQL_TIMESTAMP_STRUCT>& ds = RefAnyCast<std::vector<SQL_TIMESTAMP_STRUCT> >(_rPreparator[pos]);
std::vector<SQL_TIMESTAMP_STRUCT>& ds = RefAnyCast<std::vector<SQL_TIMESTAMP_STRUCT> >(_pPreparator->at(pos));
Utility::dateTimeSync(val, ds);
return true;
}
@ -216,8 +216,8 @@ template<>
bool Extractor::extractBoundImplContainer<std::vector<bool> >(std::size_t pos,
std::vector<bool>& val)
{
std::size_t length = _rPreparator.getLength();
bool** p = AnyCast<bool*>(&_rPreparator[pos]);
std::size_t length = _pPreparator->getLength();
bool** p = AnyCast<bool*>(&_pPreparator->at(pos));
val.assign(*p, *p + length);
return true;
}
@ -227,8 +227,8 @@ template<>
bool Extractor::extractBoundImplContainer<std::deque<bool> >(std::size_t pos,
std::deque<bool>& val)
{
std::size_t length = _rPreparator.getLength();
bool** p = AnyCast<bool*>(&_rPreparator[pos]);
std::size_t length = _pPreparator->getLength();
bool** p = AnyCast<bool*>(&_pPreparator->at(pos));
val.assign(*p, *p + length);
return true;
}
@ -238,8 +238,8 @@ template<>
bool Extractor::extractBoundImplContainer<std::list<bool> >(std::size_t pos,
std::list<bool>& val)
{
std::size_t length = _rPreparator.getLength();
bool** p = AnyCast<bool*>(&_rPreparator[pos]);
std::size_t length = _pPreparator->getLength();
bool** p = AnyCast<bool*>(&_pPreparator->at(pos));
val.assign(*p, *p + length);
return true;
}
@ -248,7 +248,7 @@ bool Extractor::extractBoundImplContainer<std::list<bool> >(std::size_t pos,
template<>
bool Extractor::extractManualImpl<std::string>(std::size_t pos, std::string& val, SQLSMALLINT cType)
{
std::size_t maxSize = _rPreparator.getMaxFieldSize();
std::size_t maxSize = _pPreparator->getMaxFieldSize();
std::size_t fetchedSize = 0;
std::size_t totalSize = 0;
@ -304,7 +304,7 @@ bool Extractor::extractManualImpl<Poco::Data::CLOB>(std::size_t pos,
Poco::Data::CLOB& val,
SQLSMALLINT cType)
{
std::size_t maxSize = _rPreparator.getMaxFieldSize();
std::size_t maxSize = _pPreparator->getMaxFieldSize();
std::size_t fetchedSize = 0;
std::size_t totalSize = 0;
@ -1209,13 +1209,13 @@ bool Extractor::isNull(std::size_t col, std::size_t row)
}
}
else
return SQL_NULL_DATA == _rPreparator.actualDataSize(col, row);
return SQL_NULL_DATA == _pPreparator->actualDataSize(col, row);
}
void Extractor::checkDataSize(std::size_t size)
{
std::size_t maxSize = _rPreparator.getMaxFieldSize();
std::size_t maxSize = _pPreparator->getMaxFieldSize();
if (size > maxSize)
throw DataException(format(FLD_SIZE_EXCEEDED_FMT, size, maxSize));
}

View File

@ -163,7 +163,7 @@ void ODBCStatementImpl::addPreparator()
else
_preparations.push_back(new Preparator(*_preparations[0]));
_extractors.push_back(new Extractor(_stmt, *_preparations.back()));
_extractors.push_back(new Extractor(_stmt, _preparations.back()));
}
@ -189,10 +189,10 @@ void ODBCStatementImpl::doPrepare()
for (std::size_t pos = 0; it != itEnd; ++it)
{
AbstractPreparation* pAP = (*it)->createPreparation(_preparations[curDataSet], pos);
Poco::Data::AbstractPreparator::Ptr pP = _preparations[curDataSet];
std::auto_ptr<AbstractPreparation> pAP((*it)->createPreparation(pP, pos));
pAP->prepare();
pos += (*it)->numOfColumnsHandled();
delete pAP;
}
_prepared = true;

View File

@ -104,10 +104,10 @@ protected:
void bindImpl();
/// Binds parameters
AbstractExtractor& extractor();
AbstractExtraction::ExtractorPtr extractor();
/// Returns the concrete extractor used by the statement.
AbstractBinder& binder();
AbstractBinding::BinderPtr binder();
/// Returns the concrete binder used by the statement.
private:
@ -144,15 +144,15 @@ private:
//
// inlines
//
inline AbstractExtractor& SQLiteStatementImpl::extractor()
inline AbstractExtraction::ExtractorPtr SQLiteStatementImpl::extractor()
{
return *_pExtractor;
return _pExtractor;
}
inline AbstractBinder& SQLiteStatementImpl::binder()
inline AbstractBinding::BinderPtr SQLiteStatementImpl::binder()
{
return *_pBinder;
return _pBinder;
}

View File

@ -74,6 +74,8 @@ class Data_API AbstractBinder
/// Interface for Binding data types to placeholders.
{
public:
typedef SharedPtr<AbstractBinder> Ptr;
enum Direction
/// Binding direction for a parameter.
{

View File

@ -55,10 +55,13 @@ namespace Poco {
namespace Data {
class Data_API AbstractBinding: public Poco::RefCountedObject
class Data_API AbstractBinding
/// AbstractBinding connects a value with a placeholder via an AbstractBinder interface.
{
public:
typedef SharedPtr<AbstractBinding> Ptr;
typedef AbstractBinder::Ptr BinderPtr;
enum Direction
{
PD_IN = AbstractBinder::PD_IN,
@ -72,10 +75,10 @@ public:
virtual ~AbstractBinding();
/// Destroys the AbstractBinding.
void setBinder(AbstractBinder* pBinder);
void setBinder(BinderPtr pBinder);
/// Sets the object used for binding; object does NOT take ownership of the pointer.
AbstractBinder* getBinder() const;
BinderPtr getBinder() const;
/// Returns the AbstractBinder used for binding data.
virtual std::size_t numOfColumnsHandled() const = 0;
@ -112,23 +115,22 @@ public:
/// Returns the size of the bulk binding.
private:
AbstractBinder* _pBinder;
std::string _name;
Direction _direction;
Poco::UInt32 _bulkSize;
BinderPtr _pBinder;
std::string _name;
Direction _direction;
Poco::UInt32 _bulkSize;
};
typedef Poco::AutoPtr<AbstractBinding> AbstractBindingPtr;
typedef std::vector<AbstractBindingPtr> AbstractBindingVec;
typedef std::deque<AbstractBindingPtr> AbstractBindingDeq;
typedef std::list<AbstractBindingPtr> AbstractBindingLst;
typedef std::vector<AbstractBinding::Ptr> AbstractBindingVec;
typedef std::deque<AbstractBinding::Ptr> AbstractBindingDeq;
typedef std::list<AbstractBinding::Ptr> AbstractBindingLst;
//
// inlines
//
inline AbstractBinder* AbstractBinding::getBinder() const
inline AbstractBinder::Ptr AbstractBinding::getBinder() const
{
return _pBinder;
}

View File

@ -59,11 +59,15 @@ class AbstractPreparation;
class AbstractPreparator;
class Data_API AbstractExtraction: public Poco::RefCountedObject
class Data_API AbstractExtraction
/// AbstractExtraction is the interface class that connects output positions to concrete values
/// retrieved via an AbstractExtractor.
{
public:
typedef SharedPtr<AbstractExtraction> Ptr;
typedef SharedPtr<AbstractExtractor> ExtractorPtr;
typedef SharedPtr<AbstractPreparator> PreparatorPtr;
AbstractExtraction(Poco::UInt32 limit = Limit::LIMIT_UNLIMITED,
Poco::UInt32 position = 0, bool bulk = false);
/// Creates the AbstractExtraction. A limit value equal to EXTRACT_UNLIMITED (0xffffffffu)
@ -73,10 +77,10 @@ public:
virtual ~AbstractExtraction();
/// Destroys the AbstractExtraction.
void setExtractor(AbstractExtractor* pExtractor);
void setExtractor(ExtractorPtr pExtractor);
/// Sets the class used for extracting the data. Does not take ownership of the pointer.
AbstractExtractor* getExtractor() const;
ExtractorPtr getExtractor() const;
/// Retrieves the extractor object
Poco::UInt32 position() const;
@ -109,8 +113,9 @@ public:
virtual bool canExtract() const;
/// Returns true. Implementations should override it for different behavior.
virtual AbstractPreparation* createPreparation(AbstractPreparator* pPrep, std::size_t pos) = 0;
/// Creates a Preparation object for the extracting object
virtual AbstractPreparation* createPreparation(PreparatorPtr& pPrep, std::size_t pos) = 0;
/// Creates a Preparation object for the extracting object. The returned pointer points to
/// a preparation object allocated on the heap; caller must take ownership of it.
void setLimit(Poco::UInt32 limit);
/// Sets the limit.
@ -161,34 +166,33 @@ public:
/// - getEmptyStringIsNull() returns true
private:
AbstractExtractor* _pExtractor;
Poco::UInt32 _limit;
Poco::UInt32 _position;
bool _bulk;
bool _emptyStringIsNull;
bool _forceEmptyString;
ExtractorPtr _pExtractor;
Poco::UInt32 _limit;
Poco::UInt32 _position;
bool _bulk;
bool _emptyStringIsNull;
bool _forceEmptyString;
};
typedef Poco::AutoPtr<AbstractExtraction> AbstractExtractionPtr;
typedef std::vector<AbstractExtractionPtr> AbstractExtractionVec;
typedef std::vector<AbstractExtractionVec> AbstractExtractionVecVec;
typedef std::deque<AbstractExtractionPtr> AbstractExtractionDeq;
typedef std::vector<AbstractExtractionDeq> AbstractExtractionDeqVec;
typedef std::list<AbstractExtractionPtr> AbstractExtractionLst;
typedef std::vector<AbstractExtractionLst> AbstractExtractionLstVec;
typedef std::vector<AbstractExtraction::Ptr> AbstractExtractionVec;
typedef std::vector<AbstractExtractionVec> AbstractExtractionVecVec;
typedef std::deque<AbstractExtraction::Ptr> AbstractExtractionDeq;
typedef std::vector<AbstractExtractionDeq> AbstractExtractionDeqVec;
typedef std::list<AbstractExtraction::Ptr> AbstractExtractionLst;
typedef std::vector<AbstractExtractionLst> AbstractExtractionLstVec;
//
// inlines
//
inline void AbstractExtraction::setExtractor(AbstractExtractor* pExtractor)
inline void AbstractExtraction::setExtractor(ExtractorPtr pExtractor)
{
_pExtractor = pExtractor;
}
inline AbstractExtractor* AbstractExtraction::getExtractor() const
inline AbstractExtraction::ExtractorPtr AbstractExtraction::getExtractor() const
{
return _pExtractor;
}

View File

@ -72,6 +72,8 @@ class Data_API AbstractExtractor
/// If an extractor receives null it is not allowed to change val!
{
public:
typedef SharedPtr<AbstractExtractor> Ptr;
AbstractExtractor();
/// Creates the AbstractExtractor.

View File

@ -41,6 +41,8 @@
#include "Poco/Data/Data.h"
#include "Poco/Data/AbstractPreparator.h"
#include "Poco/SharedPtr.h"
#include <cstddef>
@ -48,14 +50,14 @@ namespace Poco {
namespace Data {
class AbstractPreparator;
class Data_API AbstractPreparation
/// Interface for calling the appropriate AbstractPreparator method
{
public:
AbstractPreparation(AbstractPreparator* pPreparator);
typedef SharedPtr<AbstractPreparation> Ptr;
typedef AbstractPreparator::Ptr PreparatorPtr;
AbstractPreparation(PreparatorPtr pPreparator);
/// Creates the AbstractPreparation.
virtual ~AbstractPreparation();
@ -65,17 +67,17 @@ public:
/// Preparations data.
protected:
AbstractPreparator* preparation();
PreparatorPtr preparation();
/// Returns the preparation object
AbstractPreparator* _pPreparator;
PreparatorPtr _pPreparator;
};
//
// inlines
//
inline AbstractPreparator* AbstractPreparation::preparation()
inline AbstractPreparation::PreparatorPtr AbstractPreparation::preparation()
{
return _pPreparator;
}

View File

@ -78,6 +78,8 @@ class Data_API AbstractPreparator: public Poco::RefCountedObject
/// after SQL execution (e.g. SQLite) do not need this functionality at all.
{
public:
typedef SharedPtr<AbstractPreparator> Ptr;
AbstractPreparator(Poco::UInt32 length = 1u);
/// Creates the AbstractPreparator.

View File

@ -73,6 +73,10 @@ class Binding: public AbstractBinding
/// function. An attempt to pass a constant by reference shall result in compile-time error.
{
public:
typedef typename T ValType;
typedef Binding<ValType> Type;
typedef SharedPtr<Type> Ptr;
explicit Binding(T& val,
const std::string& name = "",
Direction direction = PD_IN):
@ -106,7 +110,7 @@ public:
void bind(std::size_t pos)
{
poco_assert_dbg(getBinder() != 0);
poco_assert_dbg(!getBinder().isNull());
TypeHandler<T>::bind(pos, _val, getBinder(), getDirection());
_bound = true;
}
@ -114,8 +118,8 @@ public:
void reset ()
{
_bound = false;
AbstractBinder* pBinder = getBinder();
poco_check_ptr (pBinder);
AbstractBinder::Ptr pBinder = getBinder();
poco_assert_dbg (!pBinder.isNull());
pBinder->reset();
}
@ -136,10 +140,13 @@ class CopyBinding: public AbstractBinding
/// is passed to binding, the storage it refers to must be valid at the statement execution time.
/// To pass a copy of a variable, constant or string literal, use utility function bind().
/// Variables can be passed as either copies or references (i.e. using either use() or bind()).
/// Constants, however, can only be passed as copies. this is best achieved using bind() utility
/// function. An attempt to pass a constant by reference shall result in compile-time error.
{
public:
typedef typename T ValType;
typedef SharedPtr<ValType> ValPtr;
typedef CopyBinding<ValType> Type;
typedef SharedPtr<Type> Ptr;
explicit CopyBinding(T& val,
const std::string& name = "",
Direction direction = PD_IN):
@ -173,7 +180,7 @@ public:
void bind(std::size_t pos)
{
poco_assert_dbg(getBinder() != 0);
poco_assert_dbg(!getBinder().isNull());
TypeHandler<T>::bind(pos, *_pVal, getBinder(), getDirection());
_bound = true;
}
@ -181,15 +188,15 @@ public:
void reset ()
{
_bound = false;
AbstractBinder* pBinder = getBinder();
poco_check_ptr (pBinder);
AbstractBinder::Ptr pBinder = getBinder();
poco_assert_dbg (!pBinder.isNull());
pBinder->reset();
}
private:
typedef typename TypeWrapper<T>::TYPE ValueType;
SharedPtr<ValueType> _pVal;
bool _bound;
//typedef typename TypeWrapper<T>::TYPE ValueType;
ValPtr _pVal;
bool _bound;
};
@ -198,6 +205,11 @@ class Binding<const char*>: public AbstractBinding
/// Binding const char* specialization wraps char pointer into string.
{
public:
typedef const char* ValType;
typedef SharedPtr<ValType> ValPtr;
typedef Binding<const char*> Type;
typedef SharedPtr<Type> Ptr;
explicit Binding(const char* pVal,
const std::string& name = "",
Direction direction = PD_IN):
@ -230,7 +242,7 @@ public:
void bind(std::size_t pos)
{
poco_assert_dbg(getBinder() != 0);
poco_assert_dbg(!getBinder().isNull());
TypeHandler<std::string>::bind(pos, _val, getBinder(), getDirection());
_bound = true;
}
@ -238,8 +250,8 @@ public:
void reset ()
{
_bound = false;
AbstractBinder* pBinder = getBinder();
poco_check_ptr (pBinder);
AbstractBinder::Ptr pBinder = getBinder();
poco_assert_dbg (!pBinder.isNull());
pBinder->reset();
}
@ -255,6 +267,11 @@ class CopyBinding<const char*>: public AbstractBinding
/// Binding const char* specialization wraps char pointer into string.
{
public:
typedef const char* ValType;
typedef SharedPtr<ValType> ValPtr;
typedef CopyBinding<const char*> Type;
typedef SharedPtr<Type> Ptr;
explicit CopyBinding(const char* pVal,
const std::string& name = "",
Direction direction = PD_IN):
@ -287,7 +304,7 @@ public:
void bind(std::size_t pos)
{
poco_assert_dbg(getBinder() != 0);
poco_assert_dbg(!getBinder().isNull());
TypeHandler<std::string>::bind(pos, _val, getBinder(), getDirection());
_bound = true;
}
@ -295,8 +312,8 @@ public:
void reset ()
{
_bound = false;
AbstractBinder* pBinder = getBinder();
poco_check_ptr (pBinder);
AbstractBinder::Ptr pBinder = getBinder();
poco_assert_dbg (!pBinder.isNull());
pBinder->reset();
}
@ -311,6 +328,11 @@ class Binding<std::vector<T> >: public AbstractBinding
/// Specialization for std::vector.
{
public:
typedef std::vector<T> ValType;
typedef SharedPtr<ValType> ValPtr;
typedef SharedPtr<Binding<ValType> > Ptr;
typedef typename ValType::const_iterator Iterator;
explicit Binding(std::vector<T>& val,
const std::string& name = "",
Direction direction = PD_IN):
@ -347,7 +369,7 @@ public:
void bind(std::size_t pos)
{
poco_assert_dbg(getBinder() != 0);
poco_assert_dbg(!getBinder().isNull());
poco_assert_dbg(canBind());
TypeHandler<T>::bind(pos, *_begin, getBinder(), getDirection());
@ -361,12 +383,9 @@ public:
}
private:
typedef std::vector<T> Type;
typedef typename Type::const_iterator Iterator;
const Type& _val;
Iterator _begin;
Iterator _end;
const ValType& _val;
Iterator _begin;
Iterator _end;
};
@ -375,6 +394,12 @@ class CopyBinding<std::vector<T> >: public AbstractBinding
/// Specialization for std::vector.
{
public:
typedef std::vector<T> ValType;
typedef SharedPtr<ValType> ValPtr;
typedef SharedPtr<CopyBinding<ValType> > Ptr;
typedef typename ValType::const_iterator Iterator;
explicit CopyBinding(std::vector<T>& val,
const std::string& name = "",
Direction direction = PD_IN):
@ -411,7 +436,7 @@ public:
void bind(std::size_t pos)
{
poco_assert_dbg(getBinder() != 0);
poco_assert_dbg(!getBinder().isNull());
poco_assert_dbg(canBind());
TypeHandler<T>::bind(pos, *_begin, getBinder(), getDirection());
@ -425,13 +450,9 @@ public:
}
private:
typedef std::vector<T> Type;
typedef SharedPtr<Type> TypePtr;
typedef typename Type::const_iterator Iterator;
TypePtr _pVal;
Iterator _begin;
Iterator _end;
ValPtr _pVal;
Iterator _begin;
Iterator _end;
};
@ -451,6 +472,11 @@ class Binding<std::vector<bool> >: public AbstractBinding
/// Only IN binding is supported.
{
public:
typedef std::vector<bool> ValType;
typedef SharedPtr<ValType> ValPtr;
typedef SharedPtr<Binding<ValType> > Ptr;
typedef ValType::const_iterator Iterator;
explicit Binding(const std::vector<bool>& val,
const std::string& name = "",
Direction direction = PD_IN):
@ -491,7 +517,7 @@ public:
void bind(std::size_t pos)
{
poco_assert_dbg(getBinder() != 0);
poco_assert_dbg(!getBinder().isNull());
poco_assert_dbg(canBind());
TypeHandler<bool>::bind(pos, *_begin, getBinder(), getDirection());
++_begin;
@ -528,6 +554,11 @@ class CopyBinding<std::vector<bool> >: public AbstractBinding
/// Only IN binding is supported.
{
public:
typedef std::vector<bool> ValType;
typedef SharedPtr<ValType> ValPtr;
typedef SharedPtr<CopyBinding<ValType> > Ptr;
typedef ValType::const_iterator Iterator;
explicit CopyBinding(const std::vector<bool>& val,
const std::string& name = "",
Direction direction = PD_IN):
@ -568,11 +599,10 @@ public:
void bind(std::size_t pos)
{
poco_assert_dbg(getBinder() != 0);
poco_assert_dbg(!getBinder().isNull());
poco_assert_dbg(canBind());
TypeHandler<bool>::bind(pos, *_begin, getBinder(), getDirection());
++_begin;
}
void reset()
@ -593,6 +623,11 @@ class Binding<std::list<T> >: public AbstractBinding
/// Specialization for std::list.
{
public:
typedef std::list<T> ValType;
typedef SharedPtr<ValType> ValPtr;
typedef SharedPtr<Binding<ValType> > Ptr;
typedef typename ValType::const_iterator Iterator;
explicit Binding(std::list<T>& val,
const std::string& name = "",
Direction direction = PD_IN):
@ -629,7 +664,7 @@ public:
void bind(std::size_t pos)
{
poco_assert_dbg(getBinder() != 0);
poco_assert_dbg(!getBinder().isNull());
poco_assert_dbg(canBind());
TypeHandler<T>::bind(pos, *_begin, getBinder(), getDirection());
++_begin;
@ -642,12 +677,9 @@ public:
}
private:
typedef std::list<T> Type;
typedef typename Type::const_iterator Iterator;
const Type& _val;
Iterator _begin;
Iterator _end;
const ValType& _val;
Iterator _begin;
Iterator _end;
};
@ -656,7 +688,12 @@ class CopyBinding<std::list<T> >: public AbstractBinding
/// Specialization for std::list.
{
public:
explicit CopyBinding(std::list<T>& val,
typedef typename std::list<T> ValType;
typedef SharedPtr<ValType> ValPtr;
typedef SharedPtr<CopyBinding<ValType> > Ptr;
typedef typename ValType::const_iterator Iterator;
explicit CopyBinding(ValType& val,
const std::string& name = "",
Direction direction = PD_IN):
AbstractBinding(name, direction),
@ -692,7 +729,7 @@ public:
void bind(std::size_t pos)
{
poco_assert_dbg(getBinder() != 0);
poco_assert_dbg(!getBinder().isNull());
poco_assert_dbg(canBind());
TypeHandler<T>::bind(pos, *_begin, getBinder(), getDirection());
++_begin;
@ -705,13 +742,9 @@ public:
}
private:
typedef std::list<T> Type;
typedef SharedPtr<Type> TypePtr;
typedef typename Type::const_iterator Iterator;
TypePtr _pVal;
Iterator _begin;
Iterator _end;
ValPtr _pVal;
Iterator _begin;
Iterator _end;
};
@ -720,6 +753,11 @@ class Binding<std::deque<T> >: public AbstractBinding
/// Specialization for std::deque.
{
public:
typedef std::deque<T> ValType;
typedef SharedPtr<ValType> ValPtr;
typedef SharedPtr<Binding<ValType> > Ptr;
typedef typename ValType::const_iterator Iterator;
explicit Binding(std::deque<T>& val,
const std::string& name = "",
Direction direction = PD_IN):
@ -756,7 +794,7 @@ public:
void bind(std::size_t pos)
{
poco_assert_dbg(getBinder() != 0);
poco_assert_dbg(!getBinder().isNull());
poco_assert_dbg(canBind());
TypeHandler<T>::bind(pos, *_begin, getBinder(), getDirection());
++_begin;
@ -769,12 +807,9 @@ public:
}
private:
typedef std::deque<T> Type;
typedef typename Type::const_iterator Iterator;
const Type& _val;
Iterator _begin;
Iterator _end;
const ValType& _val;
Iterator _begin;
Iterator _end;
};
@ -783,6 +818,11 @@ class CopyBinding<std::deque<T> >: public AbstractBinding
/// Specialization for std::deque.
{
public:
typedef std::deque<T> ValType;
typedef SharedPtr<ValType> ValPtr;
typedef SharedPtr<CopyBinding<ValType> > Ptr;
typedef typename ValType::const_iterator Iterator;
explicit CopyBinding(std::deque<T>& val,
const std::string& name = "",
Direction direction = PD_IN):
@ -819,7 +859,7 @@ public:
void bind(std::size_t pos)
{
poco_assert_dbg(getBinder() != 0);
poco_assert_dbg(!getBinder().isNull());
poco_assert_dbg(canBind());
TypeHandler<T>::bind(pos, *_begin, getBinder(), getDirection());
++_begin;
@ -832,13 +872,9 @@ public:
}
private:
typedef std::deque<T> Type;
typedef SharedPtr<Type> TypePtr;
typedef typename Type::const_iterator Iterator;
TypePtr _pVal;
Iterator _begin;
Iterator _end;
ValPtr _pVal;
Iterator _begin;
Iterator _end;
};
@ -847,6 +883,11 @@ class Binding<std::set<T> >: public AbstractBinding
/// Specialization for std::set.
{
public:
typedef std::set<T> ValType;
typedef SharedPtr<ValType> ValPtr;
typedef SharedPtr<Binding<ValType> > Ptr;
typedef typename ValType::const_iterator Iterator;
explicit Binding(std::set<T>& val,
const std::string& name = "",
Direction direction = PD_IN):
@ -883,7 +924,7 @@ public:
void bind(std::size_t pos)
{
poco_assert_dbg(getBinder() != 0);
poco_assert_dbg(!getBinder().isNull());
poco_assert_dbg(canBind());
TypeHandler<T>::bind(pos, *_begin, getBinder(), getDirection());
++_begin;
@ -896,12 +937,9 @@ public:
}
private:
typedef std::set<T> Type;
typedef typename Type::const_iterator Iterator;
const Type& _val;
Iterator _begin;
Iterator _end;
const ValType& _val;
Iterator _begin;
Iterator _end;
};
@ -910,6 +948,11 @@ class CopyBinding<std::set<T> >: public AbstractBinding
/// Specialization for std::set.
{
public:
typedef std::set<T> ValType;
typedef SharedPtr<ValType> ValPtr;
typedef SharedPtr<CopyBinding<ValType> > Ptr;
typedef typename ValType::const_iterator Iterator;
explicit CopyBinding(std::set<T>& val,
const std::string& name = "",
Direction direction = PD_IN):
@ -946,7 +989,7 @@ public:
void bind(std::size_t pos)
{
poco_assert_dbg(getBinder() != 0);
poco_assert_dbg(!getBinder().isNull());
poco_assert_dbg(canBind());
TypeHandler<T>::bind(pos, *_begin, getBinder(), getDirection());
++_begin;
@ -959,13 +1002,9 @@ public:
}
private:
typedef std::set<T> Type;
typedef SharedPtr<Type> TypePtr;
typedef typename Type::const_iterator Iterator;
TypePtr _pVal;
Iterator _begin;
Iterator _end;
ValPtr _pVal;
Iterator _begin;
Iterator _end;
};
@ -974,6 +1013,11 @@ class Binding<std::multiset<T> >: public AbstractBinding
/// Specialization for std::multiset.
{
public:
typedef std::multiset<T> ValType;
typedef SharedPtr<ValType> ValPtr;
typedef SharedPtr<Binding<ValType> > Ptr;
typedef typename ValType::const_iterator Iterator;
explicit Binding(std::multiset<T>& val,
const std::string& name = "",
Direction direction = PD_IN):
@ -1010,7 +1054,7 @@ public:
void bind(std::size_t pos)
{
poco_assert_dbg(getBinder() != 0);
poco_assert_dbg(!getBinder().isNull());
poco_assert_dbg(canBind());
TypeHandler<T>::bind(pos, *_begin, getBinder(), getDirection());
++_begin;
@ -1023,12 +1067,9 @@ public:
}
private:
typedef std::multiset<T> Type;
typedef typename Type::const_iterator Iterator;
const Type& _val;
Iterator _begin;
Iterator _end;
const ValType& _val;
Iterator _begin;
Iterator _end;
};
@ -1037,6 +1078,11 @@ class CopyBinding<std::multiset<T> >: public AbstractBinding
/// Specialization for std::multiset.
{
public:
typedef std::multiset<T> ValType;
typedef SharedPtr<ValType> ValPtr;
typedef SharedPtr<CopyBinding<ValType> > Ptr;
typedef typename ValType::const_iterator Iterator;
explicit CopyBinding(std::multiset<T>& val,
const std::string& name = "",
Direction direction = PD_IN):
@ -1073,7 +1119,7 @@ public:
void bind(std::size_t pos)
{
poco_assert_dbg(getBinder() != 0);
poco_assert_dbg(!getBinder().isNull());
poco_assert_dbg(canBind());
TypeHandler<T>::bind(pos, *_begin, getBinder(), getDirection());
++_begin;
@ -1086,13 +1132,9 @@ public:
}
private:
typedef std::multiset<T> Type;
typedef SharedPtr<Type> TypePtr;
typedef typename Type::const_iterator Iterator;
TypePtr _pVal;
Iterator _begin;
Iterator _end;
ValPtr _pVal;
Iterator _begin;
Iterator _end;
};
@ -1101,6 +1143,11 @@ class Binding<std::map<K, V> >: public AbstractBinding
/// Specialization for std::map.
{
public:
typedef std::map<K, V> ValType;
typedef SharedPtr<ValType> ValPtr;
typedef SharedPtr<Binding<ValType> > Ptr;
typedef typename ValType::const_iterator Iterator;
explicit Binding(std::map<K, V>& val,
const std::string& name = "",
Direction direction = PD_IN):
@ -1137,7 +1184,7 @@ public:
void bind(std::size_t pos)
{
poco_assert_dbg(getBinder() != 0);
poco_assert_dbg(!getBinder().isNull());
poco_assert_dbg(canBind());
TypeHandler<V>::bind(pos, _begin->second, getBinder(), getDirection());
++_begin;
@ -1150,12 +1197,9 @@ public:
}
private:
typedef std::map<K, V> Type;
typedef typename Type::const_iterator Iterator;
const Type& _val;
Iterator _begin;
Iterator _end;
const ValType& _val;
Iterator _begin;
Iterator _end;
};
@ -1164,6 +1208,11 @@ class CopyBinding<std::map<K, V> >: public AbstractBinding
/// Specialization for std::map.
{
public:
typedef std::map<K, V> ValType;
typedef SharedPtr<ValType> ValPtr;
typedef SharedPtr<CopyBinding<ValType> > Ptr;
typedef typename ValType::const_iterator Iterator;
explicit CopyBinding(std::map<K, V>& val,
const std::string& name = "",
Direction direction = PD_IN):
@ -1200,7 +1249,7 @@ public:
void bind(std::size_t pos)
{
poco_assert_dbg(getBinder() != 0);
poco_assert_dbg(!getBinder().isNull());
poco_assert_dbg(canBind());
TypeHandler<V>::bind(pos, _begin->second, getBinder(), getDirection());
++_begin;
@ -1213,13 +1262,9 @@ public:
}
private:
typedef std::map<K, V> Type;
typedef SharedPtr<Type> TypePtr;
typedef typename Type::const_iterator Iterator;
TypePtr _pVal;
Iterator _begin;
Iterator _end;
ValPtr _pVal;
Iterator _begin;
Iterator _end;
};
@ -1228,6 +1273,11 @@ class Binding<std::multimap<K, V> >: public AbstractBinding
/// Specialization for std::multimap.
{
public:
typedef std::multimap<K, V> ValType;
typedef SharedPtr<ValType> ValPtr;
typedef SharedPtr<Binding<ValType> > Ptr;
typedef typename ValType::const_iterator Iterator;
explicit Binding(std::multimap<K, V>& val,
const std::string& name = "",
Direction direction = PD_IN):
@ -1264,7 +1314,7 @@ public:
void bind(std::size_t pos)
{
poco_assert_dbg(getBinder() != 0);
poco_assert_dbg(!getBinder().isNull());
poco_assert_dbg(canBind());
TypeHandler<V>::bind(pos, _begin->second, getBinder(), getDirection());
++_begin;
@ -1277,12 +1327,9 @@ public:
}
private:
typedef std::multimap<K, V> Type;
typedef typename Type::const_iterator Iterator;
const Type& _val;
Iterator _begin;
Iterator _end;
const ValType& _val;
Iterator _begin;
Iterator _end;
};
@ -1291,6 +1338,11 @@ class CopyBinding<std::multimap<K, V> >: public AbstractBinding
/// Specialization for std::multimap.
{
public:
typedef std::multimap<K, V> ValType;
typedef SharedPtr<ValType> ValPtr;
typedef SharedPtr<CopyBinding<ValType> > Ptr;
typedef typename ValType::const_iterator Iterator;
explicit CopyBinding(std::multimap<K, V>& val,
const std::string& name = "",
Direction direction = PD_IN):
@ -1327,7 +1379,7 @@ public:
void bind(std::size_t pos)
{
poco_assert_dbg(getBinder() != 0);
poco_assert_dbg(!getBinder().isNull());
poco_assert_dbg(canBind());
TypeHandler<V>::bind(pos, _begin->second, getBinder(), getDirection());
++_begin;
@ -1340,13 +1392,9 @@ public:
}
private:
typedef std::multimap<K, V> Type;
typedef SharedPtr<Type> TypePtr;
typedef typename Type::const_iterator Iterator;
TypePtr _pVal;
Iterator _begin;
Iterator _end;
ValPtr _pVal;
Iterator _begin;
Iterator _end;
};
@ -1354,29 +1402,27 @@ namespace Keywords {
template <typename T>
inline Binding<T>* use(T& t, const std::string& name = "")
inline AbstractBinding::Ptr use(T& t, const std::string& name = "")
/// Convenience function for a more compact Binding creation.
{
// If this test fails with an error, you tried to pass a const ref value to use().
// Resolve this either by using bind (which will copy the value) or
// if you are sure that the const ref will still exist when execute is called
// (which can be much later!), then use the "useRef" keyword instead
// If this fails to compile, a const ref was passed to use().
// This can be resolved by either (a) using bind (which will copy the value),
// or (b) if the const ref is guaranteed to exist when execute is called
// (which can be much later!), by using the "useRef" keyword instead
poco_static_assert (!IsConst<T>::VALUE);
return new Binding<T>(t, name, AbstractBinding::PD_IN);
}
inline Binding<NullData>* use(const NullData& t, const std::string& name = "")
inline AbstractBinding::Ptr use(const NullData& t, const std::string& name = "")
/// NullData overload.
{
return new Binding<NullData>(const_cast<NullData&>(t), name, AbstractBinding::PD_IN);
}
template <typename T>
inline Binding<T>* useRef(T& t, const std::string& name = "")
inline AbstractBinding::Ptr useRef(T& t, const std::string& name = "")
/// Convenience function for a more compact Binding creation.
{
return new Binding<T>(t, name, AbstractBinding::PD_IN);
@ -1384,14 +1430,14 @@ inline Binding<T>* useRef(T& t, const std::string& name = "")
template <typename T>
inline Binding<T>* in(T& t, const std::string& name = "")
inline AbstractBinding::Ptr in(T& t, const std::string& name = "")
/// Convenience function for a more compact Binding creation.
{
return use(t, name);
}
inline Binding<NullData>* in(const NullData& t, const std::string& name = "")
inline AbstractBinding::Ptr in(const NullData& t, const std::string& name = "")
/// NullData overload.
{
return use(t, name);
@ -1399,7 +1445,7 @@ inline Binding<NullData>* in(const NullData& t, const std::string& name = "")
template <typename T>
inline Binding<T>* out(T& t)
inline AbstractBinding::Ptr out(T& t)
/// Convenience function for a more compact Binding creation.
{
poco_static_assert (!IsConst<T>::VALUE);
@ -1408,7 +1454,7 @@ inline Binding<T>* out(T& t)
template <typename T>
inline Binding<T>* io(T& t)
inline AbstractBinding::Ptr io(T& t)
/// Convenience function for a more compact Binding creation.
{
poco_static_assert (!IsConst<T>::VALUE);
@ -1445,7 +1491,7 @@ inline AbstractBindingVec& io(AbstractBindingVec& bv)
template <typename T>
inline CopyBinding<T>* bind(T t, const std::string& name)
inline AbstractBinding::Ptr bind(T t, const std::string& name)
/// Convenience function for a more compact Binding creation.
/// This funtion differs from use() in its value copy semantics.
{
@ -1454,11 +1500,11 @@ inline CopyBinding<T>* bind(T t, const std::string& name)
template <typename T>
inline CopyBinding<T>* bind(T t)
inline AbstractBinding::Ptr bind(T t)
/// Convenience function for a more compact Binding creation.
/// This funtion differs from use() in its value copy semantics.
{
return bind(t, "");
return Poco::Data::Keywords::bind(t, "");
}

View File

@ -93,7 +93,7 @@ public:
void bind(std::size_t pos)
{
poco_assert_dbg(getBinder() != 0);
poco_assert_dbg(!getBinder().isNull());
TypeHandler<T>::bind(pos, _val, getBinder(), getDirection());
_bound = true;
}
@ -114,7 +114,7 @@ namespace Keywords {
template <typename T>
BulkBinding<std::vector<T> >* use(const std::vector<T>& t, BulkFnType, const std::string& name = "")
AbstractBinding::Ptr use(const std::vector<T>& t, BulkFnType, const std::string& name = "")
/// Convenience function for a more compact BulkBinding creation for std::vector.
{
return new BulkBinding<std::vector<T> >(t, static_cast<Poco::UInt32>(t.size()), name);
@ -122,7 +122,7 @@ BulkBinding<std::vector<T> >* use(const std::vector<T>& t, BulkFnType, const std
template <typename T>
BulkBinding<std::vector<T> >* in(const std::vector<T>& t, BulkFnType, const std::string& name = "")
AbstractBinding::Ptr in(const std::vector<T>& t, BulkFnType, const std::string& name = "")
/// Convenience function for a more compact BulkBinding creation for std::vector.
{
return new BulkBinding<std::vector<T> >(t, static_cast<Poco::UInt32>(t.size()), name);
@ -130,7 +130,7 @@ BulkBinding<std::vector<T> >* in(const std::vector<T>& t, BulkFnType, const std:
template <typename T>
BulkBinding<std::deque<T> >* use(const std::deque<T>& t, BulkFnType, const std::string& name = "")
AbstractBinding::Ptr use(const std::deque<T>& t, BulkFnType, const std::string& name = "")
/// Convenience function for a more compact BulkBinding creation for std::deque.
{
return new BulkBinding<std::deque<T> >(t, static_cast<Poco::UInt32>(t.size()), name);
@ -138,7 +138,7 @@ BulkBinding<std::deque<T> >* use(const std::deque<T>& t, BulkFnType, const std::
template <typename T>
BulkBinding<std::deque<T> >* in(const std::deque<T>& t, BulkFnType, const std::string& name = "")
AbstractBinding::Ptr in(const std::deque<T>& t, BulkFnType, const std::string& name = "")
/// Convenience function for a more compact BulkBinding creation for std::deque.
{
return new BulkBinding<std::deque<T> >(t, static_cast<Poco::UInt32>(t.size()), name);
@ -146,7 +146,7 @@ BulkBinding<std::deque<T> >* in(const std::deque<T>& t, BulkFnType, const std::s
template <typename T>
BulkBinding<std::list<T> >* use(const std::list<T>& t, BulkFnType, const std::string& name = "")
AbstractBinding::Ptr use(const std::list<T>& t, BulkFnType, const std::string& name = "")
/// Convenience function for a more compact BulkBinding creation for std::list.
{
return new BulkBinding<std::list<T> >(t, static_cast<Poco::UInt32>(t.size()), name);
@ -154,7 +154,7 @@ BulkBinding<std::list<T> >* use(const std::list<T>& t, BulkFnType, const std::st
template <typename T>
BulkBinding<std::list<T> >* in(const std::list<T>& t, BulkFnType, const std::string& name = "")
AbstractBinding::Ptr in(const std::list<T>& t, BulkFnType, const std::string& name = "")
/// Convenience function for a more compact BulkBinding creation for std::list.
{
return new BulkBinding<std::list<T> >(t, static_cast<Poco::UInt32>(t.size()), name);

View File

@ -128,7 +128,7 @@ public:
{
}
AbstractPreparation* createPreparation(AbstractPreparator* pPrep, std::size_t col)
AbstractPreparation* createPreparation(AbstractPreparator::Ptr& pPrep, std::size_t col)
{
Poco::UInt32 limit = getLimit();
if (limit != _rResult.size()) _rResult.resize(limit);
@ -221,7 +221,7 @@ namespace Keywords {
template <typename T>
BulkExtraction<std::vector<T> >* into(std::vector<T>& t, const Bulk& bulk, const Position& pos = Position(0))
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.
{
@ -230,7 +230,7 @@ BulkExtraction<std::vector<T> >* into(std::vector<T>& t, const Bulk& bulk, const
template <typename T>
BulkExtraction<std::vector<T> >* into(std::vector<T>& t, BulkFnType, const Position& pos = Position(0))
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.
{
@ -241,7 +241,7 @@ BulkExtraction<std::vector<T> >* into(std::vector<T>& t, BulkFnType, const Posit
template <typename T>
BulkExtraction<std::deque<T> >* into(std::deque<T>& t, const Bulk& bulk, const Position& pos = Position(0))
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.
{
@ -250,7 +250,7 @@ BulkExtraction<std::deque<T> >* into(std::deque<T>& t, const Bulk& bulk, const P
template <typename T>
BulkExtraction<std::deque<T> >* into(std::deque<T>& t, BulkFnType, const Position& pos = Position(0))
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.
{
@ -261,7 +261,7 @@ BulkExtraction<std::deque<T> >* into(std::deque<T>& t, BulkFnType, const Positio
template <typename T>
BulkExtraction<std::list<T> >* into(std::list<T>& t, const Bulk& bulk, const Position& pos = Position(0))
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.
{
@ -270,7 +270,7 @@ BulkExtraction<std::list<T> >* into(std::list<T>& t, const Bulk& bulk, const Pos
template <typename T>
BulkExtraction<std::list<T> >* into(std::list<T>& t, BulkFnType, const Position& pos = Position(0))
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.
{

View File

@ -130,7 +130,7 @@ public:
return !_extracted;
}
AbstractPreparation* createPreparation(AbstractPreparator* pPrep, std::size_t pos)
AbstractPreparation* createPreparation(AbstractPreparator::Ptr& pPrep, std::size_t pos)
{
return new Preparation<T>(pPrep, pos, _rResult);
}
@ -204,7 +204,7 @@ public:
return 1u;
}
AbstractPreparation* createPreparation(AbstractPreparator* pPrep, std::size_t pos)
AbstractPreparation* createPreparation(AbstractPreparator::Ptr& pPrep, std::size_t pos)
{
return new Preparation<T>(pPrep, pos, _default);
}
@ -285,7 +285,7 @@ public:
return 1u;
}
AbstractPreparation* createPreparation(AbstractPreparator* pPrep, std::size_t pos)
AbstractPreparation* createPreparation(AbstractPreparator::Ptr& pPrep, std::size_t pos)
{
return new Preparation<bool>(pPrep, pos, _default);
}
@ -364,7 +364,7 @@ public:
return 1u;
}
AbstractPreparation* createPreparation(AbstractPreparator* pPrep, std::size_t pos)
AbstractPreparation* createPreparation(AbstractPreparator::Ptr& pPrep, std::size_t pos)
{
return new Preparation<T>(pPrep, pos, _default);
}
@ -443,7 +443,7 @@ public:
return 1u;
}
AbstractPreparation* createPreparation(AbstractPreparator* pPrep, std::size_t pos)
AbstractPreparation* createPreparation(AbstractPreparator::Ptr& pPrep, std::size_t pos)
{
return new Preparation<T>(pPrep, pos, _default);
}
@ -576,7 +576,7 @@ public:
return 1u;
}
AbstractPreparation* createPreparation(AbstractPreparator* pPrep, std::size_t pos)
AbstractPreparation* createPreparation(AbstractPreparator::Ptr& pPrep, std::size_t pos)
{
return new Preparation<T>(pPrep, pos, _default);
}
@ -635,7 +635,7 @@ public:
return 1u;
}
AbstractPreparation* createPreparation(AbstractPreparator* pPrep, std::size_t pos)
AbstractPreparation* createPreparation(AbstractPreparator::Ptr& pPrep, std::size_t pos)
{
return new Preparation<T>(pPrep, pos, _default);
}
@ -694,7 +694,7 @@ public:
return 1u;
}
AbstractPreparation* createPreparation(AbstractPreparator* pPrep, std::size_t pos)
AbstractPreparation* createPreparation(AbstractPreparator::Ptr& pPrep, std::size_t pos)
{
return new Preparation<V>(pPrep, pos, _default);
}
@ -753,7 +753,7 @@ public:
return 1u;
}
AbstractPreparation* createPreparation(AbstractPreparator* pPrep, std::size_t pos)
AbstractPreparation* createPreparation(AbstractPreparator::Ptr& pPrep, std::size_t pos)
{
return new Preparation<V>(pPrep, pos, _default);
}
@ -768,7 +768,7 @@ namespace Keywords {
template <typename T>
inline Extraction<T>* into(T& t)
inline AbstractExtraction::Ptr into(T& t)
/// Convenience function to allow for a more compact creation of an extraction object.
{
return new Extraction<T>(t);
@ -776,7 +776,7 @@ inline Extraction<T>* into(T& t)
template <typename T>
inline Extraction<T>* into(T& t, const Position& pos)
inline AbstractExtraction::Ptr into(T& t, const Position& pos)
/// Convenience function to allow for a more compact creation of an extraction object
/// with multiple recordset support.
{
@ -785,7 +785,7 @@ inline Extraction<T>* into(T& t, const Position& pos)
template <typename T>
inline Extraction<T>* into(T& t, const Position& pos, const T& def)
inline AbstractExtraction::Ptr into(T& t, const Position& pos, const T& def)
/// Convenience function to allow for a more compact creation of an extraction object
/// with multiple recordset support and the given default
{

View File

@ -56,7 +56,7 @@ class Preparation: public AbstractPreparation
/// Class for calling the appropriate AbstractPreparator method.
{
public:
Preparation(AbstractPreparator* pPreparator, std::size_t pos, T& val):
Preparation(AbstractPreparator::Ptr& pPreparator, std::size_t pos, T& val):
AbstractPreparation(pPreparator),
_pos(pos),
_val(val)

View File

@ -42,6 +42,7 @@
#include "Poco/Data/Data.h"
#include "Poco/Data/StatementImpl.h"
#include "Poco/Data/Binding.h"
#include "Poco/Data/Range.h"
#include "Poco/Data/Bulk.h"
#include "Poco/Data/Row.h"
@ -82,8 +83,8 @@ class Data_API Statement
///
/// Once asyncronous, a statement can be reverted back to synchronous state in two ways:
///
/// 1) By calling setAsync(false)
/// 2) By means of 'sync' or 'reset' manipulators
/// 1) By calling setAsync(false)
/// 2) By means of 'sync' or 'reset' manipulators
///
/// See individual functions documentation for more details.
///
@ -110,7 +111,7 @@ public:
STORAGE_UNKNOWN = StatementImpl::STORAGE_UNKNOWN_IMPL
};
Statement(StatementImpl* pImpl);
Statement(StatementImpl::Ptr pImpl);
/// Creates the Statement.
explicit Statement(Session& session);
@ -153,19 +154,11 @@ public:
Statement& operator , (Manipulator manip);
/// Handles manipulators, such as now, async, etc.
Statement& operator , (AbstractBinding* bind);
Statement& operator , (AbstractBinding::Ptr pBind);
/// Registers the Binding with the Statement by calling addBind().
/// Statement takes the ownership of the bind in an AutoPtr.
/// To prevent bind destruction upon statement destruction, pass an
/// AutoPtr<AbstractBinding>::duplicate() to this function.
/// This function is primarily intended to be a destination for
/// use() and bind() utility functions return value, so it is
/// recommended to call addBind() directly instead.
Statement& addBind(AbstractBinding* pBind, bool duplicate = true);
Statement& addBind(AbstractBinding::Ptr pBind);
/// Registers a single binding with the statement.
/// To allow the binding to outlive the statement destruction,
/// duplicate must be true.
void removeBind(const std::string& name);
/// Removes the all the bindings with specified name from the statement.
@ -173,20 +166,20 @@ public:
Statement& operator , (AbstractBindingVec& bindVec);
/// Registers the Binding vector with the Statement.
Statement& operator , (AbstractExtraction* extract);
template <typename C>
Statement& addBinding(C& bindingCont, bool reset)
/// Registers binding container with the Statement.
{
if (reset) _pImpl->resetBinding();
typename C::iterator itAB = bindingCont.begin();
typename C::iterator itABEnd = bindingCont.end();
for (; itAB != itABEnd; ++itAB) addBind(*itAB);
return *this;
}
Statement& operator , (AbstractExtraction::Ptr extract);
/// Registers objects used for extracting data with the Statement by
/// calling addExtract().
/// Statement takes the ownership of the extract in an AutoPtr.
/// To prevent extract destruction upon statement destruction, pass an
/// AutoPtr<AbstractExtraction>::duplicate() to this function.
/// This function is primarily intended to be a destination for
/// into() utility function return value, so it is recommended to call
/// addExtract() directly instead.
Statement& addExtract(AbstractExtraction* pExtract, bool duplicate = true);
/// Registers a single extraction with the statement.
/// To allow the extraction to outlive the statement destruction,
/// duplicate must be true.
Statement& operator , (AbstractExtractionVec& extVec);
/// Registers the extraction vector with the Statement.
@ -195,17 +188,6 @@ public:
Statement& operator , (AbstractExtractionVecVec& extVecVec);
/// Registers the vector of extraction vectors with the Statement.
template <typename C>
Statement& addBinding(C& bindingCont, bool reset)
/// Registers binding container with the Statement.
{
if (reset) _pImpl->resetBinding();
typename C::iterator itAB = bindingCont.begin();
typename C::iterator itABEnd = bindingCont.end();
for (; itAB != itABEnd; ++itAB) addBind(itAB->duplicate());
return *this;
}
template <typename C>
Statement& addExtraction(C& val, bool reset)
/// Registers extraction container with the Statement.
@ -213,7 +195,7 @@ public:
if (reset) _pImpl->resetExtraction();
typename C::iterator itAE = val.begin();
typename C::iterator itAEEnd = val.end();
for (; itAE != itAEEnd; ++itAE) addExtract(itAE->duplicate());
for (; itAE != itAEEnd; ++itAE) addExtract(*itAE);
return *this;
}
@ -228,7 +210,9 @@ public:
return *this;
}
Statement& addExtract(AbstractExtraction::Ptr pExtract);
/// Registers a single extraction with the statement.
Statement& operator , (const Bulk& bulk);
/// Sets the bulk execution mode (both binding and extraction) for this
/// statement.Statement must not have any extractors or binders set at the
@ -406,7 +390,7 @@ public:
/// Statement takes the ownership of the formatter.
protected:
typedef Poco::AutoPtr<StatementImpl> StatementImplPtr;
typedef StatementImpl::Ptr ImplPtr;
const AbstractExtractionVec& extractions() const;
/// Returns the extractions vector.
@ -423,7 +407,7 @@ protected:
bool isBulkExtraction() const;
/// Returns true if this statement extracts data in bulk.
StatementImplPtr impl() const;
ImplPtr impl() const;
/// Returns pointer to statement implementation.
const RowFormatterPtr& getRowFormatter();
@ -433,6 +417,7 @@ protected:
/// Returns the underlying session.
private:
const Result& doAsyncExec(bool reset = true);
/// Asynchronously executes the statement.
@ -443,7 +428,7 @@ private:
return *this;
}
StatementImplPtr _pImpl;
StatementImpl::Ptr _pImpl;
// asynchronous execution related members
bool _async;
@ -656,9 +641,9 @@ inline void Statement::removeBind(const std::string& name)
}
inline Statement& Statement::operator , (AbstractBinding* pBind)
inline Statement& Statement::operator , (AbstractBinding::Ptr pBind)
{
return addBind(pBind, false);
return addBind(pBind);
}
@ -668,9 +653,9 @@ inline Statement& Statement::operator , (AbstractBindingVec& bindVec)
}
inline Statement& Statement::operator , (AbstractExtraction* pExtract)
inline Statement& Statement::operator , (AbstractExtraction::Ptr pExtract)
{
return addExtract(pExtract, false);
return addExtract(pExtract);
}
@ -686,7 +671,7 @@ inline Statement& Statement::operator , (AbstractExtractionVecVec& extVecVec)
}
inline Statement::StatementImplPtr Statement::impl() const
inline Statement::ImplPtr Statement::impl() const
{
return _pImpl;
}

View File

@ -50,7 +50,6 @@
#include "Poco/Data/BulkExtraction.h"
#include "Poco/Data/SessionImpl.h"
#include "Poco/RefCountedObject.h"
#include "Poco/AutoPtr.h"
#include "Poco/String.h"
#include "Poco/Format.h"
#include "Poco/Exception.h"
@ -65,12 +64,14 @@ namespace Poco {
namespace Data {
class Data_API StatementImpl: public Poco::RefCountedObject
class Data_API StatementImpl
/// StatementImpl interface that subclasses must implement to define database dependent query execution.
///
/// StatementImpl's are noncopyable.
{
public:
typedef Poco::SharedPtr<StatementImpl> Ptr;
enum State
{
ST_INITIALIZED,
@ -127,14 +128,14 @@ public:
_ostr << t;
}
void addBind(AbstractBinding* pBinding);
void addBind(AbstractBinding::Ptr pBinding);
/// Registers the Binding with the StatementImpl.
void removeBind(const std::string& name);
/// Unregisters all the bindings having specified name with the StatementImpl.
/// Bindings are released and, if this class was the sole owner, deleted.
void addExtract(AbstractExtraction* pExtraction);
void addExtract(AbstractExtraction::Ptr pExtraction);
/// Registers objects used for extracting data with the StatementImpl.
void setExtractionLimit(const Limit& extrLimit);
@ -216,14 +217,23 @@ protected:
virtual void bindImpl() = 0;
/// Binds parameters.
virtual AbstractExtractor& extractor() = 0;
virtual AbstractExtraction::ExtractorPtr extractor() = 0;
/// Returns the concrete extractor used by the statement.
const AbstractExtractionVec& extractions() const;
/// Returns the extractions vector.
/// Returns the const reference to extractions vector.
virtual AbstractBinder& binder() = 0;
/// Returns the concrete binder used by the statement.
AbstractExtractionVec& extractions();
/// Returns the reference to extractions vector.
void fixupExtraction();
/// Sets the AbstractExtractor at the extractors.
std::size_t getExtractionLimit();
/// Returns the extraction limit value.
const Limit& extractionLimit() const;
/// Returns the extraction limit.
std::size_t columnsExtracted(int dataSet = USE_CURRENT_DATA_SET) const;
/// Returns the number of columns that the extractors handle.
@ -236,15 +246,6 @@ protected:
/// Returns the number of rows extracted so far for the data set.
/// Default value indicates current data set (if any).
const AbstractBindingVec& bindings() const;
/// Returns the bindings.
AbstractBindingVec& bindings();
/// Returns the bindings.
AbstractExtractionVec& extractions();
/// Returns the extractions vector.
void makeExtractors(std::size_t count);
/// Determines the type of the internal extraction container and
/// calls the extraction creation function (addInternalExtract)
@ -270,6 +271,15 @@ protected:
SessionImpl& session();
/// Rteurns session associated with this statement.
virtual AbstractBinding::BinderPtr binder() = 0;
/// Returns the concrete binder used by the statement.
const AbstractBindingVec& bindings() const;
/// Returns the const reference to bindings vector.
AbstractBindingVec& bindings();
/// Returns the reference to bindings.
void fixupBinding();
/// Sets the AbstractBinder at the bindings.
@ -290,9 +300,6 @@ protected:
/// When connector-specific behavior is desired, it should be overriden
/// by the statement implementation.
void fixupExtraction();
/// Sets the AbstractExtractor at the extractors.
std::size_t currentDataSet() const;
/// Returns the current data set.
@ -307,12 +314,6 @@ protected:
bool hasMoreDataSets() const;
/// Returns true if there are data sets not activated yet.
std::size_t getExtractionLimit();
/// Returns the extraction limit value.
const Limit& extractionLimit() const;
/// Returns the extraction limit.
private:
void compile();
/// Compiles the statement.
@ -472,7 +473,7 @@ private:
//
inline void StatementImpl::addBind(AbstractBinding* pBinding)
inline void StatementImpl::addBind(AbstractBinding::Ptr pBinding)
{
poco_check_ptr (pBinding);
_bindings.push_back(pBinding);

View File

@ -57,7 +57,7 @@ AbstractBinding::~AbstractBinding()
}
void AbstractBinding::setBinder(AbstractBinder* pBinder)
void AbstractBinding::setBinder(BinderPtr pBinder)
{
poco_check_ptr (pBinder);
_pBinder = pBinder;

View File

@ -41,7 +41,7 @@ namespace Poco {
namespace Data {
AbstractPreparation::AbstractPreparation(AbstractPreparator* pPreparator):
AbstractPreparation::AbstractPreparation(PreparatorPtr pPreparator):
_pPreparator(pPreparator)
{
poco_assert_dbg (_pPreparator);

View File

@ -81,7 +81,7 @@ RecordSet::RecordSet(Session& rSession,
RecordSet::RecordSet(const RecordSet& other):
Statement(other.impl().duplicate()),
Statement(other.impl()),
_currentRow(other._currentRow),
_pBegin(new RowIterator(this, 0 == rowsExtracted())),
_pEnd(new RowIterator(this, true)),

View File

@ -49,7 +49,7 @@ namespace Poco {
namespace Data {
Statement::Statement(StatementImpl* pImpl):
Statement::Statement(StatementImpl::Ptr pImpl):
_pImpl(pImpl),
_async(false)
{
@ -207,7 +207,7 @@ Statement& Statement::operator , (Manipulator manip)
}
Statement& Statement::addBind(AbstractBinding* pBind, bool duplicate)
Statement& Statement::addBind(AbstractBinding::Ptr pBind)
{
if (pBind->isBulk())
{
@ -221,13 +221,12 @@ Statement& Statement::addBind(AbstractBinding* pBind, bool duplicate)
}
else _pImpl->forbidBulk();
if (duplicate) pBind->duplicate();
_pImpl->addBind(pBind);
return *this;
}
Statement& Statement::addExtract(AbstractExtraction* pExtract, bool duplicate)
Statement& Statement::addExtract(AbstractExtraction::Ptr pExtract)
{
if (pExtract->isBulk())
{
@ -244,7 +243,6 @@ Statement& Statement::addExtract(AbstractExtraction* pExtract, bool duplicate)
}
else _pImpl->forbidBulk();
if (duplicate) pExtract->duplicate();
_pImpl->addExtract(pExtract);
return *this;
}

View File

@ -264,10 +264,9 @@ void StatementImpl::fixupExtraction()
Poco::Data::AbstractExtractionVec::iterator it = extractions().begin();
Poco::Data::AbstractExtractionVec::iterator itEnd = extractions().end();
AbstractExtractor& ex = extractor();
for (; it != itEnd; ++it)
{
(*it)->setExtractor(&ex);
(*it)->setExtractor(extractor());
(*it)->setLimit(_extrLimit.value()),
_columnsExtracted[_curDataSet] += (int)(*it)->numOfColumnsHandled();
}
@ -279,8 +278,7 @@ void StatementImpl::fixupBinding()
// no need to call binder().reset(); here will be called before each bind anyway
AbstractBindingVec::iterator it = bindings().begin();
AbstractBindingVec::iterator itEnd = bindings().end();
AbstractBinder& bin = binder();
for (; it != itEnd; ++it) (*it)->setBinder(&bin);
for (; it != itEnd; ++it) (*it)->setBinder(binder());
}
@ -395,7 +393,7 @@ std::size_t StatementImpl::activatePreviousDataSet()
}
void StatementImpl::addExtract(AbstractExtraction* pExtraction)
void StatementImpl::addExtract(AbstractExtraction::Ptr pExtraction)
{
poco_check_ptr (pExtraction);
std::size_t pos = pExtraction->position();

View File

@ -1346,43 +1346,41 @@ void DataTest::testExternalBindingAndExtraction()
Session tmp (Poco::Data::Test::Connector::KEY, "dummy.db");
int i;
AbstractExtraction* pExt1 = into(i);
AbstractExtraction* pExt2 = into(i);
assert (1 == pExt1->referenceCount());
assert (1 == pExt2->referenceCount());
AbstractExtraction::Ptr pExt1 = into(i);
AbstractExtraction::Ptr pExt2 = into(i);
assert (1 == pExt1.referenceCount());
assert (1 == pExt2.referenceCount());
{
Statement stmt(tmp);
stmt.addExtract(pExt1); // retain external ownership in addition to giving it to statement
assert (2 == pExt1->referenceCount());
stmt.addExtract(pExt2, false); // give ownership to statement
assert (1 == pExt2->referenceCount());
stmt.addExtract(pExt1);
assert (2 == pExt1.referenceCount());
}
assert (1 == pExt1->referenceCount()); delete pExt1;
// pExt2 does not exist any more
assert (1 == pExt1.referenceCount());
assert (1 == pExt2.referenceCount());
AbstractBinding* pBind1 = use(i, "mybind1");
AbstractBinding* pBind2 = use(i, "mybind2");
AbstractBinding* pBind3 = use(i, "mybind3");
assert (1 == pBind1->referenceCount());
assert (1 == pBind2->referenceCount());
assert (1 == pBind3->referenceCount());
AbstractBinding::Ptr pBind1 = use(i, "mybind1");
AbstractBinding::Ptr pBind2 = use(i, "mybind2");
AbstractBinding::Ptr pBind3 = use(i, "mybind3");
assert (1 == pBind1.referenceCount());
assert (1 == pBind2.referenceCount());
assert (1 == pBind3.referenceCount());
{
Statement stmt(tmp);
stmt.addBind(pBind1); // retain external ownership in addition to giving it to statement
assert (2 == pBind1->referenceCount());
stmt.addBind(pBind2, false);// give ownership to statement
assert (1 == pBind2->referenceCount());
stmt.addBind(pBind3);// give ownership to statement
assert (2 == pBind3->referenceCount());
stmt.removeBind(pBind3->name());// take ownership from statement
assert (1 == pBind3->referenceCount());
stmt.addBind(pBind1);
assert (2 == pBind1.referenceCount());
stmt.removeBind(pBind1->name());
assert (1 == pBind1.referenceCount());
stmt.addBind(pBind2);
assert (2 == pBind2.referenceCount());
stmt.addBind(pBind3);
assert (2 == pBind3.referenceCount());
try { stmt.removeBind("a bad name"); fail("must fail"); }
catch (NotFoundException&) { }
}
assert (1 == pBind1->referenceCount()); delete pBind1;
// pBind2 does not exist any more
assert (1 == pBind3->referenceCount()); delete pBind3;
assert (1 == pBind1.referenceCount());
assert (1 == pBind2.referenceCount());
assert (1 == pBind3.referenceCount());
}

View File

@ -92,10 +92,10 @@ protected:
void bindImpl();
/// Binds parameters
AbstractExtractor& extractor();
AbstractExtraction::ExtractorPtr extractor();
/// Returns the concrete extractor used by the statement.
AbstractBinder& binder();
AbstractBinding::BinderPtr binder();
/// Returns the concrete binder used by the statement.
private:
@ -109,15 +109,15 @@ private:
//
// inlines
//
inline AbstractExtractor& TestStatementImpl::extractor()
inline AbstractExtraction::ExtractorPtr TestStatementImpl::extractor()
{
return *_ptrExtractor;
return _ptrExtractor;
}
inline AbstractBinder& TestStatementImpl::binder()
inline AbstractBinding::BinderPtr TestStatementImpl::binder()
{
return *_ptrBinder;
return _ptrBinder;
}