本文整理汇总了C++中SqlStmtParameters::params方法的典型用法代码示例。如果您正苦于以下问题:C++ SqlStmtParameters::params方法的具体用法?C++ SqlStmtParameters::params怎么用?C++ SqlStmtParameters::params使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SqlStmtParameters
的用法示例。
在下文中一共展示了SqlStmtParameters::params方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bind
void SqlPlainPreparedStatement::bind( const SqlStmtParameters& holder )
{
//verify if we bound all needed input parameters
if(m_nParams != holder.boundParams())
{
MANGOS_ASSERT(false);
return;
}
//reset resulting plain SQL request
m_szPlainRequest = m_szFmt;
size_t nLastPos = 0;
SqlStmtParameters::ParameterContainer const& _args = holder.params();
SqlStmtParameters::ParameterContainer::const_iterator iter_last = _args.end();
for (SqlStmtParameters::ParameterContainer::const_iterator iter = _args.begin(); iter != iter_last; ++iter)
{
//bind parameter
const SqlStmtFieldData& data = (*iter);
std::ostringstream fmt;
DataToString(data, fmt);
nLastPos = m_szPlainRequest.find('?', nLastPos);
if(nLastPos != std::string::npos)
{
std::string tmp = fmt.str();
m_szPlainRequest.replace(nLastPos, 1, tmp);
nLastPos += tmp.length();
}
}
}
示例2: bind
void MySqlPreparedStatement::bind( const SqlStmtParameters& holder )
{
poco_assert(isPrepared());
poco_assert(_myArgs.size() == _numParams);
//finalize adding params
if (_myArgs.size() < 1)
return;
//verify if we bound all needed input parameters
if(_numParams != holder.boundParams())
{
poco_bugcheck_msg("Not all parameters bound in MySqlPreparedStatement");
return;
}
size_t nIndex = 0;
const SqlStmtParameters::ParameterContainer& holderArgs = holder.params();
for (auto it = holderArgs.begin(); it!=holderArgs.end(); ++it)
{
//bind parameter
addParam(nIndex++, (*it));
}
//bind input arguments
if(mysql_stmt_bind_param(_myStmt, &_myArgs[0]))
poco_bugcheck_msg((string("mysql_stmt_bind_param() failed with ERROR ")+mysql_stmt_error(_myStmt)).c_str());
}
示例3: bind
void MySqlPreparedStatement::bind( const SqlStmtParameters& holder )
{
if(!isPrepared())
{
MANGOS_ASSERT(false);
return;
}
//finalize adding params
if(!m_pInputArgs)
return;
//verify if we bound all needed input parameters
if(m_nParams != holder.boundParams())
{
MANGOS_ASSERT(false);
return;
}
int nIndex = 0;
SqlStmtParameters::ParameterContainer const& _args = holder.params();
SqlStmtParameters::ParameterContainer::const_iterator iter_last = _args.end();
for (SqlStmtParameters::ParameterContainer::const_iterator iter = _args.begin(); iter != iter_last; ++iter)
{
//bind parameter
addParam(nIndex++, (*iter));
}
//bind input arguments
if(mysql_stmt_bind_param(m_stmt, m_pInputArgs))
{
sLog.outError("SQL ERROR: mysql_stmt_bind_param() failed\n");
sLog.outError("SQL ERROR: %s", mysql_stmt_error(m_stmt));
}
}