Browse Source

fixed empty host

develop
Robin Thoni 9 years ago
parent
commit
e7c82b333b
1 changed files with 2 additions and 1 deletions
  1. 2
    1
      src/DBO/Actions/ActionAddHost.cpp

+ 2
- 1
src/DBO/Actions/ActionAddHost.cpp View File

@@ -27,8 +27,9 @@ ActionAddHost::ActionAddHost()
27 27
 
28 28
 const std::string ActionAddHost::getSql() const
29 29
 {
30
+    auto host = _host.empty() ? _domain : _host + "." + _domain;
30 31
     auto query = "INSERT INTO records (domain_id, name, type, content, ttl, prio, change_date)\n"
31
-            "    VALUES(@domain_id, \"" + _host + "." + _domain + "\", \"" + _recordType + "\","
32
+            "    VALUES(@domain_id, \"" + host + "\", \"" + _recordType + "\","
32 33
             " \"" + _recordValue + "\", 84600, 0, " + std::to_string(time(nullptr)) + ");\n";
33 34
 
34 35
     if (_reverseEnabled && _recordType == "A")

Loading…
Cancel
Save