mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-25 10:09:36 +02:00
SyntaxExcpetion changed into DataFormatException; couple of comment fixes
This commit is contained in:
@@ -46,22 +46,22 @@ namespace ODBC {
|
|||||||
|
|
||||||
|
|
||||||
void makeUTF16(SQLCHAR* pSQLChar, SQLINTEGER length, std::string& target);
|
void makeUTF16(SQLCHAR* pSQLChar, SQLINTEGER length, std::string& target);
|
||||||
/// Utility function for conversion from ASCII to UTF-16
|
/// Utility function for conversion from UTF-8 to UTF-16
|
||||||
|
|
||||||
|
|
||||||
inline void makeUTF16(SQLCHAR* pSQLChar, SQLSMALLINT length, std::string& target)
|
inline void makeUTF16(SQLCHAR* pSQLChar, SQLSMALLINT length, std::string& target)
|
||||||
/// Utility function for conversion from ASCII to UTF-16.
|
/// Utility function for conversion from UTF-8 to UTF-16.
|
||||||
{
|
{
|
||||||
makeUTF16(pSQLChar, (SQLINTEGER) length, target);
|
makeUTF16(pSQLChar, (SQLINTEGER) length, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void makeUTF8(Poco::Buffer<SQLWCHAR>& buffer, int length, SQLPOINTER pTarget, SQLINTEGER targetLength);
|
inline void makeUTF8(Poco::Buffer<SQLWCHAR>& buffer, int length, SQLPOINTER pTarget, SQLINTEGER targetLength);
|
||||||
/// Utility function for conversion from UTF-16 to ASCII.
|
/// Utility function for conversion from UTF-16 to UTF-8.
|
||||||
|
|
||||||
|
|
||||||
inline void makeUTF8(Poco::Buffer<SQLWCHAR>& buffer, int length, SQLPOINTER pTarget, SQLSMALLINT targetLength)
|
inline void makeUTF8(Poco::Buffer<SQLWCHAR>& buffer, int length, SQLPOINTER pTarget, SQLSMALLINT targetLength)
|
||||||
/// Utility function for conversion from UTF-16 to ASCII.
|
/// Utility function for conversion from UTF-16 to UTF-8.
|
||||||
{
|
{
|
||||||
makeUTF8(buffer, length, pTarget, (SQLINTEGER) targetLength);
|
makeUTF8(buffer, length, pTarget, (SQLINTEGER) targetLength);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ void makeUTF16(SQLCHAR* pSQLChar, SQLINTEGER length, std::string& target)
|
|||||||
TextConverter converter(utf8Encoding, utf16Encoding);
|
TextConverter converter(utf8Encoding, utf16Encoding);
|
||||||
|
|
||||||
if (0 != converter.convert(pSQLChar, len, target))
|
if (0 != converter.convert(pSQLChar, len, target))
|
||||||
throw SyntaxException("Error converting UTF-8 to UTF-16");
|
throw DataFormatException("Error converting UTF-8 to UTF-16");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ void makeUTF8(Poco::Buffer<SQLWCHAR>& buffer, int length, SQLPOINTER pTarget, SQ
|
|||||||
|
|
||||||
std::string result;
|
std::string result;
|
||||||
if (0 != converter.convert(buffer.begin(), length * sizeof(SQLWCHAR), result))
|
if (0 != converter.convert(buffer.begin(), length * sizeof(SQLWCHAR), result))
|
||||||
throw SyntaxException("Error converting UTF-16 to UTF-8");
|
throw DataFormatException("Error converting UTF-16 to UTF-8");
|
||||||
|
|
||||||
std::memset(pTarget, 0, targetLength);
|
std::memset(pTarget, 0, targetLength);
|
||||||
std::strncpy((char*) pTarget, result.c_str(), result.size() < targetLength ? result.size() : targetLength);
|
std::strncpy((char*) pTarget, result.c_str(), result.size() < targetLength ? result.size() : targetLength);
|
||||||
|
|||||||
Reference in New Issue
Block a user