* check for SQL "BEGIN DECLARE SECTION". * must compare case insensitive and allow any spacing between words. * * @param line a reference to the line to indent. * @param index the current line index. * @return true if a hit. */
| 286 | * @return true if a hit. |
| 287 | */ |
| 288 | bool ASEnhancer::isBeginDeclareSectionSQL(string &line, size_t index) const |
| 289 | { |
| 290 | string word; |
| 291 | size_t hits = 0; |
| 292 | size_t i; |
| 293 | for (i = index; i < line.length(); i++) |
| 294 | { |
| 295 | i = line.find_first_not_of(" \t", i); |
| 296 | if (i == string::npos) |
| 297 | return false; |
| 298 | if (line[i] == ';') |
| 299 | break; |
| 300 | if (!isCharPotentialHeader(line, i)) |
| 301 | continue; |
| 302 | word = getCurrentWord(line, i); |
| 303 | for (size_t j = 0; j < word.length(); j++) |
| 304 | word[j] = (char) toupper(word[j]); |
| 305 | if (word == "EXEC" || word == "SQL") |
| 306 | { |
| 307 | i += word.length() - 1; |
| 308 | continue; |
| 309 | } |
| 310 | if (word == "DECLARE" || word == "SECTION") |
| 311 | { |
| 312 | hits++; |
| 313 | i += word.length() - 1; |
| 314 | continue; |
| 315 | } |
| 316 | if (word == "BEGIN") |
| 317 | { |
| 318 | hits++; |
| 319 | i += word.length() - 1; |
| 320 | continue; |
| 321 | } |
| 322 | return false; |
| 323 | } |
| 324 | if (hits == 3) |
| 325 | return true; |
| 326 | return false; |
| 327 | } |
| 328 | |
| 329 | /** |
| 330 | * check for SQL "END DECLARE SECTION". |
nothing calls this directly
no outgoing calls
no test coverage detected