-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Syntax problem on MySQL strict mode #1210
Comments
Do you have a source (changelog) for this information? I just found this:
Which wouldn't be enabled by default imo. |
|
Tanks! Also interesting from "SQL Mode Changes in MySQL 5.7":
So yes. I think you're right. We should use NULL instead of ZERO_DATE. |
I'm quite confused why We could add an update sql script that updates all ZERO_DATE data to NULL and alter the column to default to NULL (quite scary trying to patch someones live db). Then we can fix all the problems found in the code related to this issue. Although, changing it to |
Is there another way to fix this? because I am having the same issue with the topic creator. :( |
#1621 (comment) This is a closed issue, since it is a duplicate. So you should continue posting in the open one. |
* Fixes issue rathena#1210 .
So I'd like to solve this issue cause it's kinda annoying. First things first so I changed the sql files: But the login instantly crashed by using this database. - Sql_GetData(sql_handle, 10, &data, NULL); safestrncpy(acc->lastlogin, data, sizeof(acc->lastlogin));
+ Sql_GetData(sql_handle, 10, &data, NULL); safestrncpy(acc->lastlogin, (data!=NULL)?data:"", sizeof(acc->lastlogin));
Sql_GetData(sql_handle, 11, &data, NULL); safestrncpy(acc->last_ip, data, sizeof(acc->last_ip));
- Sql_GetData(sql_handle, 12, &data, NULL); safestrncpy(acc->birthdate, data, sizeof(acc->birthdate));
+ Sql_GetData(sql_handle, 12, &data, NULL); safestrncpy(acc->birthdate, (data!=NULL)?data:"", sizeof(acc->birthdate)); The login will survive after this change, but there are much more errors to deal with.
These lines are for updating the lastlogin and birthdate in the login table. It fails, since lastlogin and birthdate are zero strings now. We could use again a special cause like if date is empty then update NULL. But thats not nice, too... Maybe a Dev could offer a better solution or we should just stick with '1000-01-01 00:00:00'. |
Error:
Invalid date '0000-00-00'
Case: Newer version of MySQL/MariaDB no longer allows the use of a
ZERO_DATE
Solution: Change all default date/datetime value to the minimum allowed value which is
1000-01-01 00:00:00
or lets not kid ourselves and just useNULL
forZERO_DATE
.Affected:
Thoughts?
The text was updated successfully, but these errors were encountered: