OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
StringLike.h
Go to the documentation of this file.
1 /*
2  * Copyright 2022 HEAVY.AI, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
24 #ifndef STRING_LIKE_H
25 #define STRING_LIKE_H
26 
27 #include "../Shared/funcannotations.h"
28 
29 #include <cstdint>
30 
31 /*
32  * @brief string_like performs the SQL LIKE and ILIKE operation
33  * @param str string argument to be matched against pattern. single-byte
34  * character set only for now. null-termination not required.
35  * @param str_len length of str
36  * @param pattern pattern string for SQL LIKE
37  * @param pat_len length of pattern
38  * @param escape_char the escape character. '\\' is expected by default.
39  * @param is_ilike true if it is ILIKE, i.e., case-insensitive matching
40  * @return true if str matchs pattern, false otherwise. error condition
41  * not handled for now.
42  */
43 extern "C" RUNTIME_EXPORT DEVICE bool string_like(const char* str,
44  int str_len,
45  const char* pattern,
46  int pat_len,
47  char escape_char);
48 
49 extern "C" RUNTIME_EXPORT DEVICE bool string_ilike(const char* str,
50  int str_len,
51  const char* pattern,
52  int pat_len,
53  char escape_char);
54 
55 extern "C" RUNTIME_EXPORT DEVICE bool string_like_simple(const char* str,
56  const int32_t str_len,
57  const char* pattern,
58  const int32_t pat_len);
59 
60 extern "C" RUNTIME_EXPORT DEVICE bool string_ilike_simple(const char* str,
61  const int32_t str_len,
62  const char* pattern,
63  const int32_t pat_len);
64 
65 extern "C" RUNTIME_EXPORT DEVICE bool string_lt(const char* lhs,
66  const int32_t lhs_len,
67  const char* rhs,
68  const int32_t rhs_len);
69 
70 extern "C" RUNTIME_EXPORT DEVICE bool string_le(const char* lhs,
71  const int32_t lhs_len,
72  const char* rhs,
73  const int32_t rhs_len);
74 
75 extern "C" RUNTIME_EXPORT DEVICE bool string_eq(const char* lhs,
76  const int32_t lhs_len,
77  const char* rhs,
78  const int32_t rhs_len);
79 
80 extern "C" RUNTIME_EXPORT DEVICE bool string_ne(const char* lhs,
81  const int32_t lhs_len,
82  const char* rhs,
83  const int32_t rhs_len);
84 
85 extern "C" RUNTIME_EXPORT DEVICE bool string_ge(const char* lhs,
86  const int32_t lhs_len,
87  const char* rhs,
88  const int32_t rhs_len);
89 
90 extern "C" RUNTIME_EXPORT DEVICE bool string_gt(const char* lhs,
91  const int32_t lhs_len,
92  const char* rhs,
93  const int32_t rhs_len);
94 
95 extern "C" RUNTIME_EXPORT DEVICE int32_t StringCompare(const char* s1,
96  const int32_t s1_len,
97  const char* s2,
98  const int32_t s2_len);
99 
100 #endif // STRING_LIKE_H
RUNTIME_EXPORT DEVICE int32_t StringCompare(const char *s1, const int32_t s1_len, const char *s2, const int32_t s2_len)
Definition: StringLike.cpp:266
RUNTIME_EXPORT DEVICE bool string_eq(const char *lhs, const int32_t lhs_len, const char *rhs, const int32_t rhs_len)
Definition: StringLike.cpp:330
RUNTIME_EXPORT DEVICE bool string_gt(const char *lhs, const int32_t lhs_len, const char *rhs, const int32_t rhs_len)
Definition: StringLike.cpp:316
RUNTIME_EXPORT DEVICE bool string_le(const char *lhs, const int32_t lhs_len, const char *rhs, const int32_t rhs_len)
Definition: StringLike.cpp:309
RUNTIME_EXPORT DEVICE bool string_ge(const char *lhs, const int32_t lhs_len, const char *rhs, const int32_t rhs_len)
Definition: StringLike.cpp:323
RUNTIME_EXPORT DEVICE bool string_lt(const char *lhs, const int32_t lhs_len, const char *rhs, const int32_t rhs_len)
Definition: StringLike.cpp:302
#define DEVICE
RUNTIME_EXPORT DEVICE bool string_like(const char *str, const int32_t str_len, const char *pattern, const int32_t pat_len, const char escape_char)
Definition: StringLike.cpp:244
RUNTIME_EXPORT DEVICE bool string_like_simple(const char *str, const int32_t str_len, const char *pattern, const int32_t pat_len)
Definition: StringLike.cpp:41
#define RUNTIME_EXPORT
RUNTIME_EXPORT DEVICE bool string_ilike_simple(const char *str, const int32_t str_len, const char *pattern, const int32_t pat_len)
Definition: StringLike.cpp:57
RUNTIME_EXPORT DEVICE bool string_ne(const char *lhs, const int32_t lhs_len, const char *rhs, const int32_t rhs_len)
Definition: StringLike.cpp:337
RUNTIME_EXPORT DEVICE bool string_ilike(const char *str, const int32_t str_len, const char *pattern, const int32_t pat_len, const char escape_char)
Definition: StringLike.cpp:255