本文整理汇总了C++中Table::Visit方法的典型用法代码示例。如果您正苦于以下问题:C++ Table::Visit方法的具体用法?C++ Table::Visit怎么用?C++ Table::Visit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Table
的用法示例。
在下文中一共展示了Table::Visit方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StructuredDatabaseTest
int StructuredDatabaseTest()
{
Table* table;
int user_id;
DynArray<1024> what;
DynArray<1024> where;
table = new Table(&database, "structured_test");
table->Truncate();
user_id = InsertUser(table, "dopey", "dopeypass", "online");
InsertEvent(table, user_id, "dinner", "cheezburger", "2009-03-24 01:09:00");
InsertEvent(table, user_id, "meeting", "important", "2009-03-24 11:12:00");
// SELECT * FROM event WHERE user=%d AND date > 2009-03-24 01
what.Printf("event:user:%d", user_id);
where.Printf("date:2009-03-24 01");
//TableSelector selector(what.buffer, where.buffer);
// QuerySelector selector("SELECT date, note FROM event WHERE user_id=%d", user_id);
// table->Visit(selector);
ListTableVisitor visitor;
table->Visit(visitor);
return TEST_SUCCESS;
}
示例2: TableVisitorTest
int TableVisitorTest()
{
Table* table;
ListTableVisitor ltv;
table = database.GetTable("keyspace");
table->Visit(ltv);
return TEST_SUCCESS;
}
示例3: bdbdump
int bdbdump(int argc, char* argv[], bool dumpFormat)
{
char* slash;
char* filename;
Table* table;
TablePrinter tp(dumpFormat);
bool ret;
DatabaseConfig dbConfig;
if (argc < 2)
{
printf("usage: bdbdump db-file\n");
exit(1);
}
dbConfig.dir = ".";
filename = argv[1];
if ((slash = strrchr(filename, '/')) != NULL)
{
dbConfig.dir = argv[1];
*slash = '\0';
filename = slash + 1;
if (chdir(dbConfig.dir) < 0)
{
printf("cannot find database directory!\n");
exit(1);
}
dbConfig.dir = ".";
}
ret = database.Init(dbConfig);
if (!ret)
{
printf("cannot initialise database!\n");
exit(1);
}
table = new Table(&database, filename);
table->Visit(tp);
delete table;
return 0;
}
示例4: TableSelectorTest
int TableSelectorTest()
{
Table* table;
// select all user where name starts with 'd'
TableSelector selector("user", "d");
table = database.GetTable("test");
// populate table with test data
table->Set(NULL, "user:1", "dopey");
table->Set(NULL, "user:2", "grumpy");
table->Set(NULL, "user:3", "doc");
table->Set(NULL, "user:4", "happy");
table->Set(NULL, "user:5", "bashful");
table->Set(NULL, "user:6", "sneezy");
table->Set(NULL, "user:7", "sleepy");
table->Visit(selector);
return TEST_SUCCESS;
}