Skip to content

Commit

Permalink
Modify sql syntax for pgsql
Browse files Browse the repository at this point in the history
  • Loading branch information
cuihaikuo committed Feb 17, 2017
1 parent bf01510 commit 345d4ad
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion server/repo-mgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -3583,13 +3583,24 @@ gint64
seaf_get_total_storage (GError **error)
{
gint64 size = 0;
int ret = seaf_db_statement_foreach_row (seaf->db,
int ret;
if (seaf_db_type(seaf->db) == SEAF_DB_TYPE_PGSQL) {
ret = seaf_db_statement_foreach_row (seaf->db,
"SELECT \"size\" FROM RepoSize s "
"LEFT JOIN VirtualRepo v "
"ON s.repo_id=v.repo_id "
"WHERE v.repo_id IS NULL",
get_total_storage_cb,
&size, 0);
} else {
ret = seaf_db_statement_foreach_row (seaf->db,
"SELECT size FROM RepoSize s "
"LEFT JOIN VirtualRepo v "
"ON s.repo_id=v.repo_id "
"WHERE v.repo_id IS NULL",
get_total_storage_cb,
&size, 0);
}
if (ret < 0) {
seaf_warning ("Failed to get total storage occupation.\n");
g_set_error (error, SEAFILE_DOMAIN, SEAF_ERR_GENERAL,
Expand Down

0 comments on commit 345d4ad

Please sign in to comment.