/ Check-in [6a91ab08]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Changes to alter.c to enable full branch coverage testing. (CVS 6513)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 6a91ab08a55eacc77f69190e1126326f4da220af
User & Date: drh 2009-04-16 16:30:18
Context
2009-04-16
16:32
Remove obsolete test from bindxfer.tcl. Ticket #3802. (CVS 6514) check-in: b1b09617 user: drh tags: trunk
16:30
Changes to alter.c to enable full branch coverage testing. (CVS 6513) check-in: 6a91ab08 user: drh tags: trunk
12:58
Make sure the 'unixepoch' converter in the date and time functions rounds to the nearest millisecond rather than truncating downward to the next smaller millisecond. Ticket #3808. (CVS 6512) check-in: e6e036b3 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/alter.c.

     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** This file contains C code routines that used to generate VDBE code
    13     13   ** that implements the ALTER TABLE command.
    14     14   **
    15         -** $Id: alter.c,v 1.56 2009/04/15 13:39:48 drh Exp $
           15  +** $Id: alter.c,v 1.57 2009/04/16 16:30:18 drh Exp $
    16     16   */
    17     17   #include "sqliteInt.h"
    18     18   
    19     19   /*
    20     20   ** The code in this file only exists if we are not omitting the
    21     21   ** ALTER TABLE logic from the build.
    22     22   */
................................................................................
   275    275     const char *zTabName;     /* Original name of the table */
   276    276     Vdbe *v;
   277    277   #ifndef SQLITE_OMIT_TRIGGER
   278    278     char *zWhere = 0;         /* Where clause to locate temp triggers */
   279    279   #endif
   280    280     int isVirtualRename = 0;  /* True if this is a v-table with an xRename() */
   281    281     
   282         -  if( db->mallocFailed ) goto exit_rename_table;
          282  +  if( NEVER(db->mallocFailed) ) goto exit_rename_table;
   283    283     assert( pSrc->nSrc==1 );
   284    284     assert( sqlite3BtreeHoldsAllMutexes(pParse->db) );
   285    285   
   286    286     pTab = sqlite3LocateTable(pParse, 0, pSrc->a[0].zName, pSrc->a[0].zDatabase);
   287    287     if( !pTab ) goto exit_rename_table;
   288    288     iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
   289    289     zDb = db->aDb[iDb].zName;
................................................................................
   508    508       sqlite3ValueFree(pVal);
   509    509     }
   510    510   
   511    511     /* Modify the CREATE TABLE statement. */
   512    512     zCol = sqlite3DbStrNDup(db, (char*)pColDef->z, pColDef->n);
   513    513     if( zCol ){
   514    514       char *zEnd = &zCol[pColDef->n-1];
   515         -    while( (zEnd>zCol && *zEnd==';') || sqlite3Isspace(*zEnd) ){
          515  +    while( zEnd>zCol && (*zEnd==';' || sqlite3Isspace(*zEnd)) ){
   516    516         *zEnd-- = '\0';
   517    517       }
   518    518       sqlite3NestedParse(pParse, 
   519    519           "UPDATE \"%w\".%s SET "
   520    520             "sql = substr(sql,1,%d) || ', ' || %Q || substr(sql,%d) "
   521    521           "WHERE type = 'table' AND name = %Q", 
   522    522         zDb, SCHEMA_TABLE(iDb), pNew->addColOffset, zCol, pNew->addColOffset+1,