001package gudusoft.gsqlparser.resolver2.matcher; 002 003/** 004 * Interface for matching names (tables, columns) with various rules. 005 * Handles case sensitivity, database-specific matching rules, etc. 006 * 007 * Different databases have different name matching rules: 008 * - MySQL: case-insensitive on Windows, case-sensitive on Unix 009 * - PostgreSQL: case-sensitive for quoted identifiers 010 * - Oracle: case-insensitive, converts to uppercase 011 * - SQL Server: depends on collation 012 */ 013public interface INameMatcher { 014 015 /** 016 * Check if two names match according to the matching rules. 017 * 018 * @param name1 First name 019 * @param name2 Second name 020 * @return true if names match 021 */ 022 boolean matches(String name1, String name2); 023 024 /** 025 * Check if a name is a valid match for a pattern. 026 * Used for prefix matching, wildcard matching, etc. 027 * 028 * @param name The name to test 029 * @param pattern The pattern to match against 030 * @return true if name matches pattern 031 */ 032 boolean matchesPattern(String name, String pattern); 033 034 /** 035 * Normalize a name according to matching rules. 036 * E.g., convert to uppercase for Oracle, lowercase for PostgreSQL unquoted. 037 * 038 * @param name Name to normalize 039 * @return Normalized name 040 */ 041 String normalize(String name); 042 043 /** 044 * Check if the matcher is case-sensitive 045 */ 046 boolean isCaseSensitive(); 047}