MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / dpbItemUpper

Function dpbItemUpper

src/common/utils.cpp:1821–1868  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1819}
1820
1821const 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
1870bool isBpbSegmented(unsigned parLength, const unsigned char* par)
1871{

Callers 7

loadClntMethod · 0.50
ServerAuthMethod · 0.50
loadMethod · 0.50
getMethod · 0.50
getUserInfoFunction · 0.50
getOptionsMethod · 0.50
validatePasswordFunction · 0.50

Calls 6

GdsClass · 0.85
sqlSymbolCharFunction · 0.85
upperMethod · 0.80
c_strMethod · 0.45
assignMethod · 0.45
raiseMethod · 0.45

Tested by

no test coverage detected