Module Pg_query
A thin wrapper around libpg_query.
type parse_error={}Represents a syntax error in parsing some SQL.
messageandcursorposare probably the most useful fields. Note thatfilename,funcnameandlinenorefer to the location in the parsing code that the error occured, not to the input SQL.
type parse_result={parse_tree : string;The parse tree of the query, as JSON
stderr_buffer : string option;A field of unknown purpose
error : parse_error option;Some parse_errorfor queries where parsing failed andNonefor successful ones}Represents the overall result of a parse
val raw_parse : string -> parse_resultParses a string containing SQL and return a
parse_resultcorresponding to the libpg_query struct
val parse : string -> (string, string) Stdlib.resultParses a string containing SQL and returns either
Ok parse_treeorError error_message
val show_parse_error : parse_error -> stringDerived function to display a parse error
val show_parse_result : parse_result -> stringDerived function to display a parse_result