open StdLabels type t = { file : string; tab : int; name : string; } [@@deriving show, eq] (** Get the internal name for the given table. This value may differ from the association name given in the configuration. This is because the same file can be linked more than one times. We need to differenciate - the name of the table - the name of how the table is used in a context *) let name : t -> string = fun source -> let file_name = source.file |> Filename.basename |> Filename.remove_extension in match source.tab with | 1 -> file_name | _ -> String.concat ~sep:"_" [ file_name; string_of_int source.tab ] (** Represent a column in a safe way in a query *) let print_column : t -> string -> string = fun table column -> String.concat ~sep:"" [ "'"; table.name; "'.'"; column; "'" ]