View Issue Details

IDProjectCategoryView StatusLast Update
0022904mantisbtdb mssqlpublic2017-06-04 14:58
Reporterobmsch Assigned Todregad  
PrioritynormalSeverityminorReproducibilityalways
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)
Description

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.

Activities

obmsch

obmsch

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(...)'.

dregad

dregad

2017-05-20 07:31

developer   ~0056916

PR https://github.com/mantisbt/mantisbt/pull/1111

obmsch

obmsch

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 01:31

dregad


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
0022904
mod - core/database_api.php Diff File