function db_delta() can't handle floats or decimals

Bug #526380 reported by Yabs on 2010-02-23
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Quam Plures
Fix Released
Low
Yabs
b2evolution
Medium
Unassigned
Whissip
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

Daniel Hahler (blueyed) wrote :

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

Daniel Hahler (blueyed) wrote :

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

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) on 2010-05-15
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
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
Daniel Hahler (blueyed) wrote :
Changed in quam-plures:
assignee: Daniel Hahler (blueyed) → nobody
Changed in b2evolution:
assignee: Daniel Hahler (blueyed) → nobody
Yabs (yabs) wrote :

Cheers blueyed ;)

¥

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

Other bug subscribers