New features:
Caqti_query.E case was added to support the two above cases. This is a breaking change, but hopefully does not break existing code. The exception (not counting module type of) would be if the constructors are aliased along with an alias of the type. On the other hand, pattern matching should be compatible since the new constructor is only emitted by newly introduced functions.Caqti_request.Infix providing a new high-level API for constructing requests. It uses two-stage combinators, first to apply type arguments then to apply the query string. Apart from allowing nicer looking code, this solves the problem of switching to a the query string parser while maintaining backwards compatibility.set_statement_timeout to connection modules, used to set query timeout. It is only supported for PostgreSQL and MariaDB. (#74)with_transaction function to connection modules. This is just fail-safed wrapper around start, commit, and rollback.Fixes:
Other changes:
timestamp. This issue was exposed by the specification of field types introduced in version 1.4.0. Earlier versions worked as expected, if only accidentally, since the time zone is ignored when a string is converted to a timestamp. While this change makes timestamp more usable again for storing UTC time stamps, I strongly recommend using timestamp with time zone since it's interpretation is unambiguous. The API reference is now updated with details about how the ptime OCaml type is mapped for different database systems.string as SQL text for PostgreSQL. This is due to issues with implicit conversions and function overloading when the desired type on the SQL side is char, varchar, or jsonb.Caqti_type.redact to protect sensitive information from being logged.$CAQTI_DEBUG_PARAM is set to "true".find_opt implementation for sqlite3.Pool.use.Caqti_connect_sig.S.with_connection (GPR#61 Anton Bachin).?post_connect callback to connect_pool.affected_count for sqlite backend (GPR#46 jakob).exec_with_affected_count to Caqti_connection_sig.S (GPR#45 jakob).?max_idle_size to pool creation functions.ppx_deriving due to issue with static compilation (GPR#50 Ulrik Strid).$<var>$ in query strings and deprecate $$.postgres is specified as the URL scheme (GPR#25 James Owen).'a future declarations.$. to $<var>. in queries.$(<var>.) from $(<var>) if not provided.Caqti_type.Std : Caqti_type_sig.Std, containing type descriptors needed for building requests, for easy inclusion in custom modules.Caqti_type.Field.ex and renamed Caqti_type.ex to Caqti_type.any and related functions.Caqti_system_sig into Caqti_driver and split up the signature to make room for future drivers on alternative platforms.Added and improved:
octets type to BLOBs for MariaDB and Sqlite3.Removed:
Ecosystem:
ppx_optcomp v0.11.0 by dropping it, since the conditionals where no longer needed.[@@@deprecated] and will be removed in the next major release.-linkall flags to driver libraries to fix direct linking (#9).collect_list and rev_collect_list (#8).template to query and related function, leaving deprecated aliases.ptime_span field type mapping to SQL intervals.io type constructor to future.start transaction for PostgreSQL v2.caqti.opam in distribution.The main difference of the new API compared to the old is:
call method which gives access to a result object before iterating over the returned rows.result type, using a collection of error types formed as polymorphic variants of records.Notice: This version is mostly backwards compatible. New code should use v2, but v1 will be kept for now. To keep using the v1 in upcoming releases:
caqti-dynload to keep using dynamic loading, or link with the needed caqti-driver-*.v1 driver libraries.caqti.v1 instead of caqti.caqti-lwt.v1 instead of caqti-lwt.caqti-async.v1 instead of caqti-async.date and utc conversions to date_cl and utc_cl.Caqti_metadata in favour of the new Caqti_driver_info.Tuple.length.Param.sub_types.Param.other and Tuple.other.-linkall. This hopefully solves loading issues.Caqti (now deprecated) into Caqti_errors and Caqti_connect.META.META.