Repodb.Driver
repodb · API reference
module Value : sig ... endLow-level database driver interface shared by all Repodb backends.
type row = {
columns : string array;
values : Value.t array;
}val row_get : row -> string -> Value.t optionval row_get_exn : row -> string -> Value.tval row_get_idx : row -> int -> Value.tval row_column_count : row -> intval row_column_name : row -> int -> stringval row_text : row -> int -> stringval row_text_opt : row -> int -> string optionval row_int : row -> int -> intval row_int_opt : row -> int -> int optionval row_int64 : row -> int -> int64val row_int64_opt : row -> int -> int64 optionval row_float : row -> int -> floatval row_float_opt : row -> int -> float optionval row_bool : row -> int -> boolval row_bool_opt : row -> int -> bool optionval row_is_null : row -> int -> boolmodule ColumnIndex : sig ... endtype dialect =
| PostgreSQL
| SQLite
| MySQL
| Other of stringval dialect_to_string : dialect -> stringtype command_result = {
affected_rows : int64;
generated_id : int64 option;
}Result of a statement that modifies rows.
affected_rows is the number of rows the statement actually changed, which is what a compare-and-set update needs in order to know whether it applied. generated_id carries the auto-generated primary key of an INSERT when the backend can report one, as a full-width int64.
val no_command_result : command_resulttype ddl_capabilities = {
create_table_if_not_exists : bool;
drop_table_if_exists : bool;
create_index_if_not_exists : bool;
drop_index_if_exists : bool;
add_column_if_not_exists : bool;
drop_column_if_exists : bool;
}Which IF [NOT] EXISTS guards a backend actually accepts.
Repodb never emits one of these guards unless the backend is known to support it: MySQL, for instance, accepts CREATE TABLE IF NOT EXISTS but rejects CREATE INDEX IF NOT EXISTS, which MariaDB accepts. Drivers that can identify their server precisely may pass a more permissive record to the DDL renderers; see Repodb_mariadb.detect_ddl_capabilities.
val no_ddl_capabilities : ddl_capabilitiesval all_ddl_capabilities : ddl_capabilitiesval mysql_ddl_capabilities : ddl_capabilitiesval mariadb_ddl_capabilities : ddl_capabilitiesval default_ddl_capabilities : dialect -> ddl_capabilitiesmodule type S = sig ... endtype driver = (module S)