View Issue Details

IDProjectCategoryView StatusLast Update
0010742mantisbtdb mssqlpublic2015-03-15 19:58
Reporterischilling Assigned Todregad  
PriorityimmediateSeverityblockReproducibilityalways
Status closedResolutionfixed 
Product Version1.2.0rc1 
Target Version1.3.0-beta.2Fixed in Version1.3.0-beta.2 
Summary0010742: Database query failed. Error received from database was 0000206: Operand type clash: int is incompatible with text for the query
Description

Database query failed. Error received from database was 0000206: Operand type clash: int is incompatible with text for the query: INSERT INTO mantis_config_table
( value, type, access_reqd, config_id, project_id, user_id )
VALUES
(?, ?, ?, ?, ?,? ).

Steps To Reproduce

Simply create a DB under SQL 2008 SP1

Additional Information

Printing the SQL instead of having it created and than running it in SQL Server manager results in the following errors:

Msg 156, Level 15, State 1, Line 425
Incorrect syntax near the keyword 'DEFAULT'.
Msg 102, Level 15, State 1, Line 447
Incorrect syntax near 'category_migrate'.
Msg 102, Level 15, State 1, Line 457
Incorrect syntax near 'SYSTEM'.
Msg 132, Level 15, State 1, Line 457
The label 'WARNING' has already been declared. Label names must be unique within a query batch or stored procedure.
Msg 102, Level 15, State 1, Line 504
Incorrect syntax near 'date_migrate'.
Msg 132, Level 15, State 1, Line 506
The label 'WARNING' has already been declared. Label names must be unique within a query batch or stored procedure.
Msg 102, Level 15, State 1, Line 523
Incorrect syntax near 'SYSTEM'.
Msg 132, Level 15, State 1, Line 523
The label 'WARNING' has already been declared. Label names must be unique within a query batch or stored procedure.
Msg 102, Level 15, State 1, Line 529
Incorrect syntax near 'date_migrate'.
Msg 132, Level 15, State 1, Line 531
The label 'WARNING' has already been declared. Label names must be unique within a query batch or stored procedure.
Msg 102, Level 15, State 1, Line 548
Incorrect syntax near 'date_migrate'.
Msg 132, Level 15, State 1, Line 550
The label 'WARNING' has already been declared. Label names must be unique within a query batch or stored procedure.
Msg 102, Level 15, State 1, Line 560
Incorrect syntax near 'date_migrate'.
Msg 132, Level 15, State 1, Line 562
The label 'WARNING' has already been declared. Label names must be unique within a query batch or stored procedure.
Msg 102, Level 15, State 1, Line 572
Incorrect syntax near 'date_migrate'.
Msg 132, Level 15, State 1, Line 574
The label 'WARNING' has already been declared. Label names must be unique within a query batch or stored procedure.
Msg 102, Level 15, State 1, Line 587
Incorrect syntax near 'date_migrate'.
Msg 132, Level 15, State 1, Line 589
The label 'WARNING' has already been declared. Label names must be unique within a query batch or stored procedure.
Msg 102, Level 15, State 1, Line 604
Incorrect syntax near 'date_migrate'.
Msg 132, Level 15, State 1, Line 606
The label 'WARNING' has already been declared. Label names must be unique within a query batch or stored procedure.
Msg 102, Level 15, State 1, Line 619
Incorrect syntax near 'date_migrate'.
Msg 132, Level 15, State 1, Line 621
The label 'WARNING' has already been declared. Label names must be unique within a query batch or stored procedure.
Msg 102, Level 15, State 1, Line 636
Incorrect syntax near 'date_migrate'.
Msg 132, Level 15, State 1, Line 638
The label 'WARNING' has already been declared. Label names must be unique within a query batch or stored procedure.
Msg 102, Level 15, State 1, Line 651
Incorrect syntax near 'date_migrate'.
Msg 132, Level 15, State 1, Line 653
The label 'WARNING' has already been declared. Label names must be unique within a query batch or stored procedure.
Msg 102, Level 15, State 1, Line 671
Incorrect syntax near 'date_migrate'.
Msg 132, Level 15, State 1, Line 673
The label 'WARNING' has already been declared. Label names must be unique within a query batch or stored procedure.
Msg 102, Level 15, State 1, Line 685
Incorrect syntax near 'SYSTEM'.
Msg 132, Level 15, State 1, Line 685
The label 'WARNING' has already been declared. Label names must be unique within a query batch or stored procedure.
Msg 102, Level 15, State 1, Line 688
Incorrect syntax near 'date_migrate'.
Msg 132, Level 15, State 1, Line 690
The label 'WARNING' has already been declared. Label names must be unique within a query batch or stored procedure.
Msg 102, Level 15, State 1, Line 705
Incorrect syntax near 'date_migrate'.
Msg 132, Level 15, State 1, Line 707
The label 'WARNING' has already been declared. Label names must be unique within a query batch or stored procedure.
Msg 102, Level 15, State 1, Line 720
Incorrect syntax near 'date_migrate'.
Msg 132, Level 15, State 1, Line 722
The label 'WARNING' has already been declared. Label names must be unique within a query batch or stored procedure.

TagsNo tags attached.
Attached Files
error1.png (55,755 bytes)   
error1.png (55,755 bytes)   
error2.png (66,387 bytes)   
error2.png (66,387 bytes)   
schema_NEW.php (28,727 bytes)   
<?php
# MantisBT - a php based bugtracking system

# MantisBT is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# MantisBT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with MantisBT.  If not, see <http://www.gnu.org/licenses/>.

# Each entry below defines the schema. The upgrade array consists of
#  two elements
# The first is the function to generate SQL statements (see adodb schema doc for more details)
#  e.g., CreateTableSQL, DropTableSQL, ChangeTableSQL, RenameTableSQL, RenameColumnSQL,
#  DropTableSQL, ChangeTableSQL, RenameTableSQL, RenameColumnSQL, AlterColumnSQL, DropColumnSQL
#  A local function "InsertData" has been provided to add data to the db
# The second parameter is an array of the parameters to be passed to the function.

# An update identifier is inferred from the ordering of this table. ONLY ADD NEW CHANGES TO THE
#  END OF THE TABLE!!!

if ( !function_exists( 'db_null_date' ) ) {
	function db_null_date() {
		return 0;
	}
}


function installer_db_now() {
        global $g_db;
 
       return $g_db->BindTimeStamp( time() );
}

$upgrade[] = Array('CreateTableSQL',Array(db_get_table( 'mantis_config_table' ),"
			  config_id C(64) NOTNULL PRIMARY,
			  project_id I DEFAULT '0' PRIMARY,
			  user_id I DEFAULT '0' PRIMARY,
			  access_reqd I DEFAULT '0',
			  type I DEFAULT '90',
			  value XL NOTNULL",
Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS')));
$upgrade[] = Array('CreateIndexSQL',Array('idx_config',db_get_table( 'mantis_config_table' ),'config_id'));
$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_bug_file_table'),"
  id			 I  UNSIGNED NOTNULL PRIMARY AUTOINCREMENT,
  bug_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  title 		C(250) NOTNULL DEFAULT \" '' \",
  description 		C(250) NOTNULL DEFAULT \" '' \",
  diskfile 		C(250) NOTNULL DEFAULT \" '' \",
  filename 		C(250) NOTNULL DEFAULT \" '' \",
  folder 		C(250) NOTNULL DEFAULT \" '' \",
  filesize 		 I NOTNULL DEFAULT '0',
  file_type 		C(250) NOTNULL DEFAULT \" '' \",
  date_added 		I  UNSIGNED     NOTNULL DEFAULT '1',
  content 		B NOTNULL
  ",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS')));
$upgrade[] = Array('CreateIndexSQL',Array('idx_bug_file_bug_id',db_get_table('mantis_bug_file_table'),'bug_id'));
$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_bug_history_table'),"
  id 			 I  UNSIGNED NOTNULL PRIMARY AUTOINCREMENT,
  user_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  bug_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  date_modified 	I  UNSIGNED     NOTNULL DEFAULT '1',
  field_name 		C(32) NOTNULL DEFAULT \" '' \",
  old_value 		C(128) NOTNULL DEFAULT \" '' \",
  new_value 		C(128) NOTNULL DEFAULT \" '' \",
  type 			I2 NOTNULL DEFAULT '0'
  ",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS')));
$upgrade[] = Array('CreateIndexSQL',Array('idx_bug_history_bug_id',db_get_table('mantis_bug_history_table'),'bug_id'));
$upgrade[] = Array('CreateIndexSQL',Array('idx_history_user_id',db_get_table('mantis_bug_history_table'),'user_id'));
$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_bug_monitor_table'),"
  user_id 		 I  UNSIGNED NOTNULL PRIMARY DEFAULT '0',
  bug_id 		 I  UNSIGNED NOTNULL PRIMARY DEFAULT '0'
",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS')));
$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_bug_relationship_table'),"
  id 			 I  UNSIGNED NOTNULL AUTOINCREMENT PRIMARY,
  source_bug_id		 I  UNSIGNED NOTNULL DEFAULT '0',
  destination_bug_id 	 I  UNSIGNED NOTNULL DEFAULT '0',
  relationship_type 	I2 NOTNULL DEFAULT '0'
",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS')));
$upgrade[] = Array('CreateIndexSQL',Array('idx_relationship_source',db_get_table('mantis_bug_relationship_table'),'source_bug_id'));
/* 10 */
$upgrade[] = Array('CreateIndexSQL',Array('idx_relationship_destination',db_get_table('mantis_bug_relationship_table'),'destination_bug_id'));
$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_bug_table'),"
  id 			 I  UNSIGNED PRIMARY NOTNULL AUTOINCREMENT,
  project_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  reporter_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  handler_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  duplicate_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  priority 		I2 NOTNULL DEFAULT '30',
  severity 		I2 NOTNULL DEFAULT '50',
  reproducibility 	I2 NOTNULL DEFAULT '10',
  status 		I2 NOTNULL DEFAULT '10',
  resolution 		I2 NOTNULL DEFAULT '10',
  projection 		I2 NOTNULL DEFAULT '10',
  category 		C(64) NOTNULL DEFAULT \" '' \",
  date_submitted 	I  UNSIGNED     NOTNULL DEFAULT '1',
  last_updated 		I  UNSIGNED     NOTNULL DEFAULT '1',
  eta 			I2 NOTNULL DEFAULT '10',
  bug_text_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  os 			C(32) NOTNULL DEFAULT \" '' \",
  os_build 		C(32) NOTNULL DEFAULT \" '' \",
  platform 		C(32) NOTNULL DEFAULT \" '' \",
  version 		C(64) NOTNULL DEFAULT \" '' \",
  fixed_in_version 	C(64) NOTNULL DEFAULT \" '' \",
  build 		C(32) NOTNULL DEFAULT \" '' \",
  profile_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  view_state 		I2 NOTNULL DEFAULT '10',
  summary 		C(128) NOTNULL DEFAULT \" '' \",
  sponsorship_total 	 I  NOTNULL DEFAULT '0',
  sticky		L  NOTNULL DEFAULT  \"'0'\"
",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS')));
$upgrade[] = Array('CreateIndexSQL',Array('idx_bug_sponsorship_total',db_get_table('mantis_bug_table'),'sponsorship_total'));
$upgrade[] = Array('CreateIndexSQL',Array('idx_bug_fixed_in_version',db_get_table('mantis_bug_table'),'fixed_in_version'));
$upgrade[] = Array('CreateIndexSQL',Array('idx_bug_status',db_get_table('mantis_bug_table'),'status'));
$upgrade[] = Array('CreateIndexSQL',Array('idx_project',db_get_table('mantis_bug_table'),'project_id'));
$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_bug_text_table'),"
  id 			 I  PRIMARY UNSIGNED NOTNULL AUTOINCREMENT,
  description 		XL NOTNULL,
  steps_to_reproduce 	XL NOTNULL,
  additional_information XL NOTNULL
",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS')));
$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_bugnote_table'),"
  id 			 I  UNSIGNED PRIMARY NOTNULL AUTOINCREMENT,
  bug_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  reporter_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  bugnote_text_id 	 I  UNSIGNED NOTNULL DEFAULT '0',
  view_state 		I2 NOTNULL DEFAULT '10',
  date_submitted 	I  UNSIGNED     NOTNULL DEFAULT '1',
  last_modified 	I  UNSIGNED     NOTNULL DEFAULT '1',
  note_type 		 I  DEFAULT '0',
  note_attr 		C(250) DEFAULT \" '' \"
",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS')));
$upgrade[] = Array('CreateIndexSQL',Array('idx_bug',db_get_table('mantis_bugnote_table'),'bug_id'));
$upgrade[] = Array('CreateIndexSQL',Array('idx_last_mod',db_get_table('mantis_bugnote_table'),'last_modified'));
/* 20 */
$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_bugnote_text_table'),"
  id 			 I  UNSIGNED NOTNULL PRIMARY AUTOINCREMENT,
  note 			XL NOTNULL
",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS')));
$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_custom_field_project_table'),"
  field_id 		 I  NOTNULL PRIMARY DEFAULT '0',
  project_id 		 I  UNSIGNED PRIMARY NOTNULL DEFAULT '0',
  sequence 		I2 NOTNULL DEFAULT '0'
",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS')));
$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_custom_field_string_table'),"
  field_id 		 I  NOTNULL PRIMARY DEFAULT '0',
  bug_id 		 I  NOTNULL PRIMARY DEFAULT '0',
  value 		C(255) NOTNULL DEFAULT \" '' \"
",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS')));
$upgrade[] = Array('CreateIndexSQL',Array('idx_custom_field_bug',db_get_table('mantis_custom_field_string_table'),'bug_id'));
$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_custom_field_table'),"
  id 			 I  NOTNULL PRIMARY AUTOINCREMENT,
  name 			C(64) NOTNULL DEFAULT \" '' \",
  type 			I2 NOTNULL DEFAULT '0',
  possible_values 	C(255) NOTNULL DEFAULT \" '' \",
  default_value 	C(255) NOTNULL DEFAULT \" '' \",
  valid_regexp 		C(255) NOTNULL DEFAULT \" '' \",
  access_level_r 	I2 NOTNULL DEFAULT '0',
  access_level_rw 	I2 NOTNULL DEFAULT '0',
  length_min 		 I  NOTNULL DEFAULT '0',
  length_max 		 I  NOTNULL DEFAULT '0',
  require_report 	L NOTNULL DEFAULT \" '0' \",
  require_update 	L NOTNULL DEFAULT \" '0' \",
  display_report 	L NOTNULL DEFAULT \" '0' \",
  display_update 	L NOTNULL DEFAULT \" '1' \",
  require_resolved 	L NOTNULL DEFAULT \" '0' \",
  display_resolved 	L NOTNULL DEFAULT \" '0' \",
  display_closed 	L NOTNULL DEFAULT \" '0' \",
  require_closed 	L NOTNULL DEFAULT \" '0' \"
",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS')));
$upgrade[] = Array('CreateIndexSQL',Array('idx_custom_field_name',db_get_table('mantis_custom_field_table'),'name'));
$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_filters_table'),"
  id 			 I  UNSIGNED NOTNULL PRIMARY AUTOINCREMENT,
  user_id 		 I  NOTNULL DEFAULT '0',
  project_id 		 I  NOTNULL DEFAULT '0',
  is_public 		L DEFAULT NULL,
  name 			C(64) NOTNULL DEFAULT \" '' \",
  filter_string 	XL NOTNULL
",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS')));
$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_news_table'),"
  id 			 I  UNSIGNED PRIMARY NOTNULL AUTOINCREMENT,
  project_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  poster_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  date_posted 		I  UNSIGNED     NOTNULL DEFAULT '1',
  last_modified 	I  UNSIGNED     NOTNULL DEFAULT '1',
  view_state 		I2 NOTNULL DEFAULT '10',
  announcement 		L NOTNULL DEFAULT \" '0' \",
  headline 		C(64) NOTNULL DEFAULT \" '' \",
  body 			XL NOTNULL
",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS')));
$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_project_category_table'),"
  project_id 		 I  UNSIGNED NOTNULL PRIMARY DEFAULT '0',
  category 		C(64) NOTNULL PRIMARY DEFAULT \" '' \",
  user_id 		 I  UNSIGNED NOTNULL DEFAULT '0'
",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS')));
$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_project_file_table'),"
  id 			 I  UNSIGNED NOTNULL PRIMARY AUTOINCREMENT,
  project_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  title 		C(250) NOTNULL DEFAULT \" '' \",
  description 		C(250) NOTNULL DEFAULT \" '' \",
  diskfile 		C(250) NOTNULL DEFAULT \" '' \",
  filename 		C(250) NOTNULL DEFAULT \" '' \",
  folder 		C(250) NOTNULL DEFAULT \" '' \",
  filesize 		 I NOTNULL DEFAULT '0',
  file_type 		C(250) NOTNULL DEFAULT \" '' \",
  date_added 		I  UNSIGNED     NOTNULL DEFAULT '1',
  content 		B NOTNULL
",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS')));
/* 30 */
$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_project_hierarchy_table'),"
			  child_id I UNSIGNED NOTNULL,
			  parent_id I UNSIGNED NOTNULL",
Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS')));
$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_project_table'),"
  id 			 I  UNSIGNED PRIMARY NOTNULL AUTOINCREMENT,
  name 			C(128) NOTNULL DEFAULT \" '' \",
  status 		I2 NOTNULL DEFAULT '10',
  enabled 		L NOTNULL DEFAULT \" '1' \",
  view_state 		I2 NOTNULL DEFAULT '10',
  access_min 		I2 NOTNULL DEFAULT '10',
  file_path 		C(250) NOTNULL DEFAULT \" '' \",
  description 		XL NOTNULL
",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS')));
$upgrade[] = Array('CreateIndexSQL',Array('idx_project_id',db_get_table('mantis_project_table'),'id'));
$upgrade[] = Array('CreateIndexSQL',Array('idx_project_name',db_get_table('mantis_project_table'),'name',Array('UNIQUE')));
$upgrade[] = Array('CreateIndexSQL',Array('idx_project_view',db_get_table('mantis_project_table'),'view_state'));
$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_project_user_list_table'),"
  project_id 		 I  UNSIGNED PRIMARY NOTNULL DEFAULT '0',
  user_id 		 I  UNSIGNED PRIMARY NOTNULL DEFAULT '0',
  access_level 		I2 NOTNULL DEFAULT '10'
",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS')));
$upgrade[] = Array( 'CreateIndexSQL',Array('idx_project_user',db_get_table('mantis_project_user_list_table'),'user_id'));
$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_project_version_table'),"
  id 			 I  NOTNULL PRIMARY AUTOINCREMENT,
  project_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  version 		C(64) NOTNULL DEFAULT \" '' \",
  date_order 		I  UNSIGNED     NOTNULL DEFAULT '1',
  description 		XL NOTNULL,
  released 		L NOTNULL DEFAULT \" '1' \"
",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS')));
$upgrade[] = Array('CreateIndexSQL',Array('idx_project_version',db_get_table('mantis_project_version_table'),'project_id,version',Array('UNIQUE')));
$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_sponsorship_table'),"
  id 			 I  NOTNULL PRIMARY AUTOINCREMENT,
  bug_id 		 I  NOTNULL DEFAULT '0',
  user_id 		 I  NOTNULL DEFAULT '0',
  amount 		 I  NOTNULL DEFAULT '0',
  logo 			C(128) NOTNULL DEFAULT \" '' \",
  url 			C(128) NOTNULL DEFAULT \" '' \",
  paid 			L NOTNULL DEFAULT \" '0' \",
  date_submitted 	I  UNSIGNED     NOTNULL DEFAULT '1',
  last_updated 		I  UNSIGNED     NOTNULL DEFAULT '1'
",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS')));
/* 40 */
$upgrade[] = Array('CreateIndexSQL',Array('idx_sponsorship_bug_id',db_get_table('mantis_sponsorship_table'),'bug_id'));
$upgrade[] = Array('CreateIndexSQL',Array('idx_sponsorship_user_id',db_get_table('mantis_sponsorship_table'),'user_id'));
$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_tokens_table'),"
			  id I NOTNULL PRIMARY AUTOINCREMENT,
			  owner I NOTNULL,
			  type I NOTNULL,
			  timestamp I  UNSIGNED     NOTNULL DEFAULT '1',
			  expiry I  UNSIGNED     NOTNULL DEFAULT '1',
			  value XL NOTNULL",
Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS')));
$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_user_pref_table'),"
  id 			 I  UNSIGNED NOTNULL PRIMARY AUTOINCREMENT,
  user_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  project_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  default_profile 	 I  UNSIGNED NOTNULL DEFAULT '0',
  default_project 	 I  UNSIGNED NOTNULL DEFAULT '0',
  refresh_delay 	 I  NOTNULL DEFAULT '0',
  redirect_delay 	L NOTNULL DEFAULT \" '0' \",
  bugnote_order 	C(4) NOTNULL DEFAULT 'ASC',
  email_on_new 		L NOTNULL DEFAULT \" '0' \",
  email_on_assigned 	L NOTNULL DEFAULT \" '0' \",
  email_on_feedback 	L NOTNULL DEFAULT \" '0' \",
  email_on_resolved	L NOTNULL DEFAULT \" '0' \",
  email_on_closed 	L NOTNULL DEFAULT \" '0' \",
  email_on_reopened 	L NOTNULL DEFAULT \" '0' \",
  email_on_bugnote 	L NOTNULL DEFAULT \" '0' \",
  email_on_status 	L NOTNULL DEFAULT \" '0' \",
  email_on_priority 	L NOTNULL DEFAULT \" '0' \",
  email_on_priority_min_severity 	I2 NOTNULL DEFAULT '10',
  email_on_status_min_severity 	I2 NOTNULL DEFAULT '10',
  email_on_bugnote_min_severity 	I2 NOTNULL DEFAULT '10',
  email_on_reopened_min_severity 	I2 NOTNULL DEFAULT '10',
  email_on_closed_min_severity 	I2 NOTNULL DEFAULT '10',
  email_on_resolved_min_severity 	I2 NOTNULL DEFAULT '10',
  email_on_feedback_min_severity	I2 NOTNULL DEFAULT '10',
  email_on_assigned_min_severity 	I2 NOTNULL DEFAULT '10',
  email_on_new_min_severity 	I2 NOTNULL DEFAULT '10',
  email_bugnote_limit 	I2 NOTNULL DEFAULT '0',
  language 		C(32) NOTNULL DEFAULT 'english'
",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS')));
$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_user_print_pref_table'),"
  user_id 		 I  UNSIGNED NOTNULL PRIMARY DEFAULT '0',
  print_pref 		C(27) NOTNULL DEFAULT \" '' \"
",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS')));
$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_user_profile_table'),"
  id 			 I  UNSIGNED NOTNULL PRIMARY AUTOINCREMENT,
  user_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  platform 		C(32) NOTNULL DEFAULT \" '' \",
  os 			C(32) NOTNULL DEFAULT \" '' \",
  os_build 		C(32) NOTNULL DEFAULT \" '' \",
  description 		XL NOTNULL
",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS')));
$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_user_table'),"
  id 			 I  UNSIGNED NOTNULL PRIMARY AUTOINCREMENT,
  username 		C(32) NOTNULL DEFAULT \" '' \",
  realname 		C(64) NOTNULL DEFAULT \" '' \",
  email 		C(64) NOTNULL DEFAULT \" '' \",
  password 		C(32) NOTNULL DEFAULT \" '' \",
  date_created 		I  UNSIGNED     NOTNULL DEFAULT '1',
  last_visit 		I  UNSIGNED     NOTNULL DEFAULT '1',
  enabled		L NOTNULL DEFAULT \" '1' \",
  protected 		L NOTNULL DEFAULT \" '0' \",
  access_level 		I2 NOTNULL DEFAULT '10',
  login_count 		 I  NOTNULL DEFAULT '0',
  lost_password_request_count 	I2 NOTNULL DEFAULT '0',
  failed_login_count 	I2 NOTNULL DEFAULT '0',
  cookie_string 	C(64) NOTNULL DEFAULT \" '' \"
",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS')));
$upgrade[] = Array('CreateIndexSQL',Array('idx_user_cookie_string',db_get_table('mantis_user_table'),'cookie_string',Array('UNIQUE')));
$upgrade[] = Array('CreateIndexSQL',Array('idx_user_username',db_get_table('mantis_user_table'),'username',Array('UNIQUE')));
$upgrade[] = Array('CreateIndexSQL',Array('idx_enable',db_get_table('mantis_user_table'),'enabled'));
/* 50 */
$upgrade[] = Array('CreateIndexSQL',Array('idx_access',db_get_table('mantis_user_table'),'access_level'));
$upgrade[] = Array('InsertData', Array( db_get_table('mantis_user_table'),
    "(username, realname, email, password, date_created, last_visit, enabled, protected, access_level, login_count, lost_password_request_count, failed_login_count, cookie_string) VALUES
        ('administrator', '', 'root@localhost', '63a9f0ea7bb98050796b649e85481845', '1', '1', '1', '0', 90, 3, 0, 0, '" .
             md5( mt_rand( 0, mt_getrandmax() ) + mt_rand( 0, mt_getrandmax() ) ) . md5( time() ) . "')" ) );
$upgrade[] = Array('AlterColumnSQL', Array( db_get_table( 'mantis_bug_history_table' ), "old_value C(255) NOTNULL" ) );
$upgrade[] = Array('AlterColumnSQL', Array( db_get_table( 'mantis_bug_history_table' ), "new_value C(255) NOTNULL" ) );

$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_email_table'),"
  email_id 		I  UNSIGNED NOTNULL PRIMARY AUTOINCREMENT,
  email		 	C(64) NOTNULL DEFAULT \" '' \",
  subject		C(250) NOTNULL DEFAULT \" '' \",
  submitted 	I  UNSIGNED     NOTNULL DEFAULT '1',
  metadata 		XL NOTNULL,
  body 			XL NOTNULL
  ",Array('mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS')));
$upgrade[] = Array('CreateIndexSQL',Array('idx_email_id',db_get_table('mantis_email_table'),'email_id'));
$upgrade[] = Array('AddColumnSQL',Array(db_get_table('mantis_bug_table'), "target_version C(64) NOTNULL DEFAULT \" '' \""));
$upgrade[] = Array('AddColumnSQL',Array(db_get_table('mantis_bugnote_table'), "time_tracking I UNSIGNED NOTNULL DEFAULT \" 0 \""));
$upgrade[] = Array('CreateIndexSQL',Array('idx_diskfile',db_get_table('mantis_bug_file_table'),'diskfile'));
$upgrade[] = Array('AlterColumnSQL', Array( db_get_table( 'mantis_user_print_pref_table' ), "print_pref C(64) NOTNULL" ) );
/* 60 */
$upgrade[] = Array('AlterColumnSQL', Array( db_get_table( 'mantis_bug_history_table' ), "field_name C(64) NOTNULL" ) );

# Release marker: 1.1.0a4

$upgrade[] = Array('CreateTableSQL', Array( db_get_table( 'mantis_tag_table' ), "
	id				I		UNSIGNED NOTNULL PRIMARY AUTOINCREMENT,
	user_id			I		UNSIGNED NOTNULL DEFAULT '0',
	name			C(100)	NOTNULL PRIMARY DEFAULT \" '' \",
	description		XL		NOTNULL,
	date_created	I		UNSIGNED NOTNULL DEFAULT '1',
	date_updated	I		UNSIGNED NOTNULL DEFAULT '1'
	", Array( 'mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS' ) ) );
$upgrade[] = Array('CreateTableSQL', Array( db_get_table( 'mantis_bug_tag_table' ), "
	bug_id			I	UNSIGNED NOTNULL PRIMARY DEFAULT '0',
	tag_id			I	UNSIGNED NOTNULL PRIMARY DEFAULT '0',
	user_id			I	UNSIGNED NOTNULL DEFAULT '0',
	date_attached	I  UNSIGNED     NOTNULL DEFAULT '1'
	", Array( 'mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS' ) ) );

$upgrade[] = Array('CreateIndexSQL', Array( 'idx_typeowner', db_get_table( 'mantis_tokens_table' ), 'type, owner' ) );

# Release marker: 1.2.0-SVN

$upgrade[] = Array('CreateTableSQL', Array( db_get_table( 'mantis_plugin_table' ), "
	basename		C(40)	NOTNULL PRIMARY,
	enabled			L		NOTNULL DEFAULT \" '0' \"
	", Array( 'mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS' ) ) );

/******************************************************** 
 * I used Enterprise Manager to do this after the install  
 ********************************************************
$upgrade[] = Array('AlterColumnSQL', Array( db_get_table( 'mantis_user_pref_table' ), "redirect_delay 	I NOTNULL DEFAULT 0" ) );
*/

/* apparently mysql now has a STRICT mode, where setting a DEFAULT value on a blob/text is now an error, instead of being silently ignored */
if ( isset( $f_db_type ) && ( $f_db_type == 'mysql' || $f_db_type == 'mysqli' ) ) {
	$upgrade[] = Array('AlterColumnSQL', Array( db_get_table( 'mantis_custom_field_table' ), "possible_values X NOTNULL" ) );
/******************************************************** 
 * I used Enterprise Manager to do this after the install  
 ********************************************************
} else {
	$upgrade[] = Array('AlterColumnSQL', Array( db_get_table( 'mantis_custom_field_table' ), "possible_values X NOTNULL DEFAULT \" '' \"" ) );
*/
}

$upgrade[] = Array( 'CreateTableSQL', Array( db_get_table( 'mantis_category_table' ), "
	id				I		UNSIGNED NOTNULL PRIMARY AUTOINCREMENT,
	project_id		I		UNSIGNED NOTNULL DEFAULT '0',
	user_id			I		UNSIGNED NOTNULL DEFAULT '0',
	name			C(128)	NOTNULL DEFAULT \" '' \",
	status			I		UNSIGNED NOTNULL DEFAULT '0'
	", Array( 'mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS' ) ) );
$upgrade[] = Array( 'CreateIndexSQL', Array( 'idx_category_project_name', db_get_table( 'mantis_category_table' ), 'project_id, name', array( 'UNIQUE' ) ) );
$upgrade[] = Array( 'InsertData', Array( db_get_table( 'mantis_category_table' ), "
	( project_id, user_id, name, status ) VALUES
	( '0', '0', 'General', '0' ) " ) );
/* 70 */
$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_bug_table' ), "category_id I UNSIGNED NOTNULL DEFAULT '1'" ) );
$upgrade[] = Array( 'UpdateFunction', "category_migrate" );
/******************************************************** 
 * I used Enterprise Manager to do this after the install  
 ********************************************************
$upgrade[] = Array( 'DropColumnSQL', Array( db_get_table( 'mantis_bug_table' ), "category" ) );
*/
$upgrade[] = Array( 'DropTableSQL', Array( db_get_table( 'mantis_project_category_table' ) ) );
$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_project_table' ), "category_id I UNSIGNED NOTNULL DEFAULT '1'" ) );
$upgrade[] = Array('CreateIndexSQL',Array('idx_project_id',db_get_table('mantis_project_table'),'id', array('DROP')), Array( 'db_index_exists', Array( db_get_table('mantis_project_table'), 'idx_project_id')));
$upgrade[] = Array('CreateIndexSQL',Array('idx_config',db_get_table( 'mantis_config_table' ),'config_id', array('DROP')), Array( 'db_index_exists', Array( db_get_table('mantis_config_table'), 'idx_config')));

$upgrade[] = Array( 'InsertData', Array( db_get_table( 'mantis_plugin_table' ), "
	( basename, enabled ) VALUES
	( 'MantisCoreFormatting', '1' )" ) );

$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_project_table' ), "inherit_global I UNSIGNED NOTNULL DEFAULT '0'" ) );
$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_project_hierarchy_table' ), "inherit_parent I UNSIGNED NOTNULL DEFAULT '0'" ) );
/* 80 */
$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_plugin_table' ), "
	protected		L		NOTNULL DEFAULT \" '0' \",
	priority		I		UNSIGNED NOTNULL DEFAULT '3'
	" ) );
$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_project_version_table' ), "
	obsolete		L		NOTNULL DEFAULT \" '0' \"" ) );
$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_bug_table' ), "
    due_date        I  UNSIGNED     NOTNULL DEFAULT '1'" ) );

$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_custom_field_table' ), "
  filter_by 		L 		NOTNULL DEFAULT \" '1' \"" ) );
$upgrade[] = Array( 'CreateTableSQL', Array( db_get_table( 'mantis_bug_revision_table' ), "
	id			I		UNSIGNED NOTNULL PRIMARY AUTOINCREMENT,
	bug_id		I		UNSIGNED NOTNULL,
	bugnote_id	I		UNSIGNED NOTNULL DEFAULT '0',
	user_id		I		UNSIGNED NOTNULL,
	timestamp	I		UNSIGNED NOTNULL DEFAULT '1',
	type		I		UNSIGNED NOTNULL,
	value		XL		NOTNULL
	", Array( 'mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS' ) ) );
$upgrade[] = Array( 'CreateIndexSQL', Array( 'idx_bug_rev_id_time', db_get_table( 'mantis_bug_revision_table' ), 'bug_id, timestamp' ) );
$upgrade[] = Array( 'CreateIndexSQL', Array( 'idx_bug_rev_type', db_get_table( 'mantis_bug_revision_table' ), 'type' ) );

#date conversion
/************************************************************************************
 * I removed all the conversion SQL and modified the data types during table creation
 ************************************************************************************/
$upgrade[] = Array('CreateIndexSQL',Array('idx_last_mod',db_get_table( 'mantis_bugnote_table' ),'last_modified', array('DROP')), Array( 'db_index_exists', Array( db_get_table('mantis_bugnote_table'), 'idx_last_mod')));
$upgrade[] = Array('CreateIndexSQL',Array('idx_last_mod',db_get_table('mantis_bugnote_table'),'last_modified'));
$upgrade[] = Array('CreateIndexSQL',Array('idx_bug_rev_id_time',db_get_table( 'mantis_bug_revision_table' ),'bug_id, timestamp', array('DROP')), Array( 'db_index_exists', Array( db_get_table('mantis_bug_revision_table'), 'idx_bug_rev_id_time')));
$upgrade[] = Array( 'CreateIndexSQL', Array( 'idx_bug_rev_id_time', db_get_table( 'mantis_bug_revision_table' ), 'bug_id, timestamp' ) );
$upgrade[] = Array( 'CreateIndexSQL', Array( 'idx_project_hierarchy_child_id', db_get_table( 'mantis_project_hierarchy_table' ), 'child_id' ) );
$upgrade[] = Array( 'CreateIndexSQL', Array( 'idx_project_hierarchy_parent_id', db_get_table( 'mantis_project_hierarchy_table' ), 'parent_id' ) );
$upgrade[] = Array( 'CreateIndexSQL', Array( 'idx_tag_name', db_get_table( 'mantis_tag_table' ), 'name' ) );
$upgrade[] = Array( 'CreateIndexSQL', Array( 'idx_bug_tag_tag_id', db_get_table( 'mantis_bug_tag_table' ), 'tag_id' ) );
$upgrade[] = Array( 'CreateIndexSQL', Array( 'idx_email_id', db_get_table( 'mantis_email_table' ), 'email_id', array( 'DROP' ) ), Array( 'db_index_exists', Array( db_get_table( 'mantis_email_table' ), 'idx_email_id') ) );

$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_user_pref_table' ), "
	 timezone C(32) NOTNULL DEFAULT '' " ) );

$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_project_file_table' ), "
	user_id			I		UNSIGNED NOTNULL DEFAULT '0' " ) );
$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_bug_file_table' ), "
	user_id		I  			UNSIGNED NOTNULL DEFAULT '0' " ) );
schema_NEW.php (28,727 bytes)   

Relationships

has duplicate 0014359 closeddregad First install but cannot login with default user/password. 
related to 0011524 closeddregad 1.2.0rc2 with MS SQL not installable 

Activities

gmazarakis

gmazarakis

2009-10-05 10:05

reporter   ~0023057

I downgraded my SQL Server from 2008 to 2005 and still got the same error

cor3huis

cor3huis

2010-01-22 10:40

reporter   ~0024221

Do you happen to have a user Default? this might shed some light.
http://www.devnewsgroups.net/group/microsoft.public.dotnet.framework.adonet/topic26999.aspx

I know it is most of the time not possible, but if you have the option to upgrade to an Opensource DB like MySQL you could consider that and see if it solves your issues.

maximaxi

maximaxi

2010-02-15 07:38

reporter   ~0024392

Last edited: 2010-02-15 07:39

I (!) uploaded the 2 screenshots.

I get the same error as the "author" of this issue.
I'm using the sa-account with a modified password for setting up the bugtracker db.

The second error appears after a retry (after error1).

maximaxi

maximaxi

2010-02-15 10:07

reporter   ~0024393

Last edited: 2010-02-15 10:19

If I use Mantis version 1.1.8, the script could execute more commands than with 1.2.0rc2. It crashes when it tries to fill the mantis_user_table:

Schema InsertData ( mantis_user_table ) BAD
INSERT INTO mantis_user_table(username, realname, email, password, date_created, last_visit, enabled, protected, access_level, login_count, lost_password_request_count, failed_login_count, cookie_string) VALUES ('administrator', '', 'root@localhost', '63a9f0ea7bb98050796b649e85481845', '2010-02-15 16:05:33', '2010-02-15 16:05:33', 1, 0, 90, 3, 0, 0, 'e30f2f27d954bfb2fe09cab820fc57e9e60a4f546f90c56d3fc22142a724f656')
Die Anweisung wurde beendet.

Just wanted to check different versions in the end I want 1.2.0rc2 to get running.


Inserted it manually, stopped at following line:

INSERT INTO mantis_user_table(username, realname, email, password, date_created, last_visit, enabled, protected, access_level, login_count, lost_password_request_count, failed_login_count, cookie_string) VALUES
('administrator', '', 'root@localhost', '63a9f0ea7bb98050796b649e85481845', '2010-02-15 16:08:07', '2010-02-15 16:08:07', 1, 0, 90, 3, 0, 0, '436530cdb8f9ecc8166018b5ab3f4f2de8acfe1cc575870c6f2736ea56b5f261');

With the following error:

Meldung 242, Ebene 16, Status 3, Zeile 3
Bei der Konvertierung eines char-Datentyps in einen datetime-Datentyp liegt der datetime-Wert außerhalb des gültigen Bereichs.

The rest runs through and Mantis shows me the login screen.

So, conclusion:

There are significant differences between 1.1.8 and 1.2.0rc2 insert commands.

Sometimes 1.2.0rc2 shows sql commands I have never ever seen... are these commands 100% correct?!?

Just a few examples:

There are numbers of these _migrate commands in 1.2.0rc2:

date_migrate;

SYSTEM WARNING: htmlentities() expects parameter 1 to be string, array given
;

The SYSTEM WARNING always throws an error in this script and the _migrate commands couldn't be interpreted, too.

makafre

makafre

2010-03-25 09:02

reporter   ~0024907

Last edited: 2010-03-25 09:08

I get the same result as the author; setup is PHP 5.2.10 on FastCGI (IIS6)
acessing a 8.00.2039 - SP4 - Standard Edition SQL Server. Mantis is 1.2.0 Stable.

Message: "Database query failed. Error received from database was 0000206: Operand type clash: int is incompatible with text for the query: INSERT INTO mantis_config_table
( value, type, access_reqd, config_id, project_id, user_id )
VALUES
(?, ?, ?, ?, ?,? )."

I'm sponsoring this issue to have a smooth ms sql installation.

czema

czema

2010-04-05 14:45

reporter   ~0025033

There are several of this type of issue in the product. It relates to the way the variables are databound to the query. If the variable is integer type the database throws an error when trying to store it in a text field.

The fix is to run the variable through db_prepare_string() first. I have done this on line 634 of \core\config_api.php

--- $c_value = $p_value;
+++ $c_value = db_prepare_string( $p_value );

I also identified this issue in the tokens_api.php file. On line 279 I added:

$c_value = db_prepare_string( $p_value );

czema

czema

2010-04-05 14:46

reporter   ~0025034

Also, according to http://gonfva.blogspot.com/2010/03/mantis-on-sql-server.html, for a MSSQL installation, line 110 of \library\adodb\adodb.inc.php needs to be changed:

--- define('ADODB_FETCH_ASSOC',2);
+++ define('ADODB_FETCH_ASSOC',0);

ottog

ottog

2010-05-05 10:13

reporter   ~0025405

Hi,

Here are the steps that I followed to eventually install MantisBT 1.2.1 stable with Windows 2003, IIS6 (ISAPI) and SQL Server 2005.

  1. Made sure I used a PHP 5.2.x version that could successfully connect to the SQL Server.

  2. Applied the db_prepare_string() patches suggested above.

  3. Applied a patch to the same effect as the ADODB_FETCH_ASSOC patch suggested above.

  4. Installed the regular way, letting MantisBT issue the database-creation queries.

Regarding the db_prepare_string() patches, the line numbers were not relevant for 1.2.1 stable, and in tokens_api.php, two functions seemed to need patching.

Here is diff -u output for the 1.2.1 stable config_api.php and tokens_api.php files.

--- core/config_api.1.2.1.php 2010-05-05 13:15:20.833709700 +0200
+++ core/config_api.php 2010-05-05 13:16:57.161218200 +0200
@@ -322,7 +322,7 @@
$c_value = db_prepare_int( $p_value );
} else {
$t_type = CONFIG_TYPE_STRING;

  • $c_value = $p_value;
  • $c_value = db_prepare_string($p_value);
    }

    if( config_can_set_in_database( $p_option ) ) {

--- core/tokens_api.1.2.1.php 2010-05-05 13:56:34.322249100 +0200
+++ core/tokens_api.php 2010-05-05 13:57:32.118754200 +0200
@@ -191,7 +191,8 @@
*/
function token_create( $p_type, $p_value, $p_expiry = TOKEN_EXPIRY, $p_user_id = null ) {
$c_type = db_prepare_int( $p_type );

  • $c_timestamp = db_now();
  • $c_value = db_prepare_string( $p_value );
  • $c_timestamp = db_now();
    $c_expiry = time() + $p_expiry;
    $c_user_id = db_prepare_int( $p_user_id == null ? auth_get_current_user_id() : $p_user_id );

@@ -200,7 +201,7 @@
$t_query = "INSERT INTO $t_tokens_table
( type, value, timestamp, expiry, owner )
VALUES ( " . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ', ' . db_param() . ' )';

  • db_query_bound( $t_query, Array( $c_type, $p_value, $c_timestamp, $c_expiry, $c_user_id ) );
  • db_query_bound( $t_query, Array( $c_type, $c_value, $c_timestamp, $c_expiry, $c_user_id ) );
    return db_insert_id( $t_tokens_table );
    }

@@ -214,6 +215,7 @@
function token_update( $p_token_id, $p_value, $p_expiry = TOKEN_EXPIRY ) {
token_ensure_exists( $p_token_id );
$c_token_id = db_prepare_int( $p_token_id );

  • $c_value = db_prepare_string( $p_value );
    $c_expiry = time() + $p_expiry;

    $t_tokens_table = db_get_table( 'mantis_tokens_table' );

    @@ -221,7 +223,7 @@
    $t_query = "UPDATE $t_tokens_table
    SET value=" . db_param() . ", expiry=" . db_param() . "
    WHERE id=" . db_param();

  • db_query_bound( $t_query, Array( $p_value, $c_expiry, $c_token_id ) );
  • db_query_bound( $t_query, Array( $c_value, $c_expiry, $c_token_id ) );

    return true;

    }

Regarding the ADODB_FETCH_ASSOC patch, it does not seem right to patch an external library that has been incorporated verbatimly into the system. I patched core/database_api.php instead. Here is the diff -u output.

--- core/database_api.1.2.1.php 2010-05-05 15:40:02.455451400 +0200
+++ core/database_api.php 2010-05-05 15:40:08.142915000 +0200
@@ -56,7 +56,7 @@

  • set adodb fetch mode
  • @global bool $ADODB_FETCH_MODE
    */
    -$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
    +$ADODB_FETCH_MODE = ADODB_FETCH_DEFAULT;

    /**

  • Tracks the query parameter count for use with db_aparam().

It should be noted that MantisBT does not in any reasonably workable manner support installation to Microsoft SQL Server with the "Print SQL Queries instead of Writing to the Database" option checked. Apparently, the ADODB library relies on having an active database connection and issuing queries for dropping "default constraints" before columns are modified or dropped. Thus, dozens of SQL queries that are very cumbersome to recreate manually are missing from the printed SQL code. This is arguably a defect of the ADODB library, which could in principle generate pure SQL code for dropping the constraints instead of relying on PHP logic, and I do not think it ought to be fixed or worked around by MantisBT. But there should perhaps be a warning if "MS SQL Server" and "Print SQL Queries" are selected together on the installation page.

Also, for easier debugging, inserting the function call error_reporting(0); into install.php, for example right before the while loop that starts on line 708, seems like a good idea. (It then becomes possible to see how far the script has progressed, and the error message is still printed, though with a different layout. Also, any debug printouts inserted by the user will be kept.)

yanual

yanual

2010-05-10 13:24

reporter   ~0025454

I have done all what you wrote on 0010742:0025405, but I still have the error date_migrate; ...

The version of my PHP is 5.2.13 and 5.0.45 for Mysql.

ottog

ottog

2010-05-10 13:56

reporter   ~0025455

In response to http://www.mantisbt.org/bugs/view.php?id=10742#c25454, since you are using MySQL, not Microsoft SQL Server, I am not sure that any of the actions in this issue are necessary (but they will not hurt).

Instead, see http://www.mantisbt.org/bugs/view.php?id=11364 for the date_migrate issue. It may or may not work with MySQL to let the installer print the database commands instead of running them directly, but if it works, there is a workaround in issue 11364 that avoids the error message for date_migrate.

Otherwise, let MantisBT run the database-creation commands directly.

yanual

yanual

2010-05-11 05:23

reporter   ~0025460

Ok, thanks a lot, I haven't seen this new note. Your patch work very well on my configuration.

ntimmerman

ntimmerman

2010-07-15 01:12

reporter   ~0026082

Last edited: 2010-07-15 01:14

Does anyone know if and when this will be resolved?

I've encountered exactly this problem when trying to run the /Admin/Install.php script. I know I've installed PHP correctly as well as the MSSQL extension as I confirmed both with test scripts of my own. I installed PHP with the Windows Installer, FastCGI option, on Windows Server 2008 R2 x64.

I am attempting to install the database in SQL Server 2008. I created a sql database user with the sysadmin role on the server and entered that account for both the database user and database install user on the Install.php screen.

Do most folks just use MySQL with Mantis? I did notice that the selection for MS SQL Server stated, "experimental" in parentheses next to it, which did not inspire much confidence...

ntimmerman

ntimmerman

2010-07-15 01:52

reporter   ~0026083

I applied the patches above but unfortunately they did not work in my case. I am using Windows Server 2008 R2 running PHP in IIS7 FastCGI and the database server is 2008, so there are a number of differences between my environment and the Windows Server 2003/IIS6/SQL 2005 environment that the above patch is successful with.

ischilling

ischilling

2010-07-29 10:15

reporter   ~0026164

I allowed myself to double the current Sponsoring - maybe this makes a solution which may open Mantis not only to SQL-Server (but this in special, and R2 is very welcome ;o)) more interesting.

vallen

vallen

2010-08-17 23:36

reporter   ~0026347

I have successfully installed Mantis 1.2.2 on Windows Server 2003, IIS6, and MSSQL 2005. This is a new installation, so my solution will not work for anyone wishing to upgrade from 1.1.x.

First I applied the patches identified in Ottog's note (http://www.mantisbt.org/bugs/view.php?id=10742#c25405 [^]). I did have some issues with the patch for token_api.php and skipped that one.

Once I applied the patches, install.php was failing to alter tables, specifically dropping columns, saying that an object is still associated to the column. I tried moving all the index creation queries to the bottom of schema, but that didn't seem to have an effect.

Looking closer at the SQL it became clear that the alter table queries were in almost all cases changing v1.1.x date/time fields to int fields for 1.2.x (I think to account for MySQL not reading seconds from date/time fields or something). Since mine is a clean install, I simply modified the table creation queries in schema.php to use ints instead of date/time data types. Doing this also obviated the need to perform all those date_migrate update functions.

Install.php ran without a gripe and everything seems to be working fine!

I have attached my modified schema.php; I suggest doing a diff between the original and my version to see exactly what I did. BTW, there are a few queries I commented-out and then manually performed after the install using Enterprise Manager -- you can't miss my comments pointing them out!

All-in-all not too bad for a few days of pounding my head against my keyboard!

tiv

tiv

2010-09-22 09:01

reporter   ~0026842

Try to upgrade from 1.1.8 to 1.2.3 (latest build), but have the same result :( When developers fix this issue??

DiamondEagle

DiamondEagle

2010-10-01 06:47

reporter   ~0026927

Last edited: 2010-10-01 06:51

Same story here. I can't upgrade my MSSQL Mantis 1.1.8 to Mantis 1.2.3. I get this error:

Database query failed. Error received from database was 0000208: Invalid object name 'mantis_category_table'. for the query: SELECT c.*, p.name AS project_name FROM mantis_category_table AS c
LEFT JOIN mantis_project_table AS p
ON c.project_id=p.id
WHERE project_id=0
ORDER BY c.name .

There is no mantis_category_table in my 1.1.8 database and the upgrade doesn't create it.

I'm running Microsoft SQL Server 2005 - 9.00.4053.00 on a Windows 2003 SP2 server.

qr123de

qr123de

2010-10-06 04:07

reporter   ~0026967

This bug also appears on a fresh install.
Mantis 1.2.3
MSSQL 2008

I cant install :-(

abdzso

abdzso

2010-10-13 03:43

reporter   ~0027015

Same problem.

The main problem is, that the mantis_config_table have an ID colum, wich type is integer. But when the table is created, the install script makes a varchar type, and so the installation cannot be continue.

DiamondEagle

DiamondEagle

2010-11-02 01:11

reporter   ~0027212

See http://www.mantisbt.org/bugs/view.php?id=11524 for a related problem and a possible solution for upgrading Mantis 1.1.x to 1.2.

tiv

tiv

2011-02-08 10:17

reporter   ~0028191

Last edited: 2011-02-08 10:48

I find bug on first page of Mantis site, please fix it:

"MantisBT is a ... bugtracking system ... works with ... MS SQL ... databases ..."

Mantis (don't) work with MS SQL database after lot of troubleshooting!

ottog

ottog

2011-02-08 10:37

reporter   ~0028192

Hi,

We use the version 1.2.3 on a daily basis with MS SQL Server, and it is very stable. Unfortunately, there are some bumps in the installation process. If I had more time to spare, I would try to contribute to improving that part of it, but regardless, the fact is that MantisBT does work very well with SQL Server. So if you prefer SQL Server as a database platform, it is well worth the effort to work around the intallation issues.

Banan

Banan

2011-04-08 09:12

reporter   ~0028568

Last edited: 2011-04-08 09:13

Hi!

I've applied all the patches provided by ottog and ended up with "Operand type clash(..)" error (update instead of insert thou).

What fixed it for me was this change in config_api.php on line 349 (it's for update statement):

        $t_params = Array(
                            ---$c_value,
            +++db_prepare_string($c_value),
            $t_type,
            $c_access,
            $c_option,
            $c_project,
            $c_user,
        );

As I said, I did it only for update statement since that is where I had my error. I suppose you can try it with other as well. I'm aware that it's not very elegant but solved my problem. Hope it helps!

Banan.

Ps. I was upgrading form 1.1.8 to 1.2.5,
Win 2003 Ent. sp2 x64
MSSSQL 2008 Ent x64 SP1 (separate machine)
php 5.2.9-2
Hosted on IIS

czema

czema

2011-04-08 09:22

reporter   ~0028569

I just changed the value column to varchar(max) instead of text. I did the same in the token table (cannot remember the exact name or column, it is the only text column).

cicatrix

cicatrix

2011-05-12 12:13

reporter   ~0028775

When this issue is resolved?

overdrive345

overdrive345

2011-05-19 09:09

reporter   ~0028802

Hi All,

After choosing Mantis and MS SQL, I was disappointed to see that this upgrade bug hasn’t been fixed for around 2 years!

I have taken a look at the fixes suggested above, and carefully modified Mantis v1.2.1 code but I’m still unable to upgrade.

My current settings are as follows:

Microsoft Server 2008 R2 (SP1) 2.6Ghz Xeon 12GB RAM
Microsoft SQL 2008 R2 (running two instances of the server, only one for Mantis)
Apache 2.2.17 (Port 8081)
IIS (Port 80, but not using IIS for mantis)
PHP 3.5.6

I’m trying to upgrade from 1.1.6 to 1.2.1. As we currently have several thousand issues in our databases, and I’m finding that the MyView page is starting to slow down dramatically. I heard that it’s been re-coded and optimised in 1.2x. Which is why I desperately need the upgrade.

I’ve got mantis currently up and running on a server (on MS SQL 2000) which was a fresh install, but need to move the db to a DIFFERENT server (running MS SQL 2008 R2) and upgrade from Mantis 1.1.6 to 1.2.x or 1.3.x. Below are the things I’ve tried (hopefully to help other users in my situation out), and hopefully can get some feedback as to where I have gone wrong.

On the new server I’m trying to migrate to, I have ..

First, installed MS SQL 2008 (running at least 2 instances, but I’m only using one for Mantis), and Apache 2.2 (port 8080).
Then installed PHP 5.2.9 (extension=php_mssql.dll), but that caused Apache to fail to start.
Then installed PHP 5.2.17 but that didn’t detect my MS SQL module.
So I install the Microsoft PHP MSSQL driver (http://www.microsoft.com/downloads/en/details.aspx?FamilyID=80e44913-24b4-4113-8807-caae6cf2ca05) with 5.2.17 PHP (extension=php_sqlsrv_52_ts_vc6.dll) but that resulted in bug: http://www.mantisbt.org/bugs/view.php?id=10131
So I used PHP 5.3.6 and MS SQL PHP driver (php_sqlsrv_53_ts_vc9.dll).
This then appeared to open the install.php page correctly.

I hope you’re keeping up :) So I’ve got PHP 5.3.6 (using MS PHP driver) and Apache installed.

When trying to install Mantis, I get an error saying PHP support for db fails. Which lead me to this issue (http://www.mantisbt.org/bugs/view.php?id=11497) which lead me to this solution (http://www.mantisbt.org/bugs/view.php?id=11776).

So I patched database_api and install.php. Which lead me to this bug (http://www.mantisbt.org/bugs/view.php?id=10742).

So to try and get around this bug I’ve patched like ottog has suggested (http://www.mantisbt.org/bugs/view.php?id=10742#c25405).

But that didn’t work so I added a patch Banan suggested: (http://www.mantisbt.org/bugs/view.php?id=10742#c28568)

But that didn’t work so I added the patch czema suggested (http://www.mantisbt.org/bugs/view.php?id=10742#c25034)

But that didn’t work so I tried adding the patch tomkraw1 suggested (http://www.mantisbt.org/bugs/view.php?id=11524#c26105)

But that didn’t work so I tried adding the patch from rzg (http://www.mantisbt.org/bugs/view.php?id=11784#c25489)

But am still stuck with this bug http://www.mantisbt.org/bugs/view.php?id=10742. I’ve tried restarting apache. Tried upgrading my original database. Tried installing into a fresh db (just to see if I could). Tried setting the db to MS SQL 2000 mode.
All result in this same error message (as shown above in error2.png).

I added each patch in one by one, and tried restarting apache, and upgrading mantis after applying each patch. I was hoping the first and second patch would be enough, I never intended to have applied so many patches. I’m happy to take each patch out and try different patches if anyone has any ideas.

I can e-mail anyone my Mantis files (post patches) if anyone would like to review them. Or if anyone has MS SQL working I would greatly appreciate a copy of their mantis php files just in case they’ve forgotten to mention any other patches they’ve done to get it working, or unless I’ve made a mistake.

I would prefer if MS SQL worked in a released version of Mantis, but I understand this is OpenSource primarily driven by volunteers. So I’m happy to patch my files from users suggestions, but I don’t seem to be having a success. PS – I have sponsored a little to try and help.

Can ANYONE help? Or offer any advice. As this issue is becoming more and more urgent.

AndyH

rzg

rzg

2011-06-06 16:39

reporter   ~0028927

Last edited: 2011-06-06 16:53

Guys- I'm successfully running a Mantis server on mssql. It works, but not out-of-the-box as noted. Our installation is fairly large- we have over 100,000 tickets and a few hundred users. Because of the scale, our DBAs have added additional covering indexes to the database, and I've modified the code in several places to customize it. Right now the biggest complaint we get is the search speed; maybe when I have the time I'll tweak filter_api to use SQL server full text indexing....

To get Mantis (existing database) running on a vanilla IIS 6 server I did the following:
Download and unzip php 5.3 VC9 NTS
Download and unzip mantis
Run the installer for SQL 2008R2 native client
Install the VC9 runtimes (for fastcgi)
Install fastcgi, set up php in it, set IIS to point to it
Unzip php native sql driver into php extensions folder, rename per docs
Unzip wincache into php extensions folder
uncomment/add extensions lines to php.ini

Update tag_api per my comment 0011784:0025489
Update token_api per comments here
NOTE- SEE UPDATE BELOW: Update config_api line 320ish per comments here. I think I went a step farther and made it handle both the numeric case and the string case as strings because of some edge cases- You might need to do the same based on the error you cite.

UPDATE: I'm running 1.2.5 at this point without the patched config_api, and I'm not encountering any issues with a quick walk through the app. But our older production instance (1.2.2, older sql driver, php 5.2) has the patch. Your luck may vary.

Good luck,
rzg

qr123de

qr123de

2011-09-21 04:10

reporter   ~0029820

i get the same error when i'm trying to install a fresh mantis 1.2.8 on mssql 2008.

APPLICATION ERROR 0000401
Database query failed. Error received from database was 0000206: Operand type clash: int is incompatible with text for the query: INSERT INTO mantis_config_table
( value, type, access_reqd, config_id, project_id, user_id )
VALUES
(?, ?, ?, ?, ?,? ).

grangeway

grangeway

2014-02-17 13:26

reporter   ~0039446

Marking as Suspended

MSSQL support is currently known broken. We are going to be replacing the DB Layer in Mantis to fix this properly after the next release.

I'd strongly advise using MYSQL for now.

The new DB layer already contains the appropriate fixes for MS SQL Support.

grangeway

grangeway

2014-03-27 19:12

reporter   ~0039759

MSSQL support is currently known broken. We are going to be replacing the DB Layer in Mantis to fix this properly after the next release.

I'd strongly advise using MYSQL for now.

The new DB layer already contains the appropriate fixes for MS SQL Support.

grangeway

grangeway

2014-05-16 15:00

reporter   ~0040330

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
Paul

dregad

dregad

2015-03-14 14:02

developer   ~0049220

Despite the fact that I am not actually able to test whether the problem is truly resolved since I don't have access to a MSSQL server setup, I'm marking this issue as fixed in 1.3.x on the grounds that the recent updates in ADOdb (which contain many improvements in the MSSQL driver) are likely to address it.

Should the problem persist (using a nightly build or a version > 1.3.0-beta.1), feel free to reopen this issue or to create a new one.