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

Better logic for altering field on SqliteWriter class

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    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

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            freelancecode Suwandi Tanuwijaya

            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

                Slack

                  Issue deployment