@@ -15,7 +15,7 @@ defmodule SQL.Repo do
1515 end
1616end
1717Application . put_env ( :sql , :ecto_repos , [ SQL.Repo ] )
18- Application . put_env ( :sql , SQL.Repo , log: false , username: "postgres" , password: "postgres" , hostname: "localhost" , database: "sql_test#{ System . get_env ( "MIX_TEST_PARTITION" ) } " , pool: Ecto.Adapters.SQL.Sandbox , pool_size: 10 )
18+ Application . put_env ( :sql , SQL.Repo , log: false , username: "postgres" , password: "postgres" , hostname: "localhost" , database: "sql_test#{ System . get_env ( "MIX_TEST_PARTITION" ) } " , pool_size: 10 )
1919SQL.Repo . __adapter__ ( ) . storage_up ( SQL.Repo . config ( ) )
2020SQL.Repo . start_link ( )
2121query = "temp" |> recursive_ctes ( true ) |> with_cte ( "temp" , as: ^ union_all ( select ( "temp" , [ t ] , % { n: 0 , fact: 1 } ) , ^ where ( select ( "temp" , [ t ] , [ t . n + 1 , t . n + 1 * t . fact ] ) , [ t ] , t . n < 9 ) ) ) |> select ( [ t ] , [ t . n ] )
@@ -32,13 +32,13 @@ Benchee.run(
3232 "lex" => fn _ -> SQL.Lexer . lex ( "with recursive temp (n, fact) as (select 0, 1 union all select n+1, (n+1)*fact from temp where n < 9)" ) end ,
3333 "parse" => fn _ -> SQL.Parser . parse ( tokens , context ) end ,
3434 "iodata" => fn _ -> pcontext . module . to_iodata ( ptokens , pcontext ) end ,
35- "format" => fn _ -> SQL.Format . to_iodata ( ptokens , pcontext ) end ,
35+ "format" => fn _ -> SQL.Format . to_iodata ( ptokens , pcontext , 0 , false ) end ,
3636 "lex+parse+iodata" => fn _ ->
3737 { :ok , _ , tokens } = SQL.Lexer . lex ( "with recursive temp (n, fact) as (select 0, 1 union all select n+1, (n+1)*fact from temp where n < 9)" )
3838 { :ok , pcontext , tokens } = SQL.Parser . parse ( tokens , context )
3939 pcontext . module . to_iodata ( tokens , pcontext )
4040 end ,
41- "parse/1 " => fn _ -> SQL . parse ( "with recursive temp (n, fact) as (select 0, 1 union all select n+1, (n+1)*fact from temp where n < 9)" ) end ,
41+ "parse/3 " => fn _ -> SQL . parse ( "with recursive temp (n, fact) as (select 0, 1 union all select n+1, (n+1)*fact from temp where n < 9)" ) end ,
4242 "sql" => fn _ -> SQL.Repo . sql ( ) end ,
4343 "ecto" => fn _ -> SQL.Repo . ecto ( ) end ,
4444 "runtime to_string" => fn _ -> to_string ( ~SQL[ with recursive temp (n, fact) as (select 0, 1 union all select n+1, (n+1)*fact from temp where n < 9)] ) end ,
0 commit comments