Navigation Menu

Skip to content

Commit

Permalink
Fix deletion of default category on MSSQL/Oracle (take 2)
Browse files Browse the repository at this point in the history
Use new config_is_defined() API to check whether the category to delete
is defined as default_category_for_moves, instead of executing a SQL
statement against the config table.

This prevents a type mismatch error on some RDBMS:

- Oracle (ORA-00932: inconsistent data types: expected -, found CLOB)
- MSSQL (Operand type clash: text is incompatible with int.)
- PostgreSQL (unconfirmed)

Fixes #16384
  • Loading branch information
dregad committed Mar 27, 2016
1 parent 8762282 commit ee223f3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions manage_proj_cat_delete.php
Expand Up @@ -67,9 +67,9 @@

# Protect the 'default category for moves' from deletion
$t_default_category_id = config_get( 'default_category_for_moves', /* default */ null, ALL_USERS, ALL_PROJECTS );
$t_query = 'SELECT count(config_id) FROM {config} WHERE config_id = ' . db_param() . ' AND value = ' . db_param();
$t_default_cat_count = db_result( db_query( $t_query, array( 'default_category_for_moves', (string)$f_category_id ) ) );
if( $t_default_cat_count > 0 || $f_category_id == $t_default_category_id ) {
if( $f_category_id == $t_default_category_id
|| config_is_defined( 'default_category_for_moves', $f_category_id )
) {
trigger_error( ERROR_CATEGORY_CANNOT_DELETE_DEFAULT, ERROR );
}

Expand Down

0 comments on commit ee223f3

Please sign in to comment.