Helper: FNV-1a 64-bit hash for SQL text.
(sql: &str)
| 226 | |
| 227 | /// Helper: FNV-1a 64-bit hash for SQL text. |
| 228 | pub fn hash_sql(sql: &str) -> u64 { |
| 229 | let mut h: u64 = 0xcbf2_9ce4_8422_2325; |
| 230 | for byte in sql.as_bytes() { |
| 231 | h ^= *byte as u64; |
| 232 | h = h.wrapping_mul(0x0000_0100_0000_01b3); |
| 233 | } |
| 234 | h |
| 235 | } |
| 236 | |
| 237 | /// Helper: hash a slice of placeholder type names. |
| 238 | pub fn hash_placeholder_types(types: &[&str]) -> u64 { |