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
|
# File 'lib/candy--sql/variable.rb', line 21
def definAs(src, var)
val = []
key = src[0]
if src[3] == "["
val << [src[2], "AS", key]
src.shift(3)
src.each{ |s|
if s == "]"
else
if s == "["
s = "ON"
elsif var.key?(s)
s = var[s]
end
val << s
end
}
else
src.shift(2)
src.each_with_index{ |s, i|
if var.key?(s)
src[i] = var[s]
end
}
src << ["AS", key]
val = src
end
var[key] = val.join(" ")
return var
end
|