Fix a bug when creating sqlite3 database models (#618)

This commit is contained in:
An Tao 2020-10-27 21:26:01 +08:00 committed by GitHub
parent de37a0ae29
commit dbf21f7dbc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -608,6 +608,10 @@ void create_model::createModelClassFromSqlite3(
{
info.colType_ = "std::vector<char>";
}
else if (type == "datetime" || type == "date")
{
info.colType_ = "::trantor::Date";
}
else
{
info.colType_ = "std::string";

View File

@ -461,10 +461,11 @@ static void loadDbClients(const Json::Value &dbClients)
for (auto const &client : dbClients)
{
auto type = client.get("rdbms", "postgresql").asString();
std::transform(type.begin(), type.end(), type.begin(), ::tolower);
auto host = client.get("host", "127.0.0.1").asString();
auto port = client.get("port", 5432).asUInt();
auto dbname = client.get("dbname", "").asString();
if (dbname == "")
if (dbname == "" && type != "sqlite3")
{
std::cerr << "Please configure dbname in the configuration file"
<< std::endl;