page plugin count remove limit
@@ -27,6 +27,14 @@ pub trait PagePlugin: Send + Sync {
}
where_sql = new_sql;
}
+ if where_sql.contains("LIMIT") {
+ let where_sqls: Vec<&str> = where_sql.split("LIMIT").collect();
+ let mut new_sql = String::new();
+ for item in &where_sqls[0..where_sqls.len() - 1].to_vec() {
+ new_sql.push_str(item);
+ }
+ where_sql = new_sql;
+ }
format!("SELECT count(1) FROM {}", where_sql)
}
}
