* check for SQL "END 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. */
| 335 | * @return true if a hit. |
| 336 | */ |
| 337 | bool ASEnhancer::isEndDeclareSectionSQL(string &line, size_t index) const |
| 338 | { |
| 339 | string word; |
| 340 | size_t hits = 0; |
| 341 | size_t i; |
| 342 | for (i = index; i < line.length(); i++) |
| 343 | { |
| 344 | i = line.find_first_not_of(" \t", i); |
| 345 | if (i == string::npos) |
| 346 | return false; |
| 347 | if (line[i] == ';') |
| 348 | break; |
| 349 | if (!isCharPotentialHeader(line, i)) |
| 350 | continue; |
| 351 | word = getCurrentWord(line, i); |
| 352 | for (size_t j = 0; j < word.length(); j++) |
| 353 | word[j] = (char) toupper(word[j]); |
| 354 | if (word == "EXEC" || word == "SQL") |
| 355 | { |
| 356 | i += word.length() - 1; |
| 357 | continue; |
| 358 | } |
| 359 | if (word == "DECLARE" || word == "SECTION") |
| 360 | { |
| 361 | hits++; |
| 362 | i += word.length() - 1; |
| 363 | continue; |
| 364 | } |
| 365 | if (word == "END") |
| 366 | { |
| 367 | hits++; |
| 368 | i += word.length() - 1; |
| 369 | continue; |
| 370 | } |
| 371 | return false; |
| 372 | } |
| 373 | if (hits == 3) |
| 374 | return true; |
| 375 | return false; |
| 376 | } |
| 377 | |
| 378 | /** |
| 379 | * check if a one-line bracket has been reached, |
nothing calls this directly
no outgoing calls
no test coverage detected