Better logic for altering field on SqliteWriter class
-----------------------------------------------------

                 Key: ZETACOMP-111
                 URL: https://issues.apache.org/jira/browse/ZETACOMP-111
             Project: Zeta Components
          Issue Type: Improvement
          Components: DatabaseSchema
         Environment: Ubuntu Natty
PHP 5.3.6
Sqlite
            Reporter: Suwandi Tanuwijaya
            Priority: Minor


Hi,

Just improvement for altering field from create temporary and filled it with 
just, rename it.

Here is the code for the improvement on dropField() and changeField() method on 
ezcDbSchemaSqliteWriter class:

dropField() and changeField method
{{{
     ....
            $tmpTableCreateSql = 'ALTER TABLE \''.$tableName.'\' RENAME TO 
\''.$tmpTableName.'\';';
            $newTableCreateSql = 'CREATE TABLE \''.$tableName.'\' ( '.$fields.' 
);';
            
            if( count( $fieldList ) > 0 )
            {
                $db->exec( $tmpTableCreateSql );
                $db->exec( $newTableCreateSql );
                $db->exec( 'INSERT INTO \''.$tableName.'\' SELECT '.implode( ', 
', $fieldList ).' FROM \''.$tmpTableName.'\';' );
                $db->exec( 'DROP TABLE \''.$tmpTableName.'\';' );
            }
            
            // and so on
    ...
}}}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to