Update the project to the newest version.
[framework/appfw/shortcut.git] / test_db_builder.sh
1 #!/bin/sh
2 #/*
3 # * Copyright 2012  Samsung Electronics Co., Ltd
4 # *
5 # * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
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 DBFILE="/opt/dbspace/.shortcut_service.db"
19
20 APPID=(
21 "org.tizen.facebook"
22 "org.tizen.facebook"
23 "org.tizen.facebook"
24 "org.tizen.facebook"
25 "org.tizen.facebook"
26 )
27
28 ICON=(
29 ""
30 ""
31 ""
32 ""
33 ""
34 )
35
36 NAME=(
37 "Friend's wall"
38 "Groups"
39 "Update status"
40 "Like by me"
41 "My wall"
42 )
43
44 KEY=(
45 "livebox_shortcut_type"
46 "livebox_shortcut_type"
47 "livebox_shortcut_type"
48 "livebox_shortcut_type"
49 "livebox_shortcut_type"
50 )
51
52 VALUE=(
53 "shortcut_friends"
54 "shortcut_groups"
55 "shortcut_post"
56 "shortcut_like"
57 "shortcut_me"
58 )
59
60 CNT=0
61 ERR=0
62 MAX=5
63
64 sqlite3 $DBFILE "CREATE TABLE shortcut_service (id INTEGER PRIMARY KEY AUTOINCREMENT, appid TEXT, icon TEXT, name TEXT, extra_key TEXT, extra_data TEXT)"
65 sqlite3 $DBFILE "CREATE TABLE shortcut_name (id INTEGER, lang TEXT, name TEXT)"
66 while [ $CNT -lt $MAX ]
67 do
68         echo "Insert a new record ('${APPID[$CNT]}', '${ICON[$CNT]}', '${NAME[$CNT]}', \"${KEY[$CNT]}\", \"${VALUE[$CNT]}\")"
69         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
70         if [ $? -ne 0 ]; then
71                 let ERR=$ERR+1
72         fi
73         ID=`sqlite3 $DBFILE "SELECT id FROM shortcut_service WHERE appid = \"${APPID[$CNT]}\" AND extra_key = \"${KEY[$CNT]}\" AND extra_data = \"${VALUE[$CNT]}\""`
74         echo "Insert a name: \"${NAME[$CNT]}\""
75         sqlite3 $DBFILE "INSERT INTO shortcut_name (id, lang, name) VALUES ('$ID', 'en-us', \"${NAME[CNT]}\")"
76         let CNT=$CNT+1
77 done
78
79 echo "Error/Total: $ERR/$CNT"