From 52552756404c7047c4438cf11425299c88cb74a7 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 1 Nov 2018 13:47:01 +0800 Subject: [PATCH] add FieldsNum --- a8/mysql.cc | 6 ++++++ a8/mysql.h | 1 + 2 files changed, 7 insertions(+) diff --git a/a8/mysql.cc b/a8/mysql.cc index 2fcac89..1aefde4 100644 --- a/a8/mysql.cc +++ b/a8/mysql.cc @@ -192,6 +192,12 @@ namespace a8 return impl_->mysqlres ? mysql_num_rows(impl_->mysqlres) : 0; } + int Query::FieldsNum() + { + assert(impl_->mysqlres); + return impl_->mysqlres ? mysql_num_fields(impl_->mysqlres) : 0; + } + bool Query::Eof() { assert(impl_->mysqlres); diff --git a/a8/mysql.h b/a8/mysql.h index 8e045f8..2299d06 100644 --- a/a8/mysql.h +++ b/a8/mysql.h @@ -38,6 +38,7 @@ namespace a8 std::string FormatSqlEx(const char* fmt, std::initializer_list args); std::string FormatSql(const char* fmt, std::initializer_list& args); int RowsNum(); + int FieldsNum(); bool Eof(); void First(); void Prev();