Can't found any examples or docs about types system
Example from docs:
struct my_row {
std::int64_t id;
std::optional<std::string> name;
};
BOOST_HANA_ADAPT_STRUCT(my_row, id, name);
This is enough to do select queries like this:
std::vector<my_row> res;
const auto query = "SELECT id, name FROM users_info WHERE amount>="_SQL + std::int64_t(25);
ozo::request(ozo::make_connector(io, conn_info), query, ozo::into(res),
[&](ozo::error_code ec, auto conn) {
});
1. Question 1: How to pass this struct and(or) vector of that structs as SQL param to stored procedure/function:
For example I have custom user-defined type in Postgres:
CREATE TYPE t_my_row AS
(
id INTEGER,
name TEXT,
);
And Stored Procedure:
CREATE OR REPLACE PROCEDURE test(VARIADIC data t_my_row[])
LANGUAGE plpgsql
AS
$$
BEGIN
...
END;
$$;
that take an array of records like this:
CALL test((1, 'Record A'), (2, 'Record B'));
What will the calling code look like from the ozo side?
2. Question 2: What's the difference between a type resulting from a _SQL literal
like this:
auto query = "SELECT id, name FROM users_info WHERE amount>="_SQL + std::int64_t(25);
and a type resulting from a call make_query
auto query = ozo::make_query("SELECT id, name FROM users_info WHERE amount>=$1", std::int64_t(25))
It is clear that in one case the request is constexpr, and in the other constexpr is only part without parameters, but this is completely unclear from the documentation and there is some confusion in the interface of these types, since one has text as string_view member and another has text() constexpr method from boost::hana...
Can't found any examples or docs about types system
Example from docs:
This is enough to do select queries like this:
1. Question 1: How to pass this struct and(or) vector of that structs as SQL param to stored procedure/function:
For example I have custom user-defined type in Postgres:
And Stored Procedure:
that take an array of records like this:
What will the calling code look like from the ozo side?
2. Question 2: What's the difference between a type resulting from a _SQL literal
like this:
and a type resulting from a call
make_queryIt is clear that in one case the request is constexpr, and in the other constexpr is only part without parameters, but this is completely unclear from the documentation and there is some confusion in the interface of these types, since one has
textas string_view member and another has text() constexpr method from boost::hana...