-
Notifications
You must be signed in to change notification settings - Fork 0
/
processing_dbnames.go
67 lines (61 loc) · 1.04 KB
/
processing_dbnames.go
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
package sql1cv8
type dbnames struct {
m map[string]*dbname
cntEnums int
qryEnums string
cntPoints int
qryPoints string
}
type dbname struct {
ids string
typ string
num string
}
func processingDBNames(bin []byte) (d *dbnames) {
d = &dbnames{
m: make(map[string]*dbname, 65536),
}
var (
i string
t string
n string
ce, cp int
qe, qp string
)
pd := processing(bin)
for pd.next() {
level, posit, value := pd.get()
if level == 3 {
switch posit {
case 0:
i = value
case 1:
t = value
case 2:
n = value
d.m[t+n] = &dbname{
ids: i,
typ: t,
num: n,
}
switch t {
case "Enum":
ce++
qe += ",'" + i + "'"
case "BPrPoints":
cp++
qp += ",'" + i + ".7'"
}
}
}
}
if qe != "" {
d.cntEnums = ce
d.qryEnums = "select FileName, BinaryData from Config where FileName in (" + qe[1:] + ")"
}
if qp != "" {
d.cntPoints = cp
d.qryPoints = "select left(FileName, 36) FileName, BinaryData from Config where FileName in (" + qp[1:] + ")"
}
return d
}