function db_delta() can't handle floats or decimals

Bug #526380 reported by Yabs
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Quam Plures
Fix Released
Low
Yabs
b2evolution
Triaged
Medium
Unassigned
Whissip
Fix Released
Undecided
Daniel Hahler

Bug Description

Function db_delta() [ /inc/_core/model/db/_upgrade.funcs.php ] always sees float and decimal as having changed.

Changing line 641 to the following *appears* to cure it, but hardly tested :

$matches_pattern = '~^'.preg_replace( '~\((\d+)\)~', '(\(\d+\))?', preg_quote(preg_replace( '~^decimal~i', 'DEC', $tablefield->Type )) ).'$~i';

¥

Related branches

Revision history for this message
Daniel Hahler (blueyed) wrote :

I can look into this.
After all, there are a lot of tests and you could easily add another one.

Revision history for this message
Daniel Hahler (blueyed) wrote :

Please provide a CREATE TABLE statement, which gets as detected as being different always.

Revision history for this message
Yabs (yabs) wrote :

Hi Blueyed,

The following plugin table is how I found it :

[code]
 function GetDbLayout()
 {
  $layout = array( 'CREATE TABLE IF NOT EXISTS '.$this->get_sql_table( 'inventory' ).' (
    inv_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
    inv_shop_ID INT(10) UNSIGNED NOT NULL,
    inv_sku VARCHAR(255) NOT NULL,
    inv_price Float(10,2) NOT NULL,
    inv_weight DECIMAL(10,4) NOT NULL,
    inv_stock INT(10) UNSIGNED NULL,
    inv_created DATETIME NOT NULL,
    inv_updated DATETIME NOT NULL,
    PRIMARY KEY (inv_ID),
    KEY inv_sku (inv_sku),
    KEY inv_shop_ID (inv_shop_ID)
    )',
[/code]

Thanks for looking into it :D

¥

Daniel Hahler (blueyed)
Changed in quam-plures:
assignee: nobody → Daniel Hahler (blueyed)
Changed in b2evolution:
assignee: nobody → Daniel Hahler (blueyed)
importance: Undecided → Medium
status: New → Triaged
milestone: none → whissip-first-release
Revision history for this message
Yabs (yabs) wrote :

Hi Daniel,
Great you're looking into this, would be nice to fix it in time for 0.0.0 release ;)

¥

Changed in quam-plures:
milestone: none → 0.0.0
status: New → Triaged
Revision history for this message
Daniel Hahler (blueyed) wrote :
Changed in quam-plures:
assignee: Daniel Hahler (blueyed) → nobody
Changed in b2evolution:
assignee: Daniel Hahler (blueyed) → nobody
Revision history for this message
Yabs (yabs) wrote :

Cheers blueyed ;)

¥

Changed in quam-plures:
assignee: nobody → Yabs (yabs)
Daniel Hahler (blueyed)
Changed in b2evolution:
milestone: whissip-first-release → none
Yabs (yabs)
Changed in quam-plures:
status: Triaged → Fix Committed
EdB (edb)
Changed in quam-plures:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.