Modification about smack label of db file belong to process.
[platform/core/appfw/shortcut.git] / test_db_builder.sh
1 #!/bin/sh
2 #/*
3 # * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
4 # *
5 # * Licensed under the Apache License, Version 2.0 (the "License");
6 # * you may not use this file except in compliance with the License.
7 # * You may obtain a copy of the License at
8 # *
9 # * http://www.apache.org/licenses/LICENSE-2.0
10 # *
11 # * Unless required by applicable law or agreed to in writing, software
12 # * distributed under the License is distributed on an "AS IS" BASIS,
13 # * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # * See the License for the specific language governing permissions and
15 # * limitations under the License.
16 # *
17 #*/
18
19 eval $(tzplatform-get TZ_SYS_DB)
20 DBFILE=$TZ_SYS_DB"/.shortcut_service.db"
21
22 APPID=(
23 "org.tizen.facebook"
24 "org.tizen.facebook"
25 "org.tizen.facebook"
26 "org.tizen.facebook"
27 "org.tizen.facebook"
28 )
29
30 ICON=(
31 ""
32 ""
33 ""
34 ""
35 ""
36 )
37
38 NAME=(
39 "Friend's wall"
40 "Groups"
41 "Update status"
42 "Like by me"
43 "My wall"
44 )
45
46 KEY=(
47 "livebox_shortcut_type"
48 "livebox_shortcut_type"
49 "livebox_shortcut_type"
50 "livebox_shortcut_type"
51 "livebox_shortcut_type"
52 )
53
54 VALUE=(
55 "shortcut_friends"
56 "shortcut_groups"
57 "shortcut_post"
58 "shortcut_like"
59 "shortcut_me"
60 )
61
62 CNT=0
63 ERR=0
64 MAX=5
65
66 sqlite3 $DBFILE "CREATE TABLE shortcut_service (id INTEGER PRIMARY KEY AUTOINCREMENT, appid TEXT, icon TEXT, name TEXT, extra_key TEXT, extra_data TEXT)"
67 sqlite3 $DBFILE "CREATE TABLE shortcut_name (id INTEGER, lang TEXT, name TEXT)"
68 while [ $CNT -lt $MAX ]
69 do
70         echo "Insert a new record ('${APPID[$CNT]}', '${ICON[$CNT]}', '${NAME[$CNT]}', \"${KEY[$CNT]}\", \"${VALUE[$CNT]}\")"
71         sqlite3 $DBFILE "INSERT INTO shortcut_service (appid, icon, name, extra_key, extra_data) VALUES ('${APPID[$CNT]}', '${ICON[$CNT]}', \"${NAME[$CNT]}\", \"${KEY[$CNT]}\", \"${VALUE[$CNT]}\")" 2>/dev/null
72         if [ $? -ne 0 ]; then
73                 let ERR=$ERR+1
74         fi
75         ID=`sqlite3 $DBFILE "SELECT id FROM shortcut_service WHERE appid = \"${APPID[$CNT]}\" AND extra_key = \"${KEY[$CNT]}\" AND extra_data = \"${VALUE[$CNT]}\""`
76         echo "Insert a name: \"${NAME[$CNT]}\""
77         sqlite3 $DBFILE "INSERT INTO shortcut_name (id, lang, name) VALUES ('$ID', 'en-us', \"${NAME[CNT]}\")"
78         let CNT=$CNT+1
79 done
80
81 echo "Error/Total: $ERR/$CNT"