aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/db/dbal.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/db/dbal.php')
-rw-r--r--phpBB/includes/db/dbal.php35
1 files changed, 35 insertions, 0 deletions
diff --git a/phpBB/includes/db/dbal.php b/phpBB/includes/db/dbal.php
index 8564cb8426..6da854b6e2 100644
--- a/phpBB/includes/db/dbal.php
+++ b/phpBB/includes/db/dbal.php
@@ -920,6 +920,41 @@ class dbal
return true;
}
+
+ /**
+ * Gets the estimated number of rows in a specified table.
+ *
+ * @param string $table_name Table name
+ *
+ * @return string Number of rows in $table_name.
+ * Prefixed with ~ if estimated (otherwise exact).
+ *
+ * @access public
+ */
+ function get_estimated_row_count($table_name)
+ {
+ return $this->get_row_count($table_name);
+ }
+
+ /**
+ * Gets the exact number of rows in a specified table.
+ *
+ * @param string $table_name Table name
+ *
+ * @return string Exact number of rows in $table_name.
+ *
+ * @access public
+ */
+ function get_row_count($table_name)
+ {
+ $sql = 'SELECT COUNT(*) AS rows_total
+ FROM ' . $this->sql_escape($table_name);
+ $result = $this->sql_query($sql);
+ $rows_total = $this->sql_fetchfield('rows_total');
+ $this->sql_freeresult($result);
+
+ return $rows_total;
+ }
}
/**