SYSTEM NOTICE, Error Description
Moderators: Developer, Contributor
Re: SYSTEM NOTICE, Error Description
you know.
i have found error.
it was a mistype in .net code
i have two mantis folder on IIS
one on port 80 and one on port 88
they configs are the same!
in browser i use 80 port, in code i use SOAP API on 88 port.
now i redirect SOAP API to 80 port and it works without problems!
thank you for listening
i have found error.
it was a mistype in .net code
i have two mantis folder on IIS
one on port 80 and one on port 88
they configs are the same!
in browser i use 80 port, in code i use SOAP API on 88 port.
now i redirect SOAP API to 80 port and it works without problems!
thank you for listening
Re: SYSTEM NOTICE, Error Description
it was a mistake.
the error happens because of email_notifications in mantisdb
i forgot that i did $g_enable_email_notification = OFF
today i setup email transport. email goes well.
but SOAP API results in "Unidentified offset 5"
this procedure results in this error.
this SQL has a bug in metaDatabaseSQL or MetaTableSQL or MetaColumnsSQL
metaDatabase
Metatable
metaColumns
in MSSQL profiler i dont see nor metatable nor metacolumns sql.
so the error in metaTableSQL
the error happens because of email_notifications in mantisdb
i forgot that i did $g_enable_email_notification = OFF
today i setup email transport. email goes well.
but SOAP API results in "Unidentified offset 5"
Code: Select all
[13-Jan-2016 12:05:18 Asia/Kuwait] [mantisconnect.php] Error Type: SYSTEM NOTICE,
Error Description: Undefined offset: 5
Stack Trace:
adodb.inc.php L1357 FetchField(<integer>5)
adodb.inc.php L1061 _rs2rs(<Object><ADORecordset_mssqlnative> ( [databaseType] => 'mssqlnative', [canSeek] => false, [fieldOffset] => 5, [dataProvider] => 'native', [fields] => <Array> { ['name'] => 'ExternalEmail', ['type'] => 0, ['access_level_r'] => 10, ['default_value'] => 'defaultvalue', ['value'] => 'test24@ru2' }, [blobSize] => 100, [sql] => '
SELECT f.name, f.type, f.access_level_r, f.default_value, f.type, s.value
FROM mantis_custom_field_project_table p
INNER JOIN mantis_custom_field_table f ON f.id = p.field_id
LEFT JOIN mantis_custom_field_string_table s
ON s.field_id = p.field_id AND s.bug_id = ?
WHERE p.project_id = ?
ORDER BY p.sequence ASC, f.name ASC', [EOF] => false, [emptyTimeStamp] => ' ', [emptyDate] => ' ', [debug] => false, [timeCreated] => 0, [bind] => false, [fetchMode] => 2, [connection] => <Object><ADODB_mssqlnative> ( [databaseType] => 'mssqlnative', [dataProvider] => 'mssqlnative', [replaceQuote] => '\'\'', [fmtDate] => '\'Y-m-d\'', [fmtTimeStamp] => '\'Y-m-d H:i:s\'', [hasInsertID] => true, [substr] => 'substring', [length] => 'len', [hasAffectedRows] => true, [poorAffectedRows] => false, [metaDatabasesSQL] => 'select name from sys.sysdatabases where name <> \'master\'', [metaTablesSQL] => 'select name,case when type=\'U\' then \'T\' else \'V\' end from sysobjects where (type=\'U\' or type=\'V\') and (name not in (\'sysallocations\',\'syscolumns\',\'syscomments\',\'sysdepends\',\'sysfilegroups\',\'sysfiles\',\'sysfiles1\',\'sysforeignkeys\',\'sysfulltextcatalogs\',\'sysindexes\',\'sysindexkeys\',\'sysmembers\',\'sysobjects\',\'syspermissions\',\'sysprotects\',\'sysreferences\',\'systypes\',\'sysusers\',\'sysalternates\',\'sysconstraints\',\'syssegments\',\'REFERENTIAL_CONSTRAINTS\',\'CHECK_CONSTRAINTS\',\'CONSTRAINT_TABLE_USAGE\',\'CONSTRAINT_COLUMN_USAGE\',\'VIEWS\',\'VIEW_TABLE_USAGE\',\'VIEW_COLUMN_USAGE\',\'SCHEMATA\',\'TABLES\',\'TABLE_CONSTRAINTS\',\'TABLE_PRIVILEGES\',\'COLUMNS\',\'COLUMN_DOMAIN_USAGE\',\'COLUMN_PRIVILEGES\',\'DOMAINS\',\'DOMAIN_CONSTRAINTS\',\'KEY_COLUMN_USAGE\',\'dtproperties\'))', [metaColumnsSQL] => 'select c.name,t.name,c.length,
(case when c.xusertype=61 then 0 else c.xprec end),
(case when c.xusertype=61 then 0 else c.xscale end)
from syscolumns c join systypes t on t.xusertype=c.xusertype join sysobjects o on o.id=c.id where o.name=\'%s\'', [hasTop] => 'top', [hasGenID] => true, [sysDate] => 'convert(datetime,convert(char,GetDate(),102),102)', [sysTimeStamp] => 'GetDate()', [maxParameterLen] => 4000, [arrayClass] => 'ADORecordSet_array_mssqlnative', [uniqueSort] => true, [leftOuter] => '*=', [rightOuter] => '=*', [ansiOuter] => true, [identitySQL] => 'select SCOPE_IDENTITY()', [uniqueOrderBy] => true, [_bindInputArray] => true, [_dropSeqSQL] => 'drop table %s', [database] => 'mantis', [host] => '(local)\\old', [user] => 'mantisdb', [password] => '123', [debug] => false, [maxblobsize] => 262144, [concat_operator] => '+', [random] => 'rand()', [upperCase] => 'upper', [true] => '1', [false] => '0', [nameQuote] => '"', [charSet] => false, [emptyDate] => ' ', [emptyTimeStamp] => ' ', [lastInsID] => false, [hasLimit] => false, [readOnly] => false, [hasMoveFirst] => false, [hasTransactions] => true, [genID] => 0, [raiseErrorFn] => false, [isoDates] => false, [cacheSecs] => 3600, [memCache] => false, [memCacheHost] => NULL, [memCachePort] => 11211, [memCacheCompress] => false, [sysUTimeStamp] => false, [noNullStrings] => false, [numCacheHits] => 0, [numCacheMisses] => 0, [pageExecuteCountRows] => true, [autoRollback] => false, [fnExecute] => false, [fnCacheExecute] => false, [blobEncodeType] => false, [rsPrefix] => 'ADORecordSet_', [autoCommit] => true, [transOff] => 0, [transCnt] => 0, [fetchMode] => false, [null2null] => 'null', [_oldRaiseFn] => false, [_transOK] => NULL, [_connectionID] => NULL, [_errorMsg] => false, [_errorCode] => false, [_queryID] => NULL, [_isPersistentConnection] => false, [_evalAll] => false, [_affected] => false, [_logsql] => false, [_transmode] => '' ), [_numOfRows] => -1, [_numOfFields] => 6, [_queryID] => NULL, [_currentRow] => 0, [_closed] => false, [_inited] => true, [_obj] => NULL, [_names] => NULL, [_currentPage] => -1, [_atFirstPage] => false, [_atLastPage] => false, [_lastPageNo] => -1, [_maxRecordCount] => 0, [datetime] => false ), <integer>-1, <integer>-1, <boolean>true)
adodb.inc.php L1008 _Execute(<string>'
SELECT f.name, f.type, f.access_level_r, f.default_value, f.type, s.value
FROM mantis_custom_field_project_table p
INNER JOIN mantis_custom_field_table f ON f.id = p.field_id
LEFT JOIN mantis_custom_field_string_table s
ON s.field_id = p.field_id AND s.bug_id = ?
WHERE p.project_id = ?
ORDER BY p.sequence ASC, f.name ASC', <Array> { [0] => 11, [1] => 1 })
database_api.php L347 Execute(<string>'
SELECT f.name, f.type, f.access_level_r, f.default_value, f.type, s.value
FROM mantis_custom_field_project_table p
INNER JOIN mantis_custom_field_table f ON f.id = p.field_id
LEFT JOIN mantis_custom_field_string_table s
ON s.field_id = p.field_id AND s.bug_id = ?
WHERE p.project_id = ?
ORDER BY p.sequence ASC, f.name ASC', <Array> { [0] => 11, [1] => 1 })
custom_field_api.php L965 db_query_bound(<string>'
SELECT f.name, f.type, f.access_level_r, f.default_value, f.type, s.value
FROM mantis_custom_field_project_table p
INNER JOIN mantis_custom_field_table f ON f.id = p.field_id
LEFT JOIN mantis_custom_field_string_table s
ON s.field_id = p.field_id AND s.bug_id = ?
WHERE p.project_id = ?
ORDER BY p.sequence ASC, f.name ASC', <Array> { [0] => 11, [1] => 1 })
custom_field_api.php L919 custom_field_get_all_linked_fields(<integer>11)
email_api.php L1502 custom_field_get_linked_fields(<integer>11, <integer>25)
email_api.php L592 email_build_visible_bug_data(<integer>10, <integer>11, <string>'email_notification_title_for_action_bug_updated')
email_api.php L559 email_generic_to_recipients(<integer>11, <string>'updated', <Array> { [10] => 'akozlov@ru', [6] => 'akozlov@ru' }, <string>'email_notification_title_for_action_bug_updated', <NULL>NULL, <Array> { })
bug_api.php L548 email_generic(<integer>11, <string>'updated', <string>'email_notification_title_for_action_bug_updated')
Code: Select all
adodb.inc.php L1061 _rs2rs
this SQL has a bug in metaDatabaseSQL or MetaTableSQL or MetaColumnsSQL
metaDatabase
Code: Select all
select name from sys.sysdatabases where name <> \'master\'
Code: Select all
select name,case when type=\'U\' then \'T\' else \'V\' end from sysobjects where (type=\'U\' or type=\'V\') and (name not in (\'sysallocations\',\'syscolumns\',\'syscomments\',\'sysdepends\',\'sysfilegroups\',\'sysfiles\',\'sysfiles1\',\'sysforeignkeys\',\'sysfulltextcatalogs\',\'sysindexes\',\'sysindexkeys\',\'sysmembers\',\'sysobjects\',\'syspermissions\',\'sysprotects\',\'sysreferences\',\'systypes\',\'sysusers\',\'sysalternates\',\'sysconstraints\',\'syssegments\',\'REFERENTIAL_CONSTRAINTS\',\'CHECK_CONSTRAINTS\',\'CONSTRAINT_TABLE_USAGE\',\'CONSTRAINT_COLUMN_USAGE\',\'VIEWS\',\'VIEW_TABLE_USAGE\',\'VIEW_COLUMN_USAGE\',\'SCHEMATA\',\'TABLES\',\'TABLE_CONSTRAINTS\',\'TABLE_PRIVILEGES\',\'COLUMNS\',\'COLUMN_DOMAIN_USAGE\',\'COLUMN_PRIVILEGES\',\'DOMAINS\',\'DOMAIN_CONSTRAINTS\',\'KEY_COLUMN_USAGE\',\'dtproperties\'))
Code: Select all
[metaColumnsSQL] => 'select c.name,t.name,c.length,
(case when c.xusertype=61 then 0 else c.xprec end),
(case when c.xusertype=61 then 0 else c.xscale end)
from syscolumns c join systypes t on t.xusertype=c.xusertype join sysobjects o on o.id=c.id where o.name=\'%s\''
so the error in metaTableSQL
Re: SYSTEM NOTICE, Error Description
in adodb-mssqlnative.inc.php
exists if ($this->connection->debug)
how to enable this?
and why LOG_DATABASE doesnt works in config_inc.php
exists if ($this->connection->debug)
how to enable this?
and why LOG_DATABASE doesnt works in config_inc.php
Re: SYSTEM NOTICE, Error Description
ok.
i have found the error.
it was SQL
here
i make this change to get 5 fields.
so! its not about MSSQL
i have found the error.
it was SQL
Code: Select all
function custom_field_get_all_linked_fields( $p_bug_id ) {
global $g_cached_custom_field_lists;
if( !is_array( $g_cached_custom_field_lists ) ) {
$g_cached_custom_field_lists = array();
}
# is the list in cache ?
if( !array_key_exists( $p_bug_id, $g_cached_custom_field_lists ) ) {
$t_custom_field_project_table = db_get_table( 'mantis_custom_field_project_table' );
$t_custom_field_table = db_get_table( 'mantis_custom_field_table' );
$t_custom_field_string_table = db_get_table( 'mantis_custom_field_string_table' );
$query = "
SELECT f.name, f.type, f.access_level_r, f.default_value,f.type, s.value
FROM $t_custom_field_project_table p
INNER JOIN $t_custom_field_table f ON f.id = p.field_id
LEFT JOIN $t_custom_field_string_table s
ON s.field_id = p.field_id AND s.bug_id = " . db_param() . "
WHERE p.project_id = " . db_param() . "
ORDER BY p.sequence ASC, f.name ASC";
here
here is f.type doubles!!!SELECT f.name, f.type, f.access_level_r, f.default_value,f.type, s.value
i make this change to get 5 fields.
and now it works fine!SELECT f.name, f.type, f.access_level_r, f.default_value, s.value
so! its not about MSSQL
Re: SYSTEM NOTICE, Error Description
I still think it is about MSSQL as there is no problem running this function with other databases.AlexeiK wrote:so! its not about MSSQL
You are right that fetching two times the same column makes not that much sense and should be removed.
But I am not aware that this is wrong or forbidden.
The real problem might be in the MSSQL driver of the underlying database abstraction layer (3rd party ADOdb).
Re: SYSTEM NOTICE, Error Description
AlexeiK,
thank you for taking the time to debug this.
I opened a report for it https://www.mantisbt.org/bugs/view.php?id=20513
thank you for taking the time to debug this.
I opened a report for it https://www.mantisbt.org/bugs/view.php?id=20513
Re: SYSTEM NOTICE, Error Description
atrol wrote:I still think it is about MSSQL as there is no problem running this function with other databases.AlexeiK wrote:so! its not about MSSQL
You are right that fetching two times the same column makes not that much sense and should be removed.
But I am not aware that this is wrong or forbidden.
The real problem might be in the MSSQL driver of the underlying database abstraction layer (3rd party ADOdb).
i can explain
its real problem in php adodb mssql driver extension.
cause it gets columns count from Recordset, not Mapping Array
and MSSQL sends 6 columns in this case.
adodb loop 6 columns and on 6 column it cant find 6 map column in array and dies in "undefined offset 5".
maybe other DB doesnt send identical columns as multiple columns , but sends as one column.
or maybe adodb mssqlnative driver rs2rs not the same as MySQL.
different mapping between array and RS in drivers.
Re: SYSTEM NOTICE, Error Description
Alexei,
In an attempt to troubleshoot the root cause in the ADOdb library, further info is required. I need you for that, because I don't have MSSQL and the error is not reproducible with MySQL.
Mantis 1.2.19 runs a really outdated version of ADOdb (customized 5.10 IIRC). Can you confirm that you experience the same behavior in MantisBT 1.3.0-rc1 ?
To submit an ADOdb issue I need to make sure that the problem exists in the latest version of the library.
Maybe you can run the following code, either from the MantisBT 1.3 root folder, or even better by downloading the latest code for ADOdb library (https://github.com/ADOdb/ADOdb/archive/master.zip), since there have been a few additional fixes to mssqlnative driver since v5.20.2 which we use in 1.3.0-rc.1.
This should replicate the error you had before. Please confirm whether the error still exists, and provide a full stack trace if it does.
I suspect the problem is caused by use of associative fetch mode - since there are 2 columns named type, the 2nd is replacing the 1st resulting in an array with 5 elements instead of the 6 that the query expects.
In an attempt to troubleshoot the root cause in the ADOdb library, further info is required. I need you for that, because I don't have MSSQL and the error is not reproducible with MySQL.
Mantis 1.2.19 runs a really outdated version of ADOdb (customized 5.10 IIRC). Can you confirm that you experience the same behavior in MantisBT 1.3.0-rc1 ?
To submit an ADOdb issue I need to make sure that the problem exists in the latest version of the library.
Maybe you can run the following code, either from the MantisBT 1.3 root folder, or even better by downloading the latest code for ADOdb library (https://github.com/ADOdb/ADOdb/archive/master.zip), since there have been a few additional fixes to mssqlnative driver since v5.20.2 which we use in 1.3.0-rc.1.
Code: Select all
<?php
include('library/adodb/adodb.inc.php');
$db = ADONewConnection('mysqli');
$db->connect(hostname, user, password, dbname); // set parameters as appropriate
$rs = $db->execute('SELECT f.name, f.type, f.access_level_r, f.default_value, f.type, s.value
FROM mantis_custom_field_project_table p
INNER JOIN mantis_custom_field_table f ON f.id = p.field_id
LEFT JOIN mantis_custom_field_string_table s
ON s.field_id = p.field_id AND s.bug_id = ?
WHERE p.project_id = ?
ORDER BY p.sequence ASC, f.name ASC',
array( 11, 1 ) // values here are from your stack trace, use whatever is appropriate
);
I suspect the problem is caused by use of associative fetch mode - since there are 2 columns named type, the 2nd is replacing the 1st resulting in an array with 5 elements instead of the 6 that the query expects.
Re: SYSTEM NOTICE, Error Description
ok. i will check today this.
Re: SYSTEM NOTICE, Error Description
cant pass this
i run 1.3 nighlty on my 1.2 db.
thats why this alter cant by applied.
the right way is:
drop needed constrain and after that alter column.
so if column has constrain it must be dropped in own step.
after that you can change column type.
after that you can add constrain for DEFAULT value.
here you can see some info:
http://stackoverflow.com/questions/9299 ... ault-value
i have run 1.3 on new db on MSSQL 2008 R2.
but it cant be installed because of column alters on columns that already has constrain.
error is below.
here is why so:
http://www.select-sql.com/mssql/how-to- ... mssql.html
it is because versions 2005 and later use another T-SQL commands.
here some info:
http://stackoverflow.com/questions/1978 ... 5-3-and-up
about who is who.
Q: how combobox "Type of database" makes ?
because if i want to install mantis on MSSQL 2000 i need one version of "MS sql server native driver"
if i want MSSQL 2005 and later i need "MS sql server native driver" same or higher version of the drivers.
it will be good if i can enter connection string or choose version of driver.
on my windows i have two "MS sql server native driver" from 2008 R2 and 2012.
mantis 1.3 uses 2012(which is ODBC Driver 11 for SQL Server) and i can`t connect to sql server 2000 by this way.
here is some explanation about drivers for MS SQL servers:
http://stackoverflow.com/questions/5343 ... nt-vs-odbc
$g_upgrade[188] = array( 'AlterColumnSQL', array( db_get_table( 'project' ), 'inherit_global L ' . $t_notnull . ' DEFAULT \'0\'' ) );
MSSQL 2008 R2BAD
ALTER TABLE mantis_project_table ALTER COLUMN inherit_global BIT DEFAULT 0 NOT NULL
SQLState: 42000 Error Code: 156 Message: [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Incorrect syntax near the keyword 'DEFAULT'.
i run 1.3 nighlty on my 1.2 db.
Code: Select all
Msg 5074, Level 16, State 1, Line 2
The object 'DF__mantis_pr__inher__4EFDAD20' is dependent on column 'inherit_global'.
Msg 4922, Level 16, State 9, Line 2
ALTER TABLE ALTER COLUMN inherit_global failed because one or more objects access this column.
the right way is:
Code: Select all
alter table mantis_project_table drop constraint DF__mantis_pr__inher__4EFDAD20
go
alter table mantis_project_table alter column inherit_global BIT
go
alter table mantis_project_table add constraint DF__mantis_pr__inher__4EFDAD20 default 0 for inherit_global
go
so if column has constrain it must be dropped in own step.
after that you can change column type.
after that you can add constrain for DEFAULT value.
here you can see some info:
http://stackoverflow.com/questions/9299 ... ault-value
i have run 1.3 on new db on MSSQL 2008 R2.
but it cant be installed because of column alters on columns that already has constrain.
error is below.
Code: Select all
Schema step 65: AlterColumnSQL ( mantis_user_pref_table ) BAD
ALTER TABLE mantis_user_pref_table ALTER COLUMN redirect_delay INT DEFAULT 0 NOT NULL
SQLState: 42000 Error Code: 156 Message: [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Incorrect syntax near the keyword 'DEFAULT'.
http://www.select-sql.com/mssql/how-to- ... mssql.html
it is because versions 2005 and later use another T-SQL commands.
here some info:
http://stackoverflow.com/questions/1978 ... 5-3-and-up
about who is who.
Q: how combobox "Type of database" makes ?
because if i want to install mantis on MSSQL 2000 i need one version of "MS sql server native driver"
if i want MSSQL 2005 and later i need "MS sql server native driver" same or higher version of the drivers.
it will be good if i can enter connection string or choose version of driver.
on my windows i have two "MS sql server native driver" from 2008 R2 and 2012.
mantis 1.3 uses 2012(which is ODBC Driver 11 for SQL Server) and i can`t connect to sql server 2000 by this way.
here is some explanation about drivers for MS SQL servers:
http://stackoverflow.com/questions/5343 ... nt-vs-odbc
Last edited by AlexeiK on 15 Jan 2016, 12:34, edited 7 times in total.
Re: SYSTEM NOTICE, Error Description
so as i can NOT setup 1.3 i will check moment with double columns.
Re: SYSTEM NOTICE, Error Description
trying to install mantis 1.3
today i install php 5.3 and sqlsrv version 2.0 is compatible with PHP 5.2.4 to 5.3.x and SQL Native client 2008 R2 to connect to Microsoft SQL Server 2000, 2005, or 2008.
and MS SQL 2000.
but!
running mantis 1.3 i get
so! mantis 1.3 wants MS SQL 2005 or later , but scripts on altering column doesnt supports MS SQL 2005.
and then i lowering MIN_VERSION to 8.0.0.0
i see you use TIME data type that MS SQL 2000 doesnt supports.
so we need to change scripting ALTER COLUMN for schema.php and thats all.
as i see in datadict-mssqlnative.inc.php
it supports ALTER COLUMN for 2005 but it doesnt works well.
there is IF.
one direction is what we want
one for default
schema.php always use default
LOOK HERE!
in mantis 1.3 in datadict-mssqlnative.inc.php has no SUPPORT for ALTERCOLUMNSL function.
this function is COMMENTED!
that is why mantis 1.3 use default from adodb-datadict.inc.php
in mantis 1.2 everything is ok about ALTERCOLUMNSSQL function in datadict-mssqlnative.inc.php
i looked in adodb.master repository and there is no support for ALTERCOLUMNSQL too.
today i install php 5.3 and sqlsrv version 2.0 is compatible with PHP 5.2.4 to 5.3.x and SQL Native client 2008 R2 to connect to Microsoft SQL Server 2000, 2005, or 2008.
and MS SQL 2000.
but!
running mantis 1.3 i get
Code: Select all
BAD
SQL Server 2005 (9.0.0) or later is required for installation.
and then i lowering MIN_VERSION to 8.0.0.0
Code: Select all
BAD
CREATE TABLE mantis_bug_file_table ( id INT IDENTITY(1,1) NOT NULL, bug_id INT DEFAULT 0 NOT NULL, title VARCHAR(250) DEFAULT '' NOT NULL, description VARCHAR(250) DEFAULT '' NOT NULL, diskfile VARCHAR(250) DEFAULT '' NOT NULL, filename VARCHAR(250) DEFAULT '' NOT NULL, folder VARCHAR(250) DEFAULT '' NOT NULL, filesize INT DEFAULT 0 NOT NULL, file_type VARCHAR(250) DEFAULT '' NOT NULL, date_added TIME DEFAULT '1970-01-01T00:00:00' NOT NULL, content IMAGE NULL, PRIMARY KEY (id) )
SQLState: 42000 Error Code: 2715 Message: [Microsoft][SQL Server Native Client 10.0][SQL Server]Column or parameter #10: Cannot find data type TIME.
so we need to change scripting ALTER COLUMN for schema.php and thats all.
as i see in datadict-mssqlnative.inc.php
it supports ALTER COLUMN for 2005 but it doesnt works well.
there is IF.
one direction is what we want
one for default
schema.php always use default
Code: Select all
if (preg_match('/^([^ ]+) .*DEFAULT (\'[^\']+\'|\"[^\"]+\"|[^ ]+)/',$v,$matches)) {
[b]RIGHT[/b]
list(,$colname,$default) = $matches;
$existing = $this->MetaColumns($tabname);
$constraintname = false;
$rs = $this->connection->Execute( "select name from sys.default_constraints WHERE object_name(parent_object_id) = '" . $tabname ."' AND col_name(parent_object_id, parent_column_id) = '" . $colname . "'");
if ( is_object($rs) ) {
$row = $rs->FetchRow();
$constraintname = $row[0];
}
$v = preg_replace('/^' . preg_quote($colname) . '\s/', '', $v);
$t = trim(str_replace('DEFAULT '.$default,'',$v));
if ( $constraintname != false ) {
$sql[] = 'ALTER TABLE '.$tabname.' DROP CONSTRAINT '. $constraintname;
}
$sql[] = $alter . $colname . ' ' . $t ;
if ( $constraintname != false ) {
$sql[] = 'ALTER TABLE '.$tabname.' ADD CONSTRAINT '.$constraintname.' DEFAULT ' . $default . ' FOR ' . $colname;
} else {
$sql[] = 'ALTER TABLE '.$tabname.' ADD CONSTRAINT DF__'. $tabname . '__'. $colname. '__' . dechex(rand()) .' DEFAULT ' . $default . ' FOR ' . $colname;
}
if ($not_null) {
$sql[] = $alter . $colname . ' ' . $t . ' NOT NULL';
}
} else {
if ($not_null) {
[b] WRONG[/b]
$sql[] = $alter . $v . ' NOT NULL';
} else {
$sql[] = $alter . $v;
}
}
LOOK HERE!
in mantis 1.3 in datadict-mssqlnative.inc.php has no SUPPORT for ALTERCOLUMNSL function.
this function is COMMENTED!
Code: Select all
/*
function AlterColumnSQL($tabname, $flds, $tableflds='', $tableoptions='')
{
$tabname = $this->TableName ($tabname);
$sql = array();
list($lines,$pkey) = $this->_GenFields($flds);
foreach($lines as $v) {
$sql[] = "ALTER TABLE $tabname $this->alterCol $v";
}
return $sql;
}
*/
in mantis 1.2 everything is ok about ALTERCOLUMNSSQL function in datadict-mssqlnative.inc.php
i looked in adodb.master repository and there is no support for ALTERCOLUMNSQL too.
Re: SYSTEM NOTICE, Error Description
so i have moved on
the error is
must be
added to mantis 1.3 dropcolumnSQL code from mantis 1.2
have found one error:
there is Nothing after DROP CONSTRAINT because constraint name is DF__mantis_to__times__6F1576F7
it is times not timestamp.
i have delete it from MS SQL Managment studio.
and one more error with table mantis_user_Table
it has index on username column
but deleting indexes not supported or works with errors.
so i manually delete index.
and ! got it installed.
ps:
that was commented in mantis 1.2
in mantis 1.3 its uncommented!
function MetaColumns($table, $upper=true, $schema=false){
# start adg
static $cached_columns = array();
/*if ($this->cachedSchemaFlush)
$cached_columns = array();*/
commented out this IF because no cachedSchemaFlush exists.
the error is
Code: Select all
$constraintname = $row[0];
Code: Select all
$constraintname = $row["name"];
have found one error:
Code: Select all
Schema step 143: DropColumnSQL ( mantis_tokens_table ) BAD
ALTER TABLE mantis_tokens_table DROP CONSTRAINT
ALTER TABLE mantis_tokens_table DROP COLUMN timestamp
SQLState: 42000 Error Code: 102 Message: [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Incorrect syntax near 'CONSTRAINT'.
it is times not timestamp.
i have delete it from MS SQL Managment studio.
and one more error with table mantis_user_Table
it has index on username column
but deleting indexes not supported or works with errors.
so i manually delete index.
and ! got it installed.
ps:
Code: Select all
//if ($ty == 'X' || $ty == 'X2' || $ty == 'B') $fnotnull = false; // some blob types do not accept nulls
//if ($ty == 'X') $fdefault = false;
in mantis 1.3 its uncommented!
function MetaColumns($table, $upper=true, $schema=false){
# start adg
static $cached_columns = array();
/*if ($this->cachedSchemaFlush)
$cached_columns = array();*/
commented out this IF because no cachedSchemaFlush exists.
Re: SYSTEM NOTICE, Error Description
so for clear.
after patching adodb from mantis 1.3
i got only one error on user_table
because adodb cant delete index before alter column.
i did it manualy and got mantis 1.3 installed.
and +
$g_upgrade[196] = array( 'AlterColumnSQL', array( db_get_table( 'user' ), 'username C(255) '. $t_notnull .' DEFAULT " \'\' "' ) );
$g_upgrade[197] = array( 'AlterColumnSQL', array( db_get_table( 'user' ), 'realname C(255) '. $t_notnull .' DEFAULT " \'\' "' ) );
$g_upgrade[198] = array( 'AlterColumnSQL', array( db_get_table( 'user' ), 'password C(64) '. $t_notnull .' DEFAULT " \'\' "' ) );
$g_upgrade[199] = array( 'AlterColumnSQL', array( db_get_table( 'user' ), 'email C(255) '. $t_notnull .' DEFAULT " \'\' "' ) );
after patching adodb from mantis 1.3
i got only one error on user_table
because adodb cant delete index before alter column.
i did it manualy and got mantis 1.3 installed.
and +
$g_upgrade[196] = array( 'AlterColumnSQL', array( db_get_table( 'user' ), 'username C(255) '. $t_notnull .' DEFAULT " \'\' "' ) );
$g_upgrade[197] = array( 'AlterColumnSQL', array( db_get_table( 'user' ), 'realname C(255) '. $t_notnull .' DEFAULT " \'\' "' ) );
$g_upgrade[198] = array( 'AlterColumnSQL', array( db_get_table( 'user' ), 'password C(64) '. $t_notnull .' DEFAULT " \'\' "' ) );
$g_upgrade[199] = array( 'AlterColumnSQL', array( db_get_table( 'user' ), 'email C(255) '. $t_notnull .' DEFAULT " \'\' "' ) );
Re: SYSTEM NOTICE, Error Description
you know this script has the error about MySQLI.dregad wrote:Alexei,
In an attempt to troubleshoot the root cause in the ADOdb library, further info is required. I need you for that, because I don't have MSSQL and the error is not reproducible with MySQL.
Mantis 1.2.19 runs a really outdated version of ADOdb (customized 5.10 IIRC). Can you confirm that you experience the same behavior in MantisBT 1.3.0-rc1 ?
To submit an ADOdb issue I need to make sure that the problem exists in the latest version of the library.
Maybe you can run the following code, either from the MantisBT 1.3 root folder, or even better by downloading the latest code for ADOdb library (https://github.com/ADOdb/ADOdb/archive/master.zip), since there have been a few additional fixes to mssqlnative driver since v5.20.2 which we use in 1.3.0-rc.1.
This should replicate the error you had before. Please confirm whether the error still exists, and provide a full stack trace if it does.Code: Select all
<?php include('library/adodb/adodb.inc.php'); $db = ADONewConnection('mysqli'); $db->connect(hostname, user, password, dbname); // set parameters as appropriate $rs = $db->execute('SELECT f.name, f.type, f.access_level_r, f.default_value, f.type, s.value FROM mantis_custom_field_project_table p INNER JOIN mantis_custom_field_table f ON f.id = p.field_id LEFT JOIN mantis_custom_field_string_table s ON s.field_id = p.field_id AND s.bug_id = ? WHERE p.project_id = ? ORDER BY p.sequence ASC, f.name ASC', array( 11, 1 ) // values here are from your stack trace, use whatever is appropriate );
I suspect the problem is caused by use of associative fetch mode - since there are 2 columns named type, the 2nd is replacing the 1st resulting in an array with 5 elements instead of the 6 that the query expects.