Commit c1842174 authored by Robert Czechowski's avatar Robert Czechowski

Fix dbstatus db queries to work with postgres

parent 9e510dd5
......@@ -1041,39 +1041,39 @@ impl MedalConnection for Connection {
let query = "SELECT count(*)
FROM session
WHERE last_activity > $1;";
let n_asession: i32 = self.query_map_one(query, &[&then], |row| row.get(0)).unwrap().unwrap();
let n_asession: i64 = self.query_map_one(query, &[&then], |row| row.get(0)).unwrap().unwrap();
let query = "SELECT count(*)
FROM participation
WHERE start_date > $1;";
let n_apart: i32 = self.query_map_one(query, &[&then], |row| row.get(0)).unwrap().unwrap();
let n_apart: i64 = self.query_map_one(query, &[&then], |row| row.get(0)).unwrap().unwrap();
let query = "SELECT count(*)
FROM session;";
let n_session: i32 = self.query_map_one(query, &[], |row| row.get(0)).unwrap().unwrap();
let n_session: i64 = self.query_map_one(query, &[], |row| row.get(0)).unwrap().unwrap();
let query = "SELECT count(*)
FROM session
WHERE oauth_foreign_id NOT NULL OR logincode NOT NULL;";
let n_user: i32 = self.query_map_one(query, &[], |row| row.get(0)).unwrap().unwrap();
WHERE oauth_foreign_id IS NOT NULL OR logincode IS NOT NULL;";
let n_user: i64 = self.query_map_one(query, &[], |row| row.get(0)).unwrap().unwrap();
let query = "SELECT count(*)
FROM session
WHERE oauth_foreign_id NOT NULL;";
let n_pmsuser: i32 = self.query_map_one(query, &[], |row| row.get(0)).unwrap().unwrap();
WHERE oauth_foreign_id IS NOT NULL;";
let n_pmsuser: i64 = self.query_map_one(query, &[], |row| row.get(0)).unwrap().unwrap();
let query = "SELECT count(*)
FROM session
WHERE is_teacher = $1;";
let n_teacher: i32 = self.query_map_one(query, &[&true], |row| row.get(0)).unwrap().unwrap();
let n_teacher: i64 = self.query_map_one(query, &[&true], |row| row.get(0)).unwrap().unwrap();
let query = "SELECT count(*)
FROM participation;";
let n_part: i32 = self.query_map_one(query, &[], |row| row.get(0)).unwrap().unwrap();
let n_part: i64 = self.query_map_one(query, &[], |row| row.get(0)).unwrap().unwrap();
let query = "SELECT count(*)
FROM submission;";
let n_sub: i32 = self.query_map_one(query, &[], |row| row.get(0)).unwrap().unwrap();
let n_sub: i64 = self.query_map_one(query, &[], |row| row.get(0)).unwrap().unwrap();
format!(
"{{
......
......@@ -1137,39 +1137,39 @@ impl MedalConnection for Connection {
let query = "SELECT count(*)
FROM session
WHERE last_activity > $1;";
let n_asession: i32 = self.query_map_one(query, &[&then], |row| row.get(0)).unwrap().unwrap();
let n_asession: i64 = self.query_map_one(query, &[&then], |row| row.get(0)).unwrap().unwrap();
let query = "SELECT count(*)
FROM participation
WHERE start_date > $1;";
let n_apart: i32 = self.query_map_one(query, &[&then], |row| row.get(0)).unwrap().unwrap();
let n_apart: i64 = self.query_map_one(query, &[&then], |row| row.get(0)).unwrap().unwrap();
let query = "SELECT count(*)
FROM session;";
let n_session: i32 = self.query_map_one(query, &[], |row| row.get(0)).unwrap().unwrap();
let n_session: i64 = self.query_map_one(query, &[], |row| row.get(0)).unwrap().unwrap();
let query = "SELECT count(*)
FROM session
WHERE oauth_foreign_id NOT NULL OR logincode NOT NULL;";
let n_user: i32 = self.query_map_one(query, &[], |row| row.get(0)).unwrap().unwrap();
WHERE oauth_foreign_id IS NOT NULL OR logincode IS NOT NULL;";
let n_user: i64 = self.query_map_one(query, &[], |row| row.get(0)).unwrap().unwrap();
let query = "SELECT count(*)
FROM session
WHERE oauth_foreign_id NOT NULL;";
let n_pmsuser: i32 = self.query_map_one(query, &[], |row| row.get(0)).unwrap().unwrap();
WHERE oauth_foreign_id IS NOT NULL;";
let n_pmsuser: i64 = self.query_map_one(query, &[], |row| row.get(0)).unwrap().unwrap();
let query = "SELECT count(*)
FROM session
WHERE is_teacher = $1;";
let n_teacher: i32 = self.query_map_one(query, &[&true], |row| row.get(0)).unwrap().unwrap();
let n_teacher: i64 = self.query_map_one(query, &[&true], |row| row.get(0)).unwrap().unwrap();
let query = "SELECT count(*)
FROM participation;";
let n_part: i32 = self.query_map_one(query, &[], |row| row.get(0)).unwrap().unwrap();
let n_part: i64 = self.query_map_one(query, &[], |row| row.get(0)).unwrap().unwrap();
let query = "SELECT count(*)
FROM submission;";
let n_sub: i32 = self.query_map_one(query, &[], |row| row.get(0)).unwrap().unwrap();
let n_sub: i64 = self.query_map_one(query, &[], |row| row.get(0)).unwrap().unwrap();
format!(
"{{
......
......@@ -1137,39 +1137,39 @@ impl MedalConnection for Connection {
let query = "SELECT count(*)
FROM session
WHERE last_activity > ?1;";
let n_asession: i32 = self.query_map_one(query, &[&then], |row| row.get(0)).unwrap().unwrap();
let n_asession: i64 = self.query_map_one(query, &[&then], |row| row.get(0)).unwrap().unwrap();
let query = "SELECT count(*)
FROM participation
WHERE start_date > ?1;";
let n_apart: i32 = self.query_map_one(query, &[&then], |row| row.get(0)).unwrap().unwrap();
let n_apart: i64 = self.query_map_one(query, &[&then], |row| row.get(0)).unwrap().unwrap();
let query = "SELECT count(*)
FROM session;";
let n_session: i32 = self.query_map_one(query, &[], |row| row.get(0)).unwrap().unwrap();
let n_session: i64 = self.query_map_one(query, &[], |row| row.get(0)).unwrap().unwrap();
let query = "SELECT count(*)
FROM session
WHERE oauth_foreign_id NOT NULL OR logincode NOT NULL;";
let n_user: i32 = self.query_map_one(query, &[], |row| row.get(0)).unwrap().unwrap();
WHERE oauth_foreign_id IS NOT NULL OR logincode IS NOT NULL;";
let n_user: i64 = self.query_map_one(query, &[], |row| row.get(0)).unwrap().unwrap();
let query = "SELECT count(*)
FROM session
WHERE oauth_foreign_id NOT NULL;";
let n_pmsuser: i32 = self.query_map_one(query, &[], |row| row.get(0)).unwrap().unwrap();
WHERE oauth_foreign_id IS NOT NULL;";
let n_pmsuser: i64 = self.query_map_one(query, &[], |row| row.get(0)).unwrap().unwrap();
let query = "SELECT count(*)
FROM session
WHERE is_teacher = ?1;";
let n_teacher: i32 = self.query_map_one(query, &[&true], |row| row.get(0)).unwrap().unwrap();
let n_teacher: i64 = self.query_map_one(query, &[&true], |row| row.get(0)).unwrap().unwrap();
let query = "SELECT count(*)
FROM participation;";
let n_part: i32 = self.query_map_one(query, &[], |row| row.get(0)).unwrap().unwrap();
let n_part: i64 = self.query_map_one(query, &[], |row| row.get(0)).unwrap().unwrap();
let query = "SELECT count(*)
FROM submission;";
let n_sub: i32 = self.query_map_one(query, &[], |row| row.get(0)).unwrap().unwrap();
let n_sub: i64 = self.query_map_one(query, &[], |row| row.get(0)).unwrap().unwrap();
format!(
"{{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment