View Issue Details

IDProjectCategoryView StatusLast Update
0022904mantisbtdb mssqlpublic2017-06-04 14:58
Reporterobmsch Assigned Todregad  
Status closedResolutionfixed 
Product Version2.4.0 
Target Version2.5.0Fixed in Version2.5.0 
Summary0022904: database_api: db_insert_id returns string not int (mssql)

At least with mssql, might be true for postgres and oracle as well (can't test),
db_insert_id doesn't comply to the api doc, and returns a string not an integer.

TagsNo tags attached.




2017-05-20 04:48

reporter   ~0056912

I was looking at _query(mssqlnative), how parameters are passed to the sqldriver, adding bug notes to check.
The newly generated bugnote_text_id is passed as string to the following insert into bugnote.

Although saved in the db as int (implicit conversion at some point), db_insert_id should comply with the doc
and 'return (int)db_result(...)'.



2017-05-20 07:31

developer   ~0056916




2017-05-22 03:44

reporter   ~0056938

@dregad Thanks, nice cleanup. Works for me (mantisbt-2.5.0-dev-master-6f7ea15, mssql).

Related Changesets

MantisBT: master d3d5ddcf

2017-05-20 05:31:40


Details Diff
Make sure db_insert_id() always returns an int

db_result() returns a string in some cases. Typecasting the return
value to int ensures we comply with the PHPDoc.

Fixes 0022904
Affected Issues
mod - core/database_api.php Diff File

Issue History

Date Modified Username Field Change
2017-05-20 04:47 obmsch New Issue
2017-05-20 04:48 obmsch Note Added: 0056912
2017-05-20 07:31 dregad Assigned To => dregad
2017-05-20 07:31 dregad Status new => assigned
2017-05-20 07:31 dregad Note Added: 0056916
2017-05-22 03:44 obmsch Note Added: 0056938
2017-05-28 05:25 dregad Changeset attached => MantisBT master d3d5ddcf
2017-05-28 05:25 dregad Status assigned => resolved
2017-05-28 05:25 dregad Resolution open => fixed
2017-05-28 05:25 dregad Fixed in Version => 2.5.0
2017-05-28 05:29 atrol Target Version => 2.5.0
2017-06-04 14:58 vboctor Status resolved => closed