added more tests
This commit is contained in:
@@ -85,7 +85,7 @@ utils::result<std::unique_ptr<sql::query_result_impl>, utils::error> postgres_co
|
||||
return utils::failure(make_error(sql::error_code::FETCH_FAILED, res, conn_, "Failed to fetch", context.sql));
|
||||
}
|
||||
|
||||
// std::vector<sql::column_definition> prototype;
|
||||
// std::vector<object::column_definition> prototype;
|
||||
// const auto num_col = PQnfields(res);
|
||||
// for (int i = 0; i < num_col; ++i) {
|
||||
// const char *col_name = PQfname(res, i);
|
||||
@@ -170,7 +170,7 @@ utils::basic_type string2type(const char *type) {
|
||||
}
|
||||
}
|
||||
|
||||
utils::result<std::vector<sql::column_definition>, utils::error> postgres_connection::describe(const std::string &table) {
|
||||
utils::result<std::vector<object::attribute_definition>, utils::error> postgres_connection::describe(const std::string &table) {
|
||||
const std::string stmt(
|
||||
"SELECT ordinal_position, column_name, udt_name, data_type, is_nullable, column_default FROM information_schema.columns WHERE table_schema='public' AND table_name='"
|
||||
+ table + "'");
|
||||
@@ -182,7 +182,7 @@ utils::result<std::vector<sql::column_definition>, utils::error> postgres_connec
|
||||
}
|
||||
|
||||
postgres_result_reader reader(res);
|
||||
std::vector<sql::column_definition> prototype;
|
||||
std::vector<object::attribute_definition> prototype;
|
||||
while (auto fetched = reader.fetch()) {
|
||||
if (!fetched.is_ok()) {
|
||||
return utils::failure(fetched.release_error());
|
||||
|
||||
Reference in New Issue
Block a user