forked from IQSS/dataverse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparse.pl
More file actions
executable file
·56 lines (43 loc) · 1005 Bytes
/
Copy pathparse.pl
File metadata and controls
executable file
·56 lines (43 loc) · 1005 Bytes
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
#!/usr/bin/perl
while (<>)
{
chop;
if ( /execute <unnamed>: (select .*)$/i || /execute <unnamed>: (insert .*)$/i || /execute <unnamed>: (update .*)$/i)
{
$select_q = $1;
if ($select_q =~/\$1/)
{
# saving the query, will substitute parameters
#print STDERR "saving query: " . $select_q . "\n";
}
else
{
print $select_q . "\n";
$select_q = "";
}
}
elsif (/^.*[A-Z][A-Z][A-Z] >DETAIL: parameters: (.*)$/i)
{
# print STDERR "EDT detail line encountered.\n";
unless ($select_q)
{
die "EDT DETAIL encountered (" . $_ . ", no select_q\n";
}
$params = $1;
@params_ = split (",", $params);
for $p (@params_)
{
$p =~s/^ *//;
$p =~s/ *$//;
$p =~s/ *=/=/g;
$p =~s/= */=/g;
# print STDERR $p . "\n";
($name,$value) = split ("=", $p);
$name =~s/^\$//g;
# print STDERR "name: $name, value: $value\n";
$select_q =~s/\$$name/$value/ge;
}
print $select_q . "\n";
$select_q = "";
}
}