本文整理汇总了C++中Statement::bindParameters方法的典型用法代码示例。如果您正苦于以下问题:C++ Statement::bindParameters方法的具体用法?C++ Statement::bindParameters怎么用?C++ Statement::bindParameters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Statement
的用法示例。
在下文中一共展示了Statement::bindParameters方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: insertBar
int ODBCWrapper::insertBar(const int stmtId, unsigned int datetime, double *vals, const int size)
{
int rv = 0;
Statement *stmt = stmts[stmtId];
if (!stmt) return MOB_INVALID_STMTID;
//TODO: rewrite to use type-specific parameter binding method
DataPointer *dps = (DataPointer *) malloc(sizeof(DataPointer) * (size + 1));
SQL_TIMESTAMP_STRUCT ts;
time_t tt = (time_t) datetime;
TimestampPointer::timet2timestamp(&tt, &ts);
dps[0] = TimestampPointer(&ts);
for(int i = 0; i < size; i++)
dps[i + 1] = DoublePointer(&vals[i]);
try
{
stmt->bindParameters(dps, size + 1);
rv = stmt->execute();
}
catch (ODBCException *e)
{
handleException(e);
free(dps);
return MOB_NG;
}
free(dps);
return rv;
}
示例2: copyRates
int ODBCWrapper::copyRates(const int stmtId, RateInfo *rates, const int size, const int start, const int end)
{
int rv = 0;
Statement *stmt = stmts[stmtId];
if (!stmt) return MOB_INVALID_STMTID;
if (start < 0 || end > size || start > end) return MOB_NG;
for (int i = start; i < end; i++)
{
SQL_TIMESTAMP_STRUCT ts;
time_t tt = (time_t) rates[i].ctm;
TimestampPointer::timet2timestamp(&tt, &ts);
DataPointer dps[6] =
{
TimestampPointer(&ts),
DoublePointer(&rates[i].open),
DoublePointer(&rates[i].high),
DoublePointer(&rates[i].low),
DoublePointer(&rates[i].close),
DoublePointer(&rates[i].vol)
};
try
{
//TODO: rewrite to use type-specific parameter binding method
stmt->bindParameters(dps, 6);
rv += stmt->execute();
}
catch (ODBCException *e)
{
handleException(e);
return MOB_NG;
}
}
return rv;
}