Upstream version 8.36.161.0
[platform/framework/web/crosswalk.git] / src / xwalk / application / common / application_storage_constants.cc
1 // Copyright (c) 2013 Intel Corporation. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "xwalk/application/common/application_storage_constants.h"
6 #include "base/strings/stringprintf.h"
7
8 namespace xwalk {
9 namespace application_storage_constants {
10
11 const char kAppTableName[] = "applications";
12 const char kPermissionTableName[] = "stored_permissions";
13 const char kGarbageCollectionTableName[] = "garbage_collection";
14
15 const char kCreateAppTableOp[] =
16     "CREATE TABLE applications ("
17     "id TEXT NOT NULL UNIQUE PRIMARY KEY,"
18     "manifest TEXT NOT NULL,"
19     "path TEXT NOT NULL,"
20     "install_time REAL)";
21
22 const char kCreatePermissionTableOp[] =
23     "CREATE TABLE stored_permissions ("
24     "id TEXT NOT NULL,"
25     "permission_names TEXT NOT NULL,"
26     "PRIMARY KEY (id),"
27     "FOREIGN KEY (id) REFERENCES applications(id)"
28     "ON DELETE CASCADE)";
29
30 const char kGetRowFromAppTableOp[] =
31     "SELECT A.id, A.manifest, A.path, A.install_time, "
32     "C.permission_names FROM applications as A "
33     "LEFT JOIN stored_permissions as C "
34     "ON A.id = C.id WHERE A.id = ?";
35
36 const char kGetAllRowsFromAppTableOp[] =
37     "SELECT A.id, A.manifest, A.path, A.install_time, "
38     "C.permission_names FROM applications as A "
39     "LEFT JOIN stored_permissions as C "
40     "ON A.id = C.id";
41
42 extern const char kGetAllIDsFromAppTableOp[] =
43     "SELECT id FROM applications";
44
45 const char kSetApplicationWithBindOp[] =
46     "INSERT INTO applications (manifest, path, install_time, id) "
47     "VALUES (?,?,?,?)";
48
49 const char kUpdateApplicationWithBindOp[] =
50     "UPDATE applications SET manifest = ?, path = ?,"
51     "install_time = ? WHERE id = ?";
52
53 const char kDeleteApplicationWithBindOp[] =
54     "DELETE FROM applications WHERE id = ?";
55
56 const char kInsertPermissionsWithBindOp[] =
57     "INSERT INTO stored_permissions (permission_names, id) "
58     "VALUES(?,?)";
59
60 const char kUpdatePermissionsWithBindOp[] =
61     "UPDATE stored_permissions SET permission_names = ? WHERE id = ?";
62
63 const char kDeletePermissionsWithBindOp[] =
64     "DELETE FROM stored_permissions WHERE id = ?";
65
66 }  // namespace application_storage_constants
67 }  // namespace xwalk