Skip to main content

Module ffi

Module ffi 

Source
Expand description

C FFI bindings for sqlglot-rust.

This module exposes a C-compatible API so the library can be consumed from C, C++, or any language that supports the C ABI.

§Memory management

Every *mut c_char returned by a function in this module must be freed by calling sqlglot_free. Failing to do so will leak memory.

Functions§

sqlglot_free
Free a string previously returned by any sqlglot_* function.
sqlglot_generate
Generate SQL from a JSON-serialised AST for the given dialect.
sqlglot_parse
Parse a SQL string and return its AST serialised as JSON.
sqlglot_transpile
Transpile a single SQL statement from one dialect to another.
sqlglot_version
Return the library version as a static null-terminated string.