+ /**
+ * Check if a given table has data.
+ *
+ * @param string $tableName
+ * @return bool
+ * TRUE if $tableName has at least one record.
+ */
+ public static function checkTableHasData($tableName) {
+ $c = CRM_Core_DAO::singleValueQuery(sprintf('SELECT count(*) c FROM `%s`', $tableName));
+ return $c > 0;
+ }
+