OmniSciDB  a5dc49c757
 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  char escape_char);
60 
61 extern "C" RUNTIME_EXPORT DEVICE bool string_ilike_simple(const char* str,
62  const int32_t str_len,
63  const char* pattern,
64  const int32_t pat_len,
65  char escape_char);
66 
67 extern "C" RUNTIME_EXPORT DEVICE bool string_lt(const char* lhs,
68  const int32_t lhs_len,
69  const char* rhs,
70  const int32_t rhs_len);
71 
72 extern "C" RUNTIME_EXPORT DEVICE bool string_le(const char* lhs,
73  const int32_t lhs_len,
74  const char* rhs,
75  const int32_t rhs_len);
76 
77 extern "C" RUNTIME_EXPORT DEVICE bool string_eq(const char* lhs,
78  const int32_t lhs_len,
79  const char* rhs,
80  const int32_t rhs_len);
81 
82 extern "C" RUNTIME_EXPORT DEVICE bool string_ne(const char* lhs,
83  const int32_t lhs_len,
84  const char* rhs,
85  const int32_t rhs_len);
86 
87 extern "C" RUNTIME_EXPORT DEVICE bool string_ge(const char* lhs,
88  const int32_t lhs_len,
89  const char* rhs,
90  const int32_t rhs_len);
91 
92 extern "C" RUNTIME_EXPORT DEVICE bool string_gt(const char* lhs,
93  const int32_t lhs_len,
94  const char* rhs,
95  const int32_t rhs_len);
96 
97 extern "C" RUNTIME_EXPORT DEVICE int32_t StringCompare(const char* s1,
98  const int32_t s1_len,
99  const char* s2,
100  const int32_t s2_len);
101 
102 #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:272
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:336
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:322
RUNTIME_EXPORT DEVICE bool string_ilike_simple(const char *str, const int32_t str_len, const char *pattern, const int32_t pat_len, char escape_char)
Definition: StringLike.cpp:61
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:315
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:329
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:308
#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:250
#define RUNTIME_EXPORT
RUNTIME_EXPORT DEVICE bool string_like_simple(const char *str, const int32_t str_len, const char *pattern, const int32_t pat_len, char escape_char)
Definition: StringLike.cpp:43
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:343
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:261