示例#1
0
gint64
seaf_repo_manager_get_repo_valid_since (SeafRepoManager *mgr,
                                        const char *repo_id)
{
    char sql[256];

    snprintf (sql, sizeof(sql),
              "SELECT timestamp FROM RepoValidSince WHERE repo_id='%s'",
              repo_id);
    /* Also return -1 if DB error. */
    return seaf_db_get_int64 (mgr->seaf->db, sql);
}
示例#2
0
gint64
seaf_quota_manager_get_org_quota (SeafQuotaManager *mgr,
                                  int org_id)
{
    char sql[512];
    gint64 quota;

    snprintf (sql, sizeof(sql),
              "SELECT quota FROM OrgQuota WHERE org_id='%d'",
              org_id);
    quota = seaf_db_get_int64 (mgr->session->db, sql);
    if (quota <= 0)
        quota = mgr->default_quota;

    return quota;
}
示例#3
0
gint64
seaf_quota_manager_get_user_quota (SeafQuotaManager *mgr,
                                   const char *user)
{
    char sql[512];
    gint64 quota;

    snprintf (sql, sizeof(sql),
              "SELECT quota FROM UserQuota WHERE user='******'",
              user);
    quota = seaf_db_get_int64 (mgr->session->db, sql);
    if (quota <= 0)
        quota = mgr->default_quota;

    return quota;
}
示例#4
0
gint64
seaf_quota_manager_get_org_user_quota (SeafQuotaManager *mgr,
                                       int org_id,
                                       const char *user)
{
    char sql[512];
    gint64 quota;

    snprintf (sql, sizeof(sql),
              "SELECT quota FROM OrgUserQuota WHERE org_id='%d' AND user='******'",
              org_id, user);
    quota = seaf_db_get_int64 (mgr->session->db, sql);
    /* return org quota if per user quota is not set. */
    if (quota <= 0)
        quota = seaf_quota_manager_get_org_quota (mgr, org_id);

    return quota;
}