MCPcopy Create free account
hub / github.com/erans/pgsqlite / has_any_special_pattern_fast

Function has_any_special_pattern_fast

src/query/unified_processor.rs:249–276  ·  view source on GitHub ↗
(bytes: &[u8])

Source from the content-addressed store, hash-verified

247/// Check if query has any special patterns that need translation
248#[inline(always)]
249fn has_any_special_pattern_fast(bytes: &[u8]) -> bool {
250 // Most common patterns that need translation
251 memchr::memmem::find(bytes, b"::").is_some() ||
252 memchr::memmem::find(bytes, b"NOW()").is_some() ||
253 memchr::memmem::find(bytes, b"CURRENT_").is_some() ||
254 memchr::memmem::find(bytes, b" ~ ").is_some() ||
255 memchr::memmem::find(bytes, b"pg_catalog").is_some() ||
256 memchr::memmem::find(bytes, b"PG_CATALOG").is_some() ||
257 memchr::memmem::find(bytes, b"CAST(").is_some() ||
258 memchr::memmem::find(bytes, b"cast(").is_some() ||
259 memchr::memchr(b'[', bytes).is_some() ||
260 memchr::memmem::find(bytes, b"ANY(").is_some() ||
261 memchr::memmem::find(bytes, b"ALL(").is_some() ||
262 memchr::memmem::find(bytes, b" @> ").is_some() ||
263 memchr::memmem::find(bytes, b" <@ ").is_some() ||
264 memchr::memmem::find(bytes, b" && ").is_some() ||
265 memchr::memmem::find(bytes, b"JOIN").is_some() ||
266 memchr::memmem::find(bytes, b"UNION").is_some() ||
267 memchr::memmem::find(bytes, b"(SELECT").is_some() ||
268 memchr::memmem::find(bytes, b"GROUP BY").is_some() ||
269 memchr::memmem::find(bytes, b"HAVING").is_some() ||
270 memchr::memmem::find(bytes, b"unnest").is_some() ||
271 memchr::memmem::find(bytes, b"UNNEST").is_some() ||
272 memchr::memmem::find(bytes, b"current_user").is_some() ||
273 memchr::memmem::find(bytes, b"CURRENT_USER").is_some() ||
274 memchr::memmem::find(bytes, b"session_user").is_some() ||
275 memchr::memmem::find(bytes, b"SESSION_USER").is_some()
276}
277
278/// Check INSERT-specific patterns
279#[inline(always)]

Callers 4

process_queryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected