本文整理汇总了C++中DBCStorage::GetNumRows方法的典型用法代码示例。如果您正苦于以下问题:C++ DBCStorage::GetNumRows方法的具体用法?C++ DBCStorage::GetNumRows怎么用?C++ DBCStorage::GetNumRows使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBCStorage
的用法示例。
在下文中一共展示了DBCStorage::GetNumRows方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dump_data
void dump_data(std::ostream& out, DBCStorage<T> const& store, bool ext_insert = true)
{
std::string class_name = ClassInfo<T>::name;
strip_trailing(class_name, "Entry");
if (ext_insert)
out << "INSERT INTO " << class_name << " VALUES\n";
uint32 last_row = store.GetNumRows() - 1;
for (uint32 row = 0; row <= last_row; ++row)
{
T const* entry = store.LookupEntry(row);
if (!entry)
continue;
if (ext_insert)
out << "(";
else
out << "INSERT INTO " << class_name << " VALUES (";
uint32 col = 0;
for (FieldList::const_iterator itr = ClassInfo<T>::fields.begin(); itr != ClassInfo<T>::fields.end(); ++itr, ++col)
{
bool is_text = ((*itr)->getType() == TYPE_STRING || (*itr)->getType()== TYPE_STRING_CONST) &&
(*itr)->isArray() && (*itr)->getArraySize() == 16; // all string fields have 16 locales
if (is_text && (*itr)->getArrayIndex() != 0) // only dump en_US locale
continue;
if (col > 0)
out << ", ";
if (is_text)
out << '\'' << escape_string((*itr)->getValue(const_cast<T*>(entry))) << '\'';
else
out << (*itr)->getValue(const_cast<T*>(entry));
}
if (ext_insert)
out << (row < last_row ? "),\n" : ");\n");
else
out << ");\n";
}
}