Uploaded image for project: 'Zeta Components'
  1. Zeta Components
  2. ZETACOMP-111

Better logic for altering field on SqliteWriter class

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • DatabaseSchema
    • Ubuntu Natty
      PHP 5.3.6
      Sqlite

    Description

      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
      ...
      }}}

      Attachments

        Activity

          People

            Unassigned Unassigned
            freelancecode Suwandi Tanuwijaya
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - 0.25h
                0.25h
                Remaining:
                Remaining Estimate - 0.25h
                0.25h
                Logged:
                Time Spent - Not Specified
                Not Specified