tel8618217223380 / prado3

Automatically exported from code.google.com/p/prado3
Other
0 stars 0 forks source link

Bad prasing of MySQL ENUM type column. #191

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Retrieving information about enum field values.

What is the expected output? What do you see instead?
By example:
1) We have a database:
CREATE TABLE `test` (
`tstId` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`tstField` ENUM( 'sth with spaces', 'sth more' ) NOT NULL
) ENGINE = MYISAM ;

2) We want to get possible 'tstField' values with, so defined 'getENUMValues':

<?php
/**
 * Auto generated by prado-cli.php on 2009-07-15 09:51:26.
 */
class TestRecord extends TActiveRecord
{
    const TABLE='test';

    public $tstId;
    public $tstField;

    public static function finder($className=__CLASS__)
    {
        return parent::finder($className);
    }

    /**
     * Retrieves list of valid ENUM field values.
     *
     * @param string $field Name of the field
     * @return array<string> List of valid ENUM field values.
     */
    protected function getENUMValues($field) {
        $dbTableInfo = $this->getRecordTableInfo();
        $column = $dbTableInfo->getColumn($field);
        var_dump($column->getDbTypeValues());
        return $column->getDbTypeValues();
    }

    public function getFieldValues() {
        return $this->getENUMValues('tstField');
    }
}
?>

3) Instead of:
array('sth with spaces', 'sth more')

I get ('var_dump' output):
array(5) { [0]=>  string(3) "sth" [1]=>  string(4) "with" [2]=>  string(6)
"spaces" [3]=>  string(3) "sth" [4]=>  string(4) "more" } )

What version of the product are you using? On what operating system?
PRADO 3.2-dev, Windows XP

Please provide any additional information below.
Thanks for you work. I think PRADO is a very good framework.

Regards,
Jan Rybka

Original issue reported on code.google.com by jan.ry...@gmail.com on 15 Jul 2009 at 2:17

GoogleCodeExporter commented 9 years ago
> What version of the product are you using? On what operating system?
> PRADO 3.2-dev, Windows XP
AFAIK the 3.2-dev branch you see on the Source tab is a misleading/outdated 
one, and 
isn't the real 3.2 branch. At least the latest timestamps in that branch are 
from 
like two years ago. The same goes for a lot of other branches in that view. 
Maybe 
they should be removed or renamed by the developers.

I'm just telling this because your bug report might be invalid for the current 
version of Prado. Maybe you should check it with Prado/3.1.5 too.

Original comment by google...@pcforum.hu on 19 Jul 2009 at 8:43

GoogleCodeExporter commented 9 years ago
Move to 3.1.7

Original comment by Christophe.Boulain@gmail.com on 22 Jul 2009 at 8:15

GoogleCodeExporter commented 9 years ago
I've checked with 
PRADO framework v3.1.5 (stable)

still the same problem. Hope that in 3.1.7 it will be solved out.

Regards,
Jan Rybka

Original comment by jan.ry...@gmail.com on 22 Jul 2009 at 12:04

GoogleCodeExporter commented 9 years ago
3.2 Will certainly fix this issue (since A/R are now the same than in Yii, see 
the
Testing namespace in trunk), but we'll try to fix this in 3.1.7

Original comment by Christophe.Boulain@gmail.com on 22 Jul 2009 at 3:12

GoogleCodeExporter commented 9 years ago
Thank you very much :-)

Original comment by jan.ry...@gmail.com on 23 Jul 2009 at 9:15

GoogleCodeExporter commented 9 years ago
Fixed

Original comment by GODZilla...@gmail.com on 8 Nov 2009 at 10:56