本文整理汇总了C++中Statement::Step方法的典型用法代码示例。如果您正苦于以下问题:C++ Statement::Step方法的具体用法?C++ Statement::Step怎么用?C++ Statement::Step使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Statement
的用法示例。
在下文中一共展示了Statement::Step方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetChatrooms
bool Database::GetChatrooms(const User &Owner, std::vector<Chatroom> &Out)
{
Out.clear();
const std::string Query = "SELECT * FROM Chatroom WHERE OwnerUsername = :OwnerUsername";
Statement s;
if (s.Prepare(Inner, Query))
return false;
if (!s.Bind(":OwnerUsername", Owner.Username))
return false;
bool MoreData = true;
while (MoreData)
{
if (!s.Step(MoreData))
return false;
Chatroom c;
if (!_GetChatroom(s, c))
return false;
Out.push_back(c);
}
return true;
}
示例2: GetUser
bool Database::GetUser(const std::string &Username, User &Out)
{
const std::string Query = "SELECT * FROM User WHERE Username = :Username";
Statement s;
if (!s.Prepare(Inner, Query))
return false;
if (!s.Bind(":Username", Username.c_str()))
return false;
if (!s.Step())
return false;
if (!_GetUser(s, Out))
return false;
return true;
}
示例3: GetChatroom
bool Database::GetChatroom(const std::string &Name, Chatroom &Out)
{
const std::string Query = "SELECT * FROM Chatroom WHERE Name = :Name";
Statement s;
if (!s.Prepare(Inner, Query))
return false;
if (!s.Bind(":Name", Name))
return false;
if (!s.Step())
return false;
if (!_GetChatroom(s, Out))
return false;
return true;
}
示例4: GetServer
bool Database::GetServer(const Net::Address Address, Server &Out)
{
const std::string Query = "SELECT * FROM Server WHERE Family = :Family AND IP = :IP AND Port = :Port";
Statement s;
if (!s.Prepare(Inner, Query))
return false;
if (!s.Bind(":Family", Address.Family) || !s.Bind(":IP", Address.GetPrintableIP()) || !s.Bind(":Port", Address.Port))
return false;
if (!s.Step())
return false;
if (!_GetServer(s, Out))
return false;
return true;
}
示例5: GetUsers
bool Database::GetUsers(std::vector<User> &Users)
{
Users.clear();
const std::string Query = "SELECT * FROM User";
Statement s;
if (!s.Prepare(Inner, Query))
return false;
bool MoreData = true;
while (MoreData)
{
if (!s.Step(MoreData))
return false;
User u;
if (!_GetUser(s, u))
return false;
Users.push_back(u);
}
return true;
}
示例6: GetServers
bool Database::GetServers(std::vector<Server> &Servers)
{
Servers.clear();
const std::string Query = "SELECT * FROM Server";
Statement s;
if (!s.Prepare(Inner, Query))
return false;
bool MoreData = true;
while (MoreData)
{
if (!s.Step(MoreData))
return false;
Server Out;
if (!_GetServer(s, Out))
return false;
Servers.push_back(Out);
}
return true;
}