@@ -833,9 +833,10 @@ class StaticProjectVarDifferential:
833833 native : dict [str , str ]
834834 python : dict [str , str | None ]
835835 substituted_dollar_quotes : int
836+ substituted_doubled_backticks : int
836837
837838
838- _LEXICAL_SQL_FRAGMENTS : tuple [str , ...] = (
839+ LEXICAL_SQL_FRAGMENTS : tuple [str , ...] = (
839840 "$" ,
840841 "$$" ,
841842 "$t$" ,
@@ -860,18 +861,32 @@ class StaticProjectVarDifferential:
860861 "_" ,
861862 "\u00e9 " ,
862863)
864+ BACKTICK_SQL_FRAGMENTS : tuple [str , ...] = (
865+ "`" ,
866+ "``" ,
867+ "'" ,
868+ "''" ,
869+ '"' ,
870+ "@@revision" ,
871+ "@@status" ,
872+ "@@" ,
873+ " " ,
874+ "x" ,
875+ "--" ,
876+ "\n " ,
877+ )
863878_LEXICAL_SQL_MAX_FRAGMENTS : int = 12
864879_DIFFERENTIAL_FILE_PATH : Path = Path ("models/generated.sql" )
865880
866881
867- def generated_lexical_sqls (* , seed : int , count : int ) -> tuple [str , ...]:
882+ def generated_lexical_sqls (* , seed : int , count : int , fragments : tuple [ str , ...] ) -> tuple [str , ...]:
868883 """Generate SQL-like strings mixing quotes, dollar quotes, comments and variable tokens."""
869884
870885 rng : random .Random = random .Random (seed )
871886 sqls : list [str ] = []
872887 for _ in range (count ):
873888 fragment_count : int = rng .randint (1 , _LEXICAL_SQL_MAX_FRAGMENTS )
874- sqls .append ("" .join (rng .choices (_LEXICAL_SQL_FRAGMENTS , k = fragment_count )))
889+ sqls .append ("" .join (rng .choices (fragments , k = fragment_count )))
875890 return tuple (sqls )
876891
877892
@@ -896,6 +911,9 @@ def native_static_project_var_differential(
896911 substituted_dollar_quotes = sum (
897912 sql != rendered and "$$" in sql for sql , rendered in native .items ()
898913 ),
914+ substituted_doubled_backticks = sum (
915+ sql != rendered and "``" in sql for sql , rendered in native .items ()
916+ ),
899917 )
900918
901919
0 commit comments