Java,计算azure数据库表中的行数
我正在尝试计算Azure数据库表中的行数,并在我的android应用程序上显示该行数。我在这里阅读了Azure关于从表中检索数据的文档:Java,计算azure数据库表中的行数,java,android,azure,azure-sql-database,Java,Android,Azure,Azure Sql Database,我正在尝试计算Azure数据库表中的行数,并在我的android应用程序上显示该行数。我在这里阅读了Azure关于从表中检索数据的文档: 但是它没有提到一个内置的计数函数。Azure库是否具有计数功能?是的,有一个名为includeTotalCount的方法将返回所有记录的计数。有关详细信息,请参考文章,正如@AlexChen Wx所说,您可以使用Azure Mobile Service JavaScript后端上ObjectMobileServiceTable的方法来计算记录数 如果您想直接
但是它没有提到一个内置的计数函数。Azure库是否具有计数功能?是的,有一个名为
includeTotalCount
的方法将返回所有记录的计数。有关详细信息,请参考文章,正如@AlexChen Wx所说,您可以使用Azure Mobile Service JavaScript后端上ObjectMobileServiceTable
的方法来计算记录数
如果您想直接使用Android应用程序,您可以尝试使用Java中类MobileServiceTable的方法includeInlineCount
,请参阅位于的源代码。boolean loop=true;
int totalrows=0;
int skipnumber=0;
int行=0;
while(循环){
int count=mToDoTable.select().skip(skipnumber.execute().get().size();
skipnumber=skipnumber+50;
行=行+计数;
如果(行)使用此选项?final MobileServiceList result=mtodTable.includeInlineCount().execute().get();@Cian是的,请尝试。它不起作用,也不起作用:final MobileServiceList result=mtodTable.where().includeInlineCount().execute().get();@Cian尝试编码int count=result.getTotalCount()
。
boolean loop = true;
int totalrows = 0;
int skipnumber = 0;
int rows=0;
while(loop) {
int count = mToDoTable.select().skip(skipnumber).execute().get().size();
skipnumber = skipnumber+50;
rows = rows+count;
if(rows<skipnumber){
loop=false;
totalrows = rows;
Log.i("count",String.valueOf(totalrows));
}
}