Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for C++ Unicode types #379

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

dougnazar
Copy link
Contributor

Add support for using char8_t, char16_t, wchar_t, u8string, u16string & wstring when available.
wchar_t & wstring support are only available on platforms with a 2 byte wchar_t.

Usable to create Statements, bind parameters and retrieve column data.

The first commit is a fix for when the native database is in UTF-16 format and you try to extract a std::string.

@SRombauts
Copy link
Owner

Hey hello @dougnazar,
I have merged only the first of your commits, the bugfix & unit tests, in order to release a 3.2.1 bugfix release ASAP without changes to APIs
Thanks

@Pugnator
Copy link

Pugnator commented Jan 8, 2023

@dougnazar what about char32_t and u32string? I'm using it al lot in asian language tools. Are you planning to create new PR with it or I'll do it instead when all your commits will be merged.
@SRombauts when are you planning to merge at least bind-related commits? I believe it's very useful feature.

@dougnazar
Copy link
Contributor Author

Unfortunately SQLite doesn't natively support UTF-32, so there is no API to pass through to. They've recently added sqlite3_bind_text64() however it only accepts SQLITE_UTF8, SQLITE_UTF16, SQLITE_UTF16BE, or SQLITE_UTF16LE.

I'm not sure that SQLiteC++ is the correct layer to handle the conversion. It would add a hidden performance cost for using that API.

@Pugnator
Copy link

Pugnator commented Jan 8, 2023

Unfortunately SQLite doesn't natively support UTF-32, so there is no API to pass through to. They've recently added sqlite3_bind_text64() however it only accepts SQLITE_UTF8, SQLITE_UTF16, SQLITE_UTF16BE, or SQLITE_UTF16LE.

I'm not sure that SQLiteC++ is the correct layer to handle the conversion. It would add a hidden performance cost for using that API.

I agree, will stick to external 32-16 conversion until it's natively supported. Thank you for your enhancements!

Support for char16_t, u16string & u16string_view.
Support for char8_t, u8string & u8string_view.
Support for wchar_t, wstring & wstring_view (on 2-byte platforms).
Support for char16_t, u16string & u16string_view.
Support for char8_t, u8string & u8string_view.
Support for wchar_t, wstring & wstring_view (on 2-byte platforms).
Support for char16_t, u16string & u16string_view.
Support for char8_t, u8string & u8string_view.
Support for wchar_t, wstring & wstring_view (on 2-byte platforms).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants