如何使用SOCI和C 检查表中有多少行

How to check how many rows is in table using SOCI and C++?

本文关键字:多少 检查表 何使用 SOCI      更新时间:2023-10-16

简单问题。我有一个餐桌的人。我有两行:

1 Joe Doe joe.doe@ymail.com
2 Vivien Doe v.doe@gmail.com

如何撰写Soci语句,这会告诉我(返回)我桌上有多少行?(在我的示例中,我有2行)。

以获取SQL表中的行数使用count(*)函数这样:

select count(*) from Person

更具体 - 将数字输入C 变量使用:

int count;
sql << "select count(*) from person", into(count);