View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0007974 | mantisbt | db mssql | public | 2007-05-16 04:57 | 2014-05-16 15:00 |
| Reporter | obouillaud | Assigned To | rombert | ||
| Priority | normal | Severity | major | Reproducibility | always |
| Status | closed | Resolution | duplicate | ||
| Platform | IIS 6.0 - PHP 4 | OS | Windows | OS Version | 2003 |
| Product Version | 1.0.7 | ||||
| Summary | 0007974: Date problem on french MSSQL | ||||
| Description | Hi I tried to install 1.0.7 (and then 1.1.0a3) but it always crashs when trying to insert the first line into "mantis_user_table" because of a date problem. I use MS SQL Server 2005 (french) The query is : The error reported in mantis is just "the instruction has been stopped" (in french) but when I manualy execute the query in MS SQL Management studio the detailed error is "the conversion of a datatype 'CHAR' into 'DATETIME' has given an out of limit date and time value" (in french). It seems that it comes from the date format, when I reverse the month and the day in the dates, it works. | ||||
| Tags | No tags attached. | ||||
| Attached Files | user_api.diff (1,097 bytes)
Index: user_api.php =================================================================== --- user_api.php (revision 4914) +++ user_api.php (working copy) @@ -440,9 +440,19 @@ ( username, email, password, date_created, last_visit, enabled, access_level, login_count, cookie_string, realname ) VALUES - ( '$c_username', '$c_email', '$c_password', " . db_now() . "," . db_now() . ", - $c_enabled, $c_access_level, 0, '$t_cookie_string', '$c_realname')"; - db_query( $query ); + ( " . db_param(0) . ", + " . db_param(1) . ", + " . db_param(2) . ", + " . db_param(3) . ", + " . db_param(4) . ", + " . db_param(5) . ", + " . db_param(6) . ", + " . db_param(7) . ", + " . db_param(8) . ", + " . db_param(9) . " + )"; + db_query_bound( $query, Array( $c_username, $c_email, $c_password, db_now(), db_now(), + $c_enabled, $c_access_level, 0, $t_cookie_string, $c_realname) ); # Create preferences for the user $t_user_id = db_insert_id( $t_user_table ); | ||||
|
It seems that the datetime format can differ from a server to another... but I see nothing in MS SQL Administrator to define a specific format for a whole database, a table or even a table field. You could tell that it is a mssql problem but it seems that it can be avoid by using the command : |
|
|
We have had the same problem in German MSSql environment. Our quick and dirty fix was to modify the database connect functions. We added in configuration files the entry "$g_db_session_init = 'SET DATEFORMAT YMD';" and expanded the database connect functions. See below: File: $Id: database_api.php,v 1.55 2007/04/22 07:45:34 vboctor Exp $ |
|
|
Reminder sent to: paulr Paul, are you able to handle this issue? |
|
|
I think that using ODBC notation {ts 'yyyy-mm-dd hh:mm:ss'} is the best solution. |
|
|
I also get this error using mysql in Mantis 1.2 but not in 1.1 The difference appears to be :- --------------------
1.1 --------------------
Changing to use the 1.1 code cures the insert into mantis_user_table (uses db_query), Nick |
|
|
I changed to using db_query_bound and it works with mysql I am attaching my patched code. |
|
|
I've checked the latest code and it seems that we already use db_query_bound() here? Is the issue still reproducible on the latest code? I've noticed that there is still once db_query() in this file in method user_get_logged_in_user_ids(). However, this is another issue. For now I will target this for 1.x.x rather than 1.2.x. |
|
|
MantisBT currently supports Mysql and has support for other database engines. The support for other databases is known to be problematic. Having implemented the current database layer into Mantis 10 years ago, I'm currently working on replacing the current layer. If you are interested in using Mantis with non-mysql databases - for example, Oracle, PGSQL or MSSQL, and would be willing to help out testing the new database layer, please drop me an email at paul@mantisforge.org In the meantime, I'd advise running Mantis with Mysql Only to avoid issues. Thanks |
|