1
0
mirror of https://github.com/haiwen/seafile-server.git synced 2025-08-02 15:48:06 +00:00

Modify sql syntax for pgsql

This commit is contained in:
cuihaikuo 2017-02-17 10:39:51 +08:00
parent bf0151011f
commit 345d4ad286

View File

@ -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,