-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtable_index.sh
executable file
·89 lines (76 loc) · 1.56 KB
/
table_index.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/usr/bin/bash
#this file is called with argument $1 DBName
tmpForm=$(yad \
--center \
--title "7amasa DB Engine" \
--form --field="Enter table Name" \
--form --entry-label="Enter table Name" \
--button=gtk-ok:0 \
--button=gtk-cancel:1 \
)
choice0=$?
if [ $choice0 = 1 ]
then
continue
elif [ $choice0 = 252 ]
then
kill -9 `ps --pid $$ -oppid=`; exit
elif [ $choice0 = 0 ]
then
tName=$(echo $tmpForm | awk 'BEGIN {FS="|" } { print $1 }')
while [ true ]
do
typeset -i flag=1
if [[ `grep -c "$tName" /var/7amasaDB/$1/.meta` -gt 0 ]]
then
if [ ! $tName ]
then
flag=0
else
tForm=$(yad \
--center \
--title "7amasa DB Engine" \
--text "$tName Table" \
--text-align=center \
--button="1) Display content":1 \
--button="2) insert new record":2 \
--button="3) update record":3 \
--button="4) delete record":4 \
--button="5) back":5 \
)
choice=$?
case $choice in
1)
d=$(cat /var/7amasaDB/$1/$tName)
{ printf '%s\t' "${d[@]}"| yad --text-info --width="200" --height="200" --title="Table content" \
--button="back:1" \
2>/dev/null
};
;;
2) ./insert_record.sh $1 $tName
;;
3) ./modify.sh $1 $tName
;;
4) ./delete_record.sh $1 $tName
;;
5) break
;;
252) kill -9 `ps --pid $$ -oppid=`; exit
;;
esac
fi
else
flag=0
fi
if [[ $flag -eq 0 ]]
then
tmpForm=$(yad \
--center \
--title "7amasa DB Engine" \
--text "$tName Table not found" \
--button=gtk-go-back:1 \
)
break
fi
done
fi