boost_sqlite 1
A sqlite C++ library
Loading...
Searching...
No Matches
string.hpp
1// Copyright (c) 2023 Klemens D. Morgenstern
2//
3// Distributed under the Boost Software License, Version 1.0. (See accompanying
4// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5#ifndef BOOST_SQLITE_STRING_HPP
6#define BOOST_SQLITE_STRING_HPP
7
8#include <boost/sqlite/detail/config.hpp>
9#include <boost/sqlite/cstring_ref.hpp>
10
11BOOST_SQLITE_BEGIN_NAMESPACE
12
13inline
14bool like(
15 cstring_ref lhs,
16 cstring_ref rhs,
17 char escape = '\0')
18{
19 return sqlite3_strlike(lhs.c_str(), rhs.c_str(), escape) != 0;
20}
21
22inline
23bool glob(
24 cstring_ref lhs,
25 cstring_ref rhs)
26{
27 return sqlite3_strglob(lhs.c_str(), rhs.c_str()) != 0;
28}
29
30inline
31int icmp(
32 cstring_ref lhs,
33 cstring_ref rhs)
34{
35 return sqlite3_stricmp(lhs.c_str(), rhs.c_str());
36}
37
38inline
39int icmp(
40 core::string_view lhs,
41 core::string_view rhs,
42 std::size_t n)
43{
44 return sqlite3_strnicmp(lhs.data(), rhs.data(), static_cast<int>(n));
45}
46
47BOOST_SQLITE_END_NAMESPACE
48
49#endif //BOOST_SQLITE_STRING_HPP