#010161: Don't force lowercase columnNames

Description:

Column names are directly mapped to model properties by the PODBTieIn. As many people like to write "lastModified" instead of "lastmodified" for a property, you shouldn't force lowercase for columnNames.

So please delete Database/src/handler.php#90:
$this->setAttribute( PDO::ATTR_CASE, PDO::CASE_LOWER );

Or at least write a big WARNING in the docs!


Environment:

Operating System:
PHP Version: (please be specific, like '4.4.3' or '5.1.5')
Database and version:
Browser (and version):


- Attachments

No attachments for this issue.


- Comments

Thx to Kore, who explained me, that forcing lowercase on columnnames is due to restrictions of some RDBMS, which support only lowercase. So my proposal for this issue is:

1. Document it!
2. Add an option to DatabaseSchema so that you can write lowercase columns from camelCase Schema-def files.
3. Add an option to PODBSTieIn to write PO-DefFiles with camelCase-attributenames, but lowercase columnnames. I already wondered, why the PO-def is so verbose. This could be an application.

#251557 by Thomas Koch on February 4th, 2007 [Permanent Link]

Some more information:


Notice: Undefined index: strprogram in D:
\web\mpwebinterface\ezcomponents-2007.1\PersistentObject\src\internal\state_transformer.php 
on line 49

Notice: Trying to get property of non-object in D:
\web\mpwebinterface\ezcomponents-2007.1\PersistentObject\src\internal\state_transformer.php 
on line 49

Fatal error: Cannot access empty property in D:
\web\mpwebinterface\kernel\PersistentObject\recorded.php on line 39

SQLite Schema:


sqlite> .schema recorded
CREATE TABLE recorded ( idRecorded integer primary key, idChannel integer, 
                        idGenre integer, strProgram text, iStartTime integer, 
                        iEndTime integer, strDescription text, strFileName 
text,
                        iPlayed integer, idCard integer, keepMethod Integer, 
keepDate text);

  1. PersistentObject definition (auto generated):

$def->idProperty               = new ezcPersistentObjectIdProperty();
$def->idProperty->columnName   = 'idRecorded';
$def->idProperty->propertyName = 'idRecorded';
$def->idProperty->generator    = new 
ezcPersistentGeneratorDefinition( 'ezcPersistentSequenceGenerator' );

$def->properties['iEndTime']               = new 
ezcPersistentObjectProperty();
$def->properties['iEndTime']->columnName   = 'iEndTime';
$def->properties['iEndTime']->propertyName = 'iEndTime';
$def->properties['iEndTime']->propertyType = 
ezcPersistentObjectProperty::PHP_TYPE_INT;
  1. Manual fix:

$def->idProperty               = new ezcPersistentObjectIdProperty();
$def->idProperty->columnName   = 'idrecorded';
$def->idProperty->propertyName = 'idRecorded';
$def->idProperty->generator    = new 
ezcPersistentGeneratorDefinition( 'ezcPersistentSequenceGenerator' );
  1. Recored.php

getState() is never run, tested with die()


class Recorded
{
    private $idRecorded = null;
    public $idChannel = null;
    public $idGenre = null;
    public $strProgram = null;
    public $iStartTime = null;
    public $iEndTime = null;
    public $strDescription = null;
    public $strFileName = null;
    public $iPlayed = null;
    public $idCard = null;
    public $keepMethod = null;
    public $keepDate = null;

    public function getState()
    {
        $result = array();
        $result['idRecorded'] = $this->idRecording;
        $result['idChannel'] = $this->idChannel;
        $result['idGenre'] = $this->idGenre;
        $result['strProgram'] = $this->strProgram;
#253181 by Derick Rethans on August 1st, 2007 [Permanent Link]

Documented since revision #7105.

Converting the column names in DatabaseSchema may also result in inconsistencies. Imagin the following:

- Write a DS file.
- Write it into the database.
- Generate a DS file from database.

The two files would differ in column names now, so that you would also have to add some table name mapping for reading. If you still want this, please open enhancement requests for this, or discuss it on the mailing list.

#255360 by Kore Nordmann on January 8th, 2008 [Permanent Link]

- History
Properties
Type Bug
Priority Medium
Component Components » Database
Affects Unknown
Fix Version -
Reporter Thomas Koch
Responsible Kore Nordmann
Status 0 Closed
Resolution Fixed
Created February 2nd, 2007
Updated January 8th, 2008
Resolved January 8th, 2008
 
Navigation [Permanent Link]
Previous Issue
Back to Issues List
Next Issue: #015537
  Graph shows to small and truncated rotated axis labels