summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY.h5
-rw-r--r--lib/db.c18
2 files changed, 17 insertions, 6 deletions
diff --git a/HISTORY.h b/HISTORY.h
index f9bd409..ff3188b 100644
--- a/HISTORY.h
+++ b/HISTORY.h
@@ -4,7 +4,7 @@
* -----------------------------------
*/
-#define _VERSION "1.1.153"
+#define _VERSION "1.1.154"
#define VERSION_DATE "10.02.2020"
#define DB_API 7
@@ -18,6 +18,9 @@
* ------------------------------------
*
+2020-02-10: version 1.1.154 (horchi)
+ - change: Tray to fix mysterious sql result (mariaDb)
+
2020-02-10: version 1.1.153 (horchi)
- added: More debug messages
diff --git a/lib/db.c b/lib/db.c
index c5ae11b..1d31b97 100644
--- a/lib/db.c
+++ b/lib/db.c
@@ -873,7 +873,7 @@ struct FieldInfo
{
std::string columnFormat;
std::string description;
- std::string def;
+ std::string defaulValue;
};
int cDbTable::validateStructure(int allowAlter)
@@ -924,7 +924,15 @@ int cDbTable::validateStructure(int allowAlter)
{
fields[row[0]].columnFormat = row[1];
fields[row[0]].description = row[2] ? row[2] : "";
- fields[row[0]].def = row[6] ? strcasecmp(row[6], "NULL") == 0 ? "" : row[6] : "";
+ fields[row[0]].defaulValue = row[6] ? strcasecmp(row[6], "NULL") == 0 ? "" : row[6] : "";
+
+ if (fields[row[0]].defaulValue.length() > 2 &&
+ fields[row[0]].defaulValue.back() == '\'' &&
+ fields[row[0]].defaulValue.front() == '\'')
+ {
+ fields[row[0]].defaulValue.pop_back();
+ fields[row[0]].defaulValue.erase(0, 1);
+ }
}
mysql_free_result(result);
@@ -950,7 +958,7 @@ int cDbTable::validateStructure(int allowAlter)
if (strcasecmp(fieldInfo->columnFormat.c_str(), colType) != 0 ||
strcasecmp(fieldInfo->description.c_str(), getField(i)->getDescription()) != 0 ||
- (strcasecmp(fieldInfo->def.c_str(), getField(i)->getDefault()) != 0 && !(getField(i)->getType() & ftPrimary)))
+ (strcasecmp(fieldInfo->defaulValue.c_str(), getField(i)->getDefault()) != 0 && !(getField(i)->getType() & ftPrimary)))
{
if (strcasecmp(fieldInfo->columnFormat.c_str(), colType) != 0)
tell(5, "Debug: Format of '%s' changed from '%s' to '%s'", getField(i)->getDbName(),
@@ -960,9 +968,9 @@ int cDbTable::validateStructure(int allowAlter)
tell(5, "Debug: Description of '%s' changed from '%s' to '%s'", getField(i)->getDbName(),
fieldInfo->description.c_str(), getField(i)->getDescription());
- if (strcasecmp(fieldInfo->def.c_str(), getField(i)->getDefault()) != 0 && !(getField(i)->getType() & ftPrimary))
+ if (strcasecmp(fieldInfo->defaulValue.c_str(), getField(i)->getDefault()) != 0 && !(getField(i)->getType() & ftPrimary))
tell(5, "Debug: Default value of '%s' changed from from '%s' to '%s'", getField(i)->getDbName(),
- fieldInfo->def.c_str(), getField(i)->getDefault());
+ fieldInfo->defaulValue.c_str(), getField(i)->getDefault());
alterModifyField(getField(i));
}