added any type visitor and converter
This commit is contained in:
@@ -153,14 +153,27 @@ sql::record sqlite_connection::describe(const std::string& table)
|
||||
options = utils::constraints::NOT_NULL;
|
||||
}
|
||||
// f.default_value(res->column(4));
|
||||
// end = nullptr;
|
||||
// f.is_primary_key(strtoul(res->column(3), &end, 10) == 0);
|
||||
prototype.append({name, type, {options}});
|
||||
}
|
||||
|
||||
return std::move(prototype);
|
||||
}
|
||||
|
||||
bool sqlite_connection::exists(const std::string &table_name)
|
||||
{
|
||||
const auto result = fetch("SELECT COUNT(*) FROM sqlite_master WHERE type='table' AND tbl_name='" + table_name + "' LIMIT 1");
|
||||
|
||||
if (!result->fetch()) {
|
||||
// Todo: throw an exception?
|
||||
return false;
|
||||
}
|
||||
|
||||
int v{};
|
||||
result->read_value(nullptr, 0, v);
|
||||
|
||||
return v == 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extern "C"
|
||||
|
||||
Reference in New Issue
Block a user