本文整理汇总了C++中DataTable::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ DataTable::clear方法的具体用法?C++ DataTable::clear怎么用?C++ DataTable::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataTable
的用法示例。
在下文中一共展示了DataTable::clear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doQuery
void Connection::doQuery(sqlite3 *connection, const String &sql, DataTable &table)
{
table.clear();
shared_ptr<Result> result = doQuery(connection, sql);
if(result != nullptr)
result->bind(table);
}
示例2: executeQuery
void SearchResultsDatabase::executeQuery(shared_ptr<IPortalDatabase> database, shared_ptr<Portal> portal, shared_ptr<SearchQuery> query, const StringMap& objectsMap)
{
clear();
shared_ptr<DbSqlSelect> select(new DbSqlSelect(DBTABLES::SNAPSHOT_OBJECTS_TABLE));
select->fields.add(DbSqlField(DBTABLES::SNAPSHOT_OBJECTS::ENTITY, DBTABLES::SNAPSHOT_OBJECTS_TABLE));
// Se il primo step di un groupMode, ho bisogno di estrarre anche il padre.
if(query->getGroupMode() && (objectsMap.empty()))
select->fields.add(DbSqlField(DBTABLES::SNAPSHOT_OBJECTS::PARENT, DBTABLES::SNAPSHOT_OBJECTS_TABLE));
// Solo se non specificata gi una lista di oggetti.
// Le where si riferiscono agli oggetti singoli (ex. post), non al loro oggetto da visualizzare.
// Quindi non necessario specificarle nel secondo giro.
if(objectsMap.empty())
{
// current != ""
select->where.add(DbSqlField(DBTABLES::SNAPSHOT_OBJECTS::CURRENT, DBTABLES::SNAPSHOT_OBJECTS_TABLE), Convert::toSQL(String::EMPTY), DbSqlCondition::cfDifferent | DbSqlCondition::cfAnd);
// Controlla se stata specificata una data di creazione minima
const DateTime &fromSubmitDate = query->convertSearchDateTime(query->getFromSubmitDateType(),query->getFromSubmitDateSpecific());
if(fromSubmitDate.isValid())
{
// submit_date >= fromSubmitDate
select->where.add(DbSqlField(DBTABLES::SNAPSHOT_OBJECTS::SUBMIT_DATE, DBTABLES::SNAPSHOT_OBJECTS_TABLE), Convert::toSQL(fromSubmitDate), DbSqlCondition::cfMajor | DbSqlCondition::cfEqual | DbSqlCondition::cfAnd);
}
// Controlla se stata specificata una data di creazione massima
const DateTime &toSubmitDate = query->convertSearchDateTime(query->getToSubmitDateType(),query->getToSubmitDateSpecific());
if(toSubmitDate.isValid())
{
// submit_date <= toSubmitDate
select->where.add(DbSqlField(DBTABLES::SNAPSHOT_OBJECTS::SUBMIT_DATE, DBTABLES::SNAPSHOT_OBJECTS_TABLE), Convert::toSQL(toSubmitDate), DbSqlCondition::cfMinor | DbSqlCondition::cfEqual | DbSqlCondition::cfAnd);
}
// Controlla se stata specificata una data di inserimento minima
const DateTime &fromInsertDate = query->convertSearchDateTime(query->getFromInsertDateType(),query->getFromInsertDateSpecific());
if(fromInsertDate.isValid())
{
// insert_date >= fromInsertDate
select->where.add(DbSqlField(DBTABLES::SNAPSHOT_OBJECTS::INSERT_DATE, DBTABLES::SNAPSHOT_OBJECTS_TABLE), Convert::toSQL(fromInsertDate), DbSqlCondition::cfMajor | DbSqlCondition::cfEqual | DbSqlCondition::cfAnd);
}
// Controlla se stata specificata una data di creazione massima
const DateTime &toInsertDate = query->convertSearchDateTime(query->getToInsertDateType(),query->getToInsertDateSpecific());
if(toInsertDate.isValid())
{
// insert_date <= toInsertDate
select->where.add(DbSqlField(DBTABLES::SNAPSHOT_OBJECTS::INSERT_DATE, DBTABLES::SNAPSHOT_OBJECTS_TABLE), Convert::toSQL(toInsertDate), DbSqlCondition::cfMinor | DbSqlCondition::cfEqual | DbSqlCondition::cfAnd);
}
// Non mostrare le entit virtuali. Dato che le entit virtuali hanno insertDate==null,
select->where.add(DbSqlField(DBTABLES::SNAPSHOT_OBJECTS::INSERT_DATE, DBTABLES::SNAPSHOT_OBJECTS_TABLE), Convert::toSQL(DateTime::EMPTY), DbSqlCondition::cfDifferent | DbSqlCondition::cfAnd);
// Se non deve mostrare gli oggetti cancellati forza la visibilit ad 1
if(query->getShowDeleted() == false)
// visible == 1
select->where.add(DbSqlField(DBTABLES::SNAPSHOT_OBJECTS::VISIBLE, DBTABLES::SNAPSHOT_OBJECTS_TABLE), Convert::toSQL(true));
StringList types;
for(SearchQuery::Options::const_iterator i = query->getOptions().begin(); i != query->getOptions().end(); ++i)
{
shared_ptr<ISearchOptions> options = i->second;
if(options->getActive())
{
types.push_back(Convert::toString(options->getType()));
}
}
if(types.empty() == false)
// type in (...)
select->where.add(DbSqlField(DBTABLES::SNAPSHOT_OBJECTS::TYPE, DBTABLES::SNAPSHOT_OBJECTS_TABLE), types);
// Ricerca in determinati padri
StringList parentsList;
query->computeParentsList(database, portal, parentsList);
// Ci metto gli apici...
for(StringList::iterator i = parentsList.begin(); i != parentsList.end(); ++i)
{
*i = _S("'") + String(*i) + _S("'");
}
if(!parentsList.empty())
{
select->where.add(DbSqlField(DBTABLES::SNAPSHOT_OBJECTS::PARENT, DBTABLES::SNAPSHOT_OBJECTS_TABLE), parentsList);
}
// 0.14 RC3
if(query->getText().substr(0,17) == _S("title-start-with:"))
{
select->where.add(DbSqlField(DBTABLES::SNAPSHOT_OBJECTS::TITLE), Convert::toSQL(query->getText().substr(17) + _S("%")), DbSqlCondition::cfLike | DbSqlCondition::cfAnd);
}
// 0.14 RC3
if(query->getText().substr(0,17) == _S("title-start-with:"))
{
select->where.add(DbSqlField(DBTABLES::SNAPSHOT_OBJECTS::TITLE), query->getText().substr(17) + _S("%"), DbSqlCondition::cfLike | DbSqlCondition::cfAnd);
}
// 0.12
if( (query->getByUser().empty() == false) && (query->getByUser() != _S("*")) )
{
//.........这里部分代码省略.........