|
| static bool | IsKeyword (const string &text, KeywordCategory category=KeywordCategory::KEYWORD_NONE) |
| | Returns true if the given text matches a keyword of the parser.
|
| static KeywordCategory | KeywordCategoryType (const string &text) |
| static string | EscapeQuotes (const string &text, char quote='"') |
| static bool | RequiresQuotes (const string &text, bool allow_caps=true, KeywordCategory category=KeywordCategory::KEYWORD_NONE) |
| | Returns true if the given string needs to be quoted when written as an identifier.
|
| static string | WriteQuoted (const string &text, char quote='\'') |
| | Writes a string that is quoted.
|
| static string | WriteOptionallyQuoted (const string &text, char quote='"', bool allow_caps = true, KeywordCategory category = KeywordCategory::KEYWORD_NONE) |
| | Writes a string that is optionally quoted + escaped so it can be used as an identifier.
|
◆ IsKeyword()
| bool duckdb::KeywordHelper::IsKeyword |
( |
const string & | text, |
|
|
KeywordCategory | category = KeywordCategory::KEYWORD_NONE ) |
|
static |
Returns true if the given text matches a keyword of the parser.
337995 {
337997}
static KeywordCategory IsKeyword(const string &text)
Returns true if the given text matches a keyword of the parser.
Definition duckdb.cpp:347516
◆ KeywordCategoryType()
| KeywordCategory duckdb::KeywordHelper::KeywordCategoryType |
( |
const string & | text | ) |
|
|
static |
◆ EscapeQuotes()
| string duckdb::KeywordHelper::EscapeQuotes |
( |
const string & | text, |
|
|
char | quote = '"' ) |
|
static |
338024 {
338025 return StringUtil::Replace(text, string(1, quote), string(2, quote));
338026}
◆ RequiresQuotes()
| bool duckdb::KeywordHelper::RequiresQuotes |
( |
const string & | text, |
|
|
bool | allow_caps = true, |
|
|
KeywordCategory | category = KeywordCategory::KEYWORD_NONE ) |
|
static |
Returns true if the given string needs to be quoted when written as an identifier.
338003 {
338004 for (size_t i = 0; i < text.size(); i++) {
338005 if (i > 0 && (text[i] >= '0' && text[i] <= '9')) {
338006 continue;
338007 }
338008 if (text[i] >= 'a' && text[i] <= 'z') {
338009 continue;
338010 }
338011 if (allow_caps) {
338012 if (text[i] >= 'A' && text[i] <= 'Z') {
338013 continue;
338014 }
338015 }
338016 if (text[i] == '_') {
338017 continue;
338018 }
338019 return true;
338020 }
338022}
static bool IsKeyword(const string &text, KeywordCategory category=KeywordCategory::KEYWORD_NONE)
Returns true if the given text matches a keyword of the parser.
Definition duckdb.cpp:337995
◆ WriteQuoted()
| string duckdb::KeywordHelper::WriteQuoted |
( |
const string & | text, |
|
|
char | quote = '\'' ) |
|
static |
Writes a string that is quoted.
338028 {
338029
338030
338031 return string(1, quote) + EscapeQuotes(text, quote) + string(1, quote);
338032}
◆ WriteOptionallyQuoted()
| string duckdb::KeywordHelper::WriteOptionallyQuoted |
( |
const string & | text, |
|
|
char | quote = '"', |
|
|
bool | allow_caps = true, |
|
|
KeywordCategory | category = KeywordCategory::KEYWORD_NONE ) |
|
static |
Writes a string that is optionally quoted + escaped so it can be used as an identifier.
338034 {
338036 return text;
338037 }
338039}
static bool RequiresQuotes(const string &text, bool allow_caps=true, KeywordCategory category=KeywordCategory::KEYWORD_NONE)
Returns true if the given string needs to be quoted when written as an identifier.
Definition duckdb.cpp:338003
static string WriteQuoted(const string &text, char quote='\'')
Writes a string that is quoted.
Definition duckdb.cpp:338028
The documentation for this class was generated from the following files: