| 1819 | } |
| 1820 | |
| 1821 | const char* dpbItemUpper(const char* s, FB_SIZE_T l, Firebird::string& buf) |
| 1822 | { |
| 1823 | if (l && (s[0] == '"' || s[0] == '\'')) |
| 1824 | { |
| 1825 | const char end_quote = s[0]; |
| 1826 | bool ascii = true; |
| 1827 | |
| 1828 | // quoted string - strip quotes |
| 1829 | for (FB_SIZE_T i = 1; i < l; ++i) |
| 1830 | { |
| 1831 | if (s[i] == end_quote) |
| 1832 | { |
| 1833 | if (++i >= l) |
| 1834 | { |
| 1835 | if (ascii && s[0] == '\'') |
| 1836 | buf.upper(); |
| 1837 | |
| 1838 | return buf.c_str(); |
| 1839 | } |
| 1840 | |
| 1841 | if (s[i] != end_quote) |
| 1842 | { |
| 1843 | buf.assign(&s[i], l - i); |
| 1844 | (Firebird::Arg::Gds(isc_quoted_str_bad) << buf).raise(); |
| 1845 | } |
| 1846 | |
| 1847 | // skipped the escape quote, continue processing |
| 1848 | } |
| 1849 | else if (!sqlSymbolChar(s[i], i == 1)) |
| 1850 | ascii = false; |
| 1851 | |
| 1852 | buf += s[i]; |
| 1853 | } |
| 1854 | |
| 1855 | buf.assign(1, s[0]); |
| 1856 | (Firebird::Arg::Gds(isc_quoted_str_miss) << buf).raise(); |
| 1857 | } |
| 1858 | |
| 1859 | // non-quoted string - try to uppercase |
| 1860 | for (FB_SIZE_T i = 0; i < l; ++i) |
| 1861 | { |
| 1862 | if (!sqlSymbolChar(s[i], i == 0)) |
| 1863 | return NULL; // contains non-ascii data |
| 1864 | buf += toupper(s[i]); |
| 1865 | } |
| 1866 | |
| 1867 | return buf.c_str(); |
| 1868 | } |
| 1869 | |
| 1870 | bool isBpbSegmented(unsigned parLength, const unsigned char* par) |
| 1871 | { |
no test coverage detected