session progress
This commit is contained in:
@@ -7,23 +7,23 @@
|
||||
namespace matador::sql {
|
||||
|
||||
enum class error_code : uint8_t {
|
||||
OK = 0,
|
||||
INVALID_QUERY,
|
||||
UNKNOWN_TABLE,
|
||||
UNKNOWN_COLUMN,
|
||||
BIND_FAILED,
|
||||
EXECUTE_FAILED,
|
||||
FETCH_FAILED,
|
||||
PREPARE_FAILED,
|
||||
DESCRIBE_FAILED,
|
||||
TABLE_EXISTS_FAILED,
|
||||
RETRIEVE_DATA_FAILED,
|
||||
SEQUENCE_EXISTS_FAILED,
|
||||
RESET_FAILED,
|
||||
OPEN_ERROR,
|
||||
CLOSE_ERROR,
|
||||
STATEMENT_LOCKED,
|
||||
FAILURE
|
||||
Ok = 0,
|
||||
InvalidQuery,
|
||||
UnknownTable,
|
||||
UnknownColumn,
|
||||
BindFailed,
|
||||
ExecuteFailed,
|
||||
FetchFailed,
|
||||
PrepareFailed,
|
||||
DescribeFailed,
|
||||
TableExistsFailed,
|
||||
RetrieveDataFailed,
|
||||
SequenceExistsFailed,
|
||||
ResetFailed,
|
||||
OpenError,
|
||||
CloseError,
|
||||
StatementLocked,
|
||||
Failure
|
||||
};
|
||||
|
||||
class sql_category_impl final : public std::error_category
|
||||
|
||||
@@ -21,6 +21,9 @@ public:
|
||||
static void on_base(const BaseType&) {}
|
||||
template < class Type >
|
||||
void on_primary_key(const char * /*id*/, Type &val, const utils::primary_key_attribute& attr) {
|
||||
if (attr.generator() == utils::generator_type::Identity) {
|
||||
return;
|
||||
}
|
||||
utils::data_type_traits<Type>::bind_value(*binder_, index_++, val, attr.size());
|
||||
}
|
||||
void on_revision(const char *id, uint64_t &/*rev*/);
|
||||
|
||||
@@ -38,7 +38,7 @@ struct query_context {
|
||||
std::string table_name{};
|
||||
std::vector<object::attribute> prototype{};
|
||||
std::vector<std::string> bind_vars{};
|
||||
std::vector<utils::database_type> bind_types{};
|
||||
// std::vector<utils::database_type> bind_types{};
|
||||
// Data for resolving query result
|
||||
std::shared_ptr<resolver_service> resolver{};
|
||||
std::type_index result_type = typeid(void);
|
||||
|
||||
@@ -196,7 +196,7 @@ utils::result<object::object_ptr<Type>, utils::error> statement::fetch_one() {
|
||||
});
|
||||
auto first = records.begin();
|
||||
if (first == records.end()) {
|
||||
return utils::failure(utils::error{error_code::FETCH_FAILED,"Failed to find entity."});
|
||||
return utils::failure(utils::error{error_code::FetchFailed,"Failed to find entity."});
|
||||
}
|
||||
|
||||
return utils::ok(first.optr());
|
||||
|
||||
Reference in New Issue
Block a user