3737#endif
3838#ifdef MODERN_SQLITE_STRINGVIEW_SUPPORT
3939#include < string_view>
40- typedef const std::string_view STR_REF;
41- typedef const std::u16string_view U16STR_REF;
40+ namespace sqlite
41+ {
42+ typedef const std::string_view str_ref;
43+ typedef const std::u16string_view u16str_ref;
44+ }
4245#else
43- typedef const std::string& STR_REF;
44- typedef const std::u16string& U16STR_REF;
46+ namespace sqlite
47+ {
48+ typedef const std::string& sqlite::str_ref;
49+ typedef const std::u16string& sqlite::u16str_ref;
50+ }
4551#endif
4652#include < sqlite3.h>
4753#include " errors.h"
@@ -161,14 +167,14 @@ namespace sqlite {
161167 sqlite3_result_null (db);
162168 }
163169
164- // STR_REF
170+ // str_ref
165171 template <>
166172 struct has_sqlite_type <std::string, SQLITE3_TEXT, void > : std::true_type {};
167- inline int bind_col_in_db (sqlite3_stmt* stmt, int inx, STR_REF val) {
173+ inline int bind_col_in_db (sqlite3_stmt* stmt, int inx, str_ref val) {
168174 return sqlite3_bind_text (stmt, inx, val.data (), val.length (), SQLITE_TRANSIENT);
169175 }
170176
171- // Convert char* to string_view to trigger op<<(..., const STR_REF )
177+ // Convert char* to string_view to trigger op<<(..., const str_ref )
172178 template <std::size_t N> inline int bind_col_in_db (sqlite3_stmt* stmt, int inx, const char (&STR)[N]) {
173179 return sqlite3_bind_text (stmt, inx, &STR[0 ], N-1 , SQLITE_TRANSIENT);
174180 }
@@ -182,17 +188,17 @@ namespace sqlite {
182188 std::string (reinterpret_cast <char const *>(sqlite3_value_text (value)), sqlite3_value_bytes (value));
183189 }
184190
185- inline void store_result_in_db (sqlite3_context* db, STR_REF val) {
191+ inline void store_result_in_db (sqlite3_context* db, str_ref val) {
186192 sqlite3_result_text (db, val.data (), val.length (), SQLITE_TRANSIENT);
187193 }
188- // U16STR_REF
194+ // u16str_ref
189195 template <>
190196 struct has_sqlite_type <std::u16string, SQLITE3_TEXT, void > : std::true_type {};
191- inline int bind_col_in_db (sqlite3_stmt* stmt, int inx, U16STR_REF val) {
197+ inline int bind_col_in_db (sqlite3_stmt* stmt, int inx, u16str_ref val) {
192198 return sqlite3_bind_text16 (stmt, inx, val.data (), sizeof (char16_t ) * val.length (), SQLITE_TRANSIENT);
193199 }
194200
195- // Convert char* to string_view to trigger op<<(..., const STR_REF )
201+ // Convert char* to string_view to trigger op<<(..., const str_ref )
196202 template <std::size_t N> inline int bind_col_in_db (sqlite3_stmt* stmt, int inx, const char16_t (&STR)[N]) {
197203 return sqlite3_bind_text16 (stmt, inx, &STR[0 ], N-1 , SQLITE_TRANSIENT);
198204 }
@@ -206,7 +212,7 @@ namespace sqlite {
206212 std::u16string (reinterpret_cast <char16_t const *>(sqlite3_value_text16 (value)), sqlite3_value_bytes16 (value));
207213 }
208214
209- inline void store_result_in_db (sqlite3_context* db, U16STR_REF val) {
215+ inline void store_result_in_db (sqlite3_context* db, u16str_ref val) {
210216 sqlite3_result_text16 (db, val.data (), sizeof (char16_t ) * val.length (), SQLITE_TRANSIENT);
211217 }
212218
0 commit comments