708eccc6f59d6e990b180d3eb3d23dc61cf6da3e
[platform/core/appfw/ail.git] / src / ail_sql.c
1 /*
2  * ail
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>, Jaeho Lee <jaeho81.lee@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21
22
23
24 #include <string.h>
25 #include <stdio.h>
26 #include <stdlib.h>
27 #include "ail.h"
28 #include "ail_sql.h"
29 #include "ail_db.h"
30 #include "ail_vconf.h"
31 #include "ail_private.h"
32
33 static const char *filter[] = {
34         "app_info.PACKAGE='%s'",
35         "app_info.EXEC='%s'",
36         "((localname.name is NULL and app_info.name like '%%%s%%') or (localname.name like '%%%s%%'))",
37         "app_info.TYPE like '%%%s%%'",
38         "app_info.ICON='%s'",
39         "app_info.CATEGORIES like '%%%s%%'",
40         "app_info.VERSION='%s'",
41         "app_info.MIMETYPE like '%%%s%%'",
42         "app_info.X_SLP_SERVICE like '%%%s%%'",
43         "app_info.X_SLP_PACKAGETYPE='%s'",
44         "app_info.X_SLP_PACKAGECATEGORIES like '%%%s%%'",
45         "app_info.X_SLP_PACKAGEID='%s'",
46         "app_info.X_SLP_URI='%s'",
47         "app_info.X_SLP_SVC like '%%%s%%'",
48         "app_info.X_SLP_EXE_PATH='%s'",
49         "app_info.X_SLP_APPID='%s'",
50         "app_info.X_SLP_PKGID='%s'",
51         "app_info.X_SLP_DOMAIN='%s'",
52         "app_info.X_SLP_SUBMODEMAINID='%s'",
53         "app_info.X_SLP_INSTALLEDSTORAGE='%s'",
54         "app_info.X_SLP_BASELAYOUTWIDTH=%d",
55         "app_info.X_SLP_INSTALLEDTIME=%d",
56         "app_info.NODISPLAY=%d",
57         "app_info.X_SLP_TASKMANAGE=%d",
58         "app_info.X_SLP_MULTIPLE=%d",
59         "app_info.X_SLP_REMOVABLE=%d",
60         "app_info.X_SLP_ISHORIZONTALSCALE=%d",
61         "app_info.X_SLP_ENABLED=%d",
62         "app_info.X_SLP_SUBMODE=%d",
63         NULL,
64 };
65
66
67 inline const char *sql_get_filter(int prop)
68 {
69         retv_if(prop < 0 || prop >= NUM_OF_PROP , NULL);
70         return filter[prop];
71 }
72
73
74 inline char *sql_get_locale(void)
75 {
76         char *l;
77         char *r;
78         char buf[6];
79
80         retv_if ((l = ail_vconf_get_str(VCONFKEY_LANGSET)) == NULL, NULL);
81         snprintf(buf, sizeof(buf), "%s", l);
82         free(l);
83
84         r = strdup(buf);
85
86         return r;
87 }
88
89 inline int sql_get_app_info_idx(int prop)
90 {
91         return prop;
92 }
93
94 // End of file