mirror of
https://github.com/Mintplex-Labs/express-admin.git
synced 2026-07-21 00:45:22 -04:00
Store NULL for empty date type values
This commit is contained in:
@@ -159,11 +159,13 @@ function kvp (data, columns) {
|
||||
}
|
||||
|
||||
function escape (value, type) {
|
||||
return type.match(
|
||||
new RegExp('char|varchar|tinytext|text|mediumtext|longtext|'+
|
||||
'date|time|timestamp|datetime|year', 'i'))
|
||||
? "\'"+value+"\'"
|
||||
: value;
|
||||
if (/char|varchar|tinytext|text|mediumtext|longtext/i.test(type)) {
|
||||
return "\'"+value+"\'";
|
||||
} else if (/date|time|timestamp|datetime|year/i.test(type)) {
|
||||
return (value === '' || value === null) ? 'NULL' : "\'"+value+"\'";
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
// many-to-many helpers
|
||||
|
||||
Reference in New Issue
Block a user