static void getUTF8Result(const RtlFieldInfo *field, sqlite3_value *val, size32_t &chars, char * &result) { assertex(val); if (isNull(val)) { NullFieldProcessor p(field); rtlUtf8ToUtf8X(chars, result, p.resultChars, p.stringResult); return; } if (sqlite3_value_type(val) != SQLITE_TEXT) typeError("string", field); const char *text = (const char *) sqlite3_value_text(val); int bytes = sqlite3_value_bytes(val); unsigned numchars = rtlUtf8Length(bytes, text); rtlUtf8ToUtf8X(chars, result, numchars, text); }
virtual void processUtf8(unsigned len, const char *value, const RtlFieldInfo * field) { size32_t utf8chars; char *utf8; rtlUtf8ToUtf8X(utf8chars, utf8, len, value); MYSQL_BIND &bindInfo = createBindBuffer(MYSQL_TYPE_STRING, 0); bindInfo.buffer = utf8; bindInfo.buffer_length = rtlUtf8Size(utf8chars, utf8); bindInfo.length = &bindInfo.buffer_length; }
static void getUTF8Result(const RtlFieldInfo *field, const MYSQL_BIND &bound, size32_t &chars, char * &result) { if (*bound.is_null) { NullFieldProcessor p(field); rtlUtf8ToUtf8X(chars, result, p.resultChars, p.stringResult); return; } if (isDateTime(bound.buffer_type)) { getDateTimeText(bound, chars, result); return; } if (!isString(bound.buffer_type)) typeError("string", field); const char *text = (const char *) bound.buffer; unsigned long bytes = *bound.length; unsigned numchars = rtlUtf8Length(bytes, text); // MORE - is it a good assumption that it is utf8 ? Depends how the database is configured I think rtlUtf8ToUtf8X(chars, result, numchars, text); }