mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-22 20:16:36 -04:00
Fix ' not being escaped properly when saving a DB table.
This commit is contained in:
parent
4be7974142
commit
35230bac70
@ -90,9 +90,9 @@ namespace MCGalaxy {
|
||||
sql.Write("'{0:yyyy-MM-dd HH:mm:ss.ffff}'", (DateTime)row[col]);
|
||||
} else if (type == typeof(bool)) {
|
||||
sql.Write((bool)row[col] ? "1" : "0");
|
||||
} else if (type == typeof(string)) { // Requires ''
|
||||
} else if (type == typeof(string)) {
|
||||
string value = row[col].ToString();
|
||||
if (value.IndexOf(' ') >= 0)
|
||||
if (value.IndexOf('\'') >= 0) // escape '
|
||||
value = value.Replace("'", "''");
|
||||
sql.Write("'{0}'", value);
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user