// ----------------------------------------------------------------------------- // CSatCGetInputHandler::ConvertCharacterSet // Converts USAT character set to SAT character set type. // ----------------------------------------------------------------------------- // TSatCharacterSet CSatCGetInputHandler::ConvertCharacterSet( const RSat::TGetInputRspFormat& aCharacterSet ) const { LOG( SIMPLE, "SATINTERNALCLIENT: CSatCGetInputHandler::ConvertCharacterSet calling" ) TSatCharacterSet charSet( ESatCharSmsDefaultAlphabet ); LOG2( SIMPLE, "SATINTERNALCLIENT: CSatCGetInputHandler::ConvertCharacterSet aCharacterSet: %d", aCharacterSet ) if ( ( RSat::EDigitOnlyUnpacked == aCharacterSet ) || ( RSat::EDigitOnlyPacked == aCharacterSet ) ) { charSet = ESatDigitOnly; } else if ( aCharacterSet == RSat::EUcs2Alphabet ) { charSet = ESatCharUcs2Alphabet; } else { charSet = ESatCharSmsDefaultAlphabet; } LOG( SIMPLE, "SATINTERNALCLIENT: CSatCGetInputHandler::ConvertCharacterSet exiting" ) return charSet; }
// Transform ICU-VERSION attribute (given by the user) in COLL-VERSION (to be stored). bool IntlUtil::setupIcuAttributes(charset* cs, const string& specificAttributes, const string& configInfo, string& newSpecificAttributes) { AutoPtr<Jrd::CharSet> charSet(Jrd::CharSet::createInstance(*getDefaultMemoryPool(), 0, cs)); IntlUtil::SpecificAttributesMap map; if (!IntlUtil::parseSpecificAttributes(charSet, specificAttributes.length(), (const UCHAR*) specificAttributes.begin(), &map)) { return false; } string icuVersion; map.get("ICU-VERSION", icuVersion); string collVersion; if (!UnicodeUtil::getCollVersion(icuVersion, configInfo, collVersion)) return false; map.remove("ICU-VERSION"); map.remove("COLL-VERSION"); if (collVersion.hasData()) map.put("COLL-VERSION", collVersion); newSpecificAttributes = IntlUtil::generateSpecificAttributes(charSet, map); return true; }
NABoolean StmtModule::unparse(NAString &result, NABoolean wantR18behavior) { NABoolean err = applyDefaults(wantR18behavior); result += NAString("MODULE ") + name().getQualifiedNameAsAnsiNTFilenameString() + " NAMES ARE " + charSet() + ";"; return err; }
void CNumberEdit::Prepare() { if( m_nType == ntDouble ) { struct lconv *pConv = localeconv(); CString charSet( _T("1234567890") ); if( m_dMin < 0.0 || m_dMax < 0.0 ) charSet+= _T('-'); SetCharSet( charSet + pConv->decimal_point ); } else { CString charSet( _T("1234567890") ); if( m_lMin < 0 || m_lMax < 0 ) charSet+= _T('-'); SetCharSet( charSet ); } }
NABoolean StmtModule::unparseSimple(NAString &result, NABoolean wantR18behavior) { NABoolean err = applyDefaults(wantR18behavior); // assume caller will handle err result += NAString("MODULE ") + name().getQualifiedNameAsAnsiString() + " NAMES ARE " + charSet() + ";"; return err; }
// Apply defaults to self, and then (ANSI 12.1 SR 3) apply self to SchemaDB. NABoolean StmtModule::applyDefaults(NABoolean wantR18behavior) { NABoolean err = FALSE; if (charSet().isNull()) charSet() = CharInfo::getCharSetName(CharInfo::DefaultCharSet); if (CharInfo::isCharSetSupported(charSet())) { // Get charset name in canonical format (the name of the enum of the name). charSet() = CharInfo::getCharSetName(CharInfo::getCharSetEnum(charSet())); } else { *CmpCommon::diags() << DgSqlCode(-3010) << DgString0(charSet()); err = TRUE; } if (!CharInfo::isModuleCharSetSupported(CharInfo::getCharSetEnum(charSet()))) { *CmpCommon::diags() << DgSqlCode(-3404) << DgString0(charSet()); err = TRUE; } // Here we're using internal-format names if (name().getCatalogName().isNull()) { // Must be an Ansi name, not an MPLOC. const SchemaName& defcs = ActiveSchemaDB()->getDefaultSchema( SchemaDB::REFRESH_CACHE | SchemaDB::FORCE_ANSI_NAMETYPE); if (name().getSchemaName().isNull()) { if (name().getObjectName().isNull()) { name().setObjectName("SQLMX_DEFAULT_MODULE_"); } name().setSchemaName(defcs.getSchemaName()); } name().setCatalogName(defcs.getCatalogName()); } if (wantR18behavior) { // And now we use external-format names, for the ANSI 12.1 SR 3 stuff. NAString catName(name().getCatalogNameAsAnsiString()); if (!ActiveSchemaDB()->getDefaults().setCatalog(catName)) err = TRUE; NAString schName(name().getUnqualifiedSchemaNameAsAnsiString()); if (!ActiveSchemaDB()->getDefaults().setSchema(schName)) err = TRUE; } else { // want R2 (correct) behavior // We used to take the catalog & schema of the module directive and apply // them above as the default catalog & schema. This was a misguided // attempt to "use external-format names, for the ANSI 12.1 SR 3 stuff" // in the SQL92 std. // // In SQL99, this has been clarified in section 13.1 of ISO/IEC FDIS // 9075-2:1999 (aka the 1999 Foundation doc) where syntax rules 3 & 4 // specify that: // // "If the explicit or implicit <schema name> does not specify a <catalog // name>, then an implementation-defined <catalog name> is implicit." // // "The implicit or explicit <catalog name> is the implicit <catalog name> // for all unqualified <schema name>s in the <SQL-client module // definition>." // // Three observations may be worth pointing out here: // 1) SQL/MX client modules do not have a <module authorization clause> as // specified by the SQL99 std. // 2) Even if (in the future) SQL/MX tries to conform to the SQL99 std for // client module definition(s), the SQL99 std itself (syntax rule 3) // allows us to use "an implementation-defined <catalog name>" to // implicitly qualify unqualified <schema name>s. // 3) This current "implementation is a deviation from ANSI in // that the module name is a 3-part name. This deviation and the use of // cat/sch name to qualify unqualified SQL objects in the module are // also 'valid' implementation of the 2 syntax rules 13.1, rules 3 & 4 // of ANSI." // Similar logic can be applied to using an implementation-defined // <schema name> to implicitly qualify unqualified table names, etc. // // In other words, our technique of using CQD default CATALOG & SCHEMA // settings to qualify unqualified table names, view names, etc is allowed // for by the SQL99 std. // // Deleting the old code that was here is part of the fix to genesis // cases 10-030725-8215, 10-030730-8326, 10-030826-0792. } return err; }
char* GTokenizer::nextArg(GCharSet& delimiters, char escapeChar) { char c = m_pStream->peek(); if(c == '"') { advance(1); nextUntil(charSet("\"\n")); if(peek() != '"') ThrowError("Expected matching double-quotes on line ", to_str(m_line), ", col ", to_str(col())); advance(1); return m_pBufStart; } else if(c == '\'') { advance(1); nextUntil(charSet("'\n")); if(peek() != '\'') ThrowError("Expected a matching single-quote on line ", to_str(m_line), ", col ", to_str(col())); advance(1); return m_pBufStart; } //else m_pBufPos = m_pBufStart; bool inEscapeMode = false; while(m_len > 0) { char c = m_pStream->peek(); if(inEscapeMode) { if(c == '\n') { ThrowError("Error: '", to_str(escapeChar), "' character used as " "last character on a line to attempt to extend string over " "two lines on line" , to_str(m_line), ", col ", to_str(col()) ); } c = get(); bufferChar(c); inEscapeMode = false; } else { if(c == '\n' || delimiters.find(c)){ break; } c = get(); if(c == escapeChar) { inEscapeMode = true; } else { bufferChar(c); } } } if(m_pBufPos == m_pBufEnd) { growBuf(); } *m_pBufPos = '\0'; // std::cerr << "nextArg: '" << m_pBufStart << "'\n"; //DEBUG return m_pBufStart; }
//--------------------------------------------- vector<ofUniChar> ofCharacterSet::getCharacterSet() { vector<ofUniChar> charSet(characters.begin(), characters.end()); return charSet; }