1. Select a block of code
::NDatabaseSchema::ProcedureParametersCollection::const_iterator
itProcedureParametersEnd( piProcedure->Parameters().end() ),
itProcedureParametersBegin( piProcedure->Parameters().begin() ),
itProcedureParameter( piProcedure->Parameters().begin() );
//Extract From here
for (; itProcedureParametersEnd != itProcedureParameter; ++itProcedureParameter)
{
if ( itProcedureParametersBegin != itProcedureParameter )
{
f_os << L"," << std::endl;
}
f_os << L" " << f_traits.FormatVariableIdentifier( ( *itProcedureParameter )->Name() );
if( ( ::NDatabaseSchema::dir_Out == ( *itProcedureParameter )->Direction() ) ||
( ::NDatabaseSchema::dir_InOut == ( *itProcedureParameter )->Direction() ) )
{
f_os << L" OUTPUT";
}
}
//Extract To Here
2. Refactor->Extract Method:
:NDatabaseSchema::ProcedureParametersCollection::const_iterator SetParametersForStoredProcedure( :NDatabaseSchema::ProcedureParametersCollection::const_iterator itProcedureParametersEnd, :NDatabaseSchema::ProcedureParametersCollection::const_iterator itProcedureParameter, :NDatabaseSchema::ProcedureParametersCollection::const_iterator itProcedureParametersBegin, std::wostringstream & f_os, :NDBIndependenceLayer::IDBMSTraits const &f_traits )
{
for (; itProcedureParametersEnd != itProcedureParameter; ++itProcedureParameter)
{
if ( itProcedureParametersBegin != itProcedureParameter )
{
f_os << L"," << std::endl;
}
f_os << L" " << f_traits.FormatVariableIdentifier( ( *itProcedureParameter )->Name() );
if( ( ::NDatabaseSchema::dir_Out == ( *itProcedureParameter )->Direction() ) ||
( ::NDatabaseSchema::dir_InOut == ( *itProcedureParameter )->Direction() ) )
{
f_os << L" OUTPUT";
}
}
return itProcedureParameter;
}
3. look at the code generated and its only got one colon at start of variable names instead of two.
VA info:
VA_X.dll file version 10.4.1645.0 built 2008.07.10
Licensed to:
VA X: [email protected] (2-user license) Support ends 2009.06.02
DevEnv.exe version 9.0.21022.8
msenv.dll version 9.0.21022.8
Font: Courier New 13(Pixels)
Comctl32.dll version 6.0.3790.2825
Windows Server 2003 5.2 Build 3790 Service Pack 2, v.4045
4 processors
Platform: Win32
Stable Includes:
D:\\Dev\\VisualStudio9\\VC\\include;
D:\\Dev\\VisualStudio9\\VC\\atlmfc\\include;
C:\\Program Files\\Microsoft SDKs\\Windows\\v6.0A\\include;
C:\\Program Files\\Microsoft SDKs\\Windows\\v6.0A\\include;
Other Includes:
Stable Source Directories:
D:\\Dev\\VisualStudio9\\VC\\atlmfc\\src\\mfc;
D:\\Dev\\VisualStudio9\\VC\\atlmfc\\src\\mfcm;
D:\\Dev\\VisualStudio9\\VC\\atlmfc\\src\\atl;
D:\\Dev\\VisualStudio9\\VC\\crt\\src;
n.b. Identical behaviour in 10.4.1640.0