myTinySQL v0.2.0-2-g5000098
A tiny SQL interpreter over fixed-width text files
Loading...
Searching...
No Matches
Util.hpp
Go to the documentation of this file.
1
3
4#pragma once
5
6#include <optional>
7#include <stdexcept>
8#include <string>
9#include <string_view>
10
11namespace tinysql {
12
16class SqlError : public std::runtime_error {
17public:
18 using std::runtime_error::runtime_error;
19};
20
24std::string_view trimRight(std::string_view text);
25
29std::string_view trim(std::string_view text);
30
34std::string toUpper(std::string_view text);
35
40bool equalsIgnoreCase(std::string_view a, std::string_view b);
41
51bool matchesLike(std::string_view text, std::string_view pattern);
52
56std::optional<long long> parseInteger(std::string_view text);
57
58} // namespace tinysql
std::optional< long long > parseInteger(std::string_view text)
Parses a whole string as a base-10 integer.
Definition Util.cpp:82
std::string toUpper(std::string_view text)
Converts ASCII letters to upper case.
Definition Util.cpp:42
std::string_view trimRight(std::string_view text)
Removes trailing spaces, tabs and line ends.
Definition Util.cpp:26
bool matchesLike(std::string_view text, std::string_view pattern)
Matches text against an SQL LIKE pattern, ignoring the case of ASCII letters.
Definition Util.cpp:54
bool equalsIgnoreCase(std::string_view a, std::string_view b)
Compares two strings, ignoring the case of ASCII letters.
Definition Util.cpp:49
std::string_view trim(std::string_view text)
Removes leading and trailing spaces, tabs and line ends.
Definition Util.cpp:34
A problem with one statement: bad syntax, unknown table, value too long...
Definition Util.hpp:16