Revision b2448c14
Von Sven Schöling vor mehr als 12 Jahren hinzugefügt
SL/DBUpgrade2.pm | ||
---|---|---|
162 | 162 |
if (@quote_chars) { |
163 | 163 |
if ($char eq $quote_chars[-1]) { |
164 | 164 |
pop(@quote_chars); |
165 |
} elsif (length $quote_chars[-1] > 1 |
|
166 |
&& substr($quote_chars[-1], 0, 1) eq $char |
|
167 |
&& substr($_, $i, length $quote_chars[-1]) eq $quote_chars[-1]) { |
|
168 |
$i += length $quote_chars[-1] - 1; |
|
169 |
$char = $quote_chars[-1]; |
|
170 |
pop(@quote_chars); |
|
165 | 171 |
} |
166 | 172 |
$query .= $char; |
167 | 173 |
|
168 | 174 |
} else { |
175 |
my ($tag, $tag_end); |
|
169 | 176 |
if (($char eq "'") || ($char eq "\"")) { |
170 | 177 |
push(@quote_chars, $char); |
171 | 178 |
|
179 |
} elsif ($char eq '$' # start of dollar quoting |
|
180 |
&& ($tag_end = index($_, '$', $i + 1)) > -1 # ends on same line |
|
181 |
&& (do { substr($_, $i + 1, $tag_end - $i - 1); 1 }) # extract tag |
|
182 |
&& $tag =~ /^ (?= [A-Za-z_] [A-Za-z0-9_]* | ) $/x) { # tag is identifier |
|
183 |
push @quote_chars, $char = '$' . $tag . '$'; |
|
184 |
$i = $tag_end; |
|
172 | 185 |
} elsif ($char eq ";") { |
173 | 186 |
|
174 | 187 |
# Query is complete. Send it. |
Auch abrufbar als: Unified diff
DBUpgrade kann jetzt auch dollar quoting in SQL.