SQLite

Check-in [e97d7d3044]
Login

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

Overview
Comment:Make sure the correct printf format is used for type tRowcnt regardless of whether 32-bit or 64-bit row counts are specified at compile-time.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | row-size-est
Files: files | file ages | folders
SHA1: e97d7d3044aa6c5e21d1faab7d5e709d92faa261
User & Date: drh 2013-10-09 19:07:22.896
Context
2013-10-10
12:38
Estimate row sizes for tables and indices and use those estimates during query planning. Enhance the index_info pragma to show the estimated row sizes and to show the estimated row size for the main table as well. Allow an alternative row size estimate to be specified in the sqlite_stat1 table. (check-in: d27b88b8c2 user: drh tags: trunk)
2013-10-09
19:07
Make sure the correct printf format is used for type tRowcnt regardless of whether 32-bit or 64-bit row counts are specified at compile-time. (Closed-Leaf check-in: e97d7d3044 user: drh tags: row-size-est)
2013-10-08
23:16
Move a conditional inside of an #ifdef in order to make all branches reachable regardless of compile-time options used. (check-in: f7cc30d45b user: drh tags: row-size-est)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/analyze.c.
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758

    char *zRet = sqlite3MallocZero(p->nCol * 25);
    if( zRet==0 ){
      sqlite3_result_error_nomem(context);
      return;
    }

    sqlite3_snprintf(24, zRet, "%lld", p->nRow);
    z = zRet + sqlite3Strlen30(zRet);
    for(i=0; i<(p->nCol-1); i++){
      i64 nDistinct = p->current.anDLt[i] + 1;
      i64 iVal = (p->nRow + nDistinct - 1) / nDistinct;
      sqlite3_snprintf(24, z, " %lld", iVal);
      z += sqlite3Strlen30(z);
      assert( p->current.anEq[i] );
    }
    assert( z[0]=='\0' && z>zRet );

    sqlite3_result_text(context, zRet, -1, sqlite3_free);
  }







|


|
|
|







739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758

    char *zRet = sqlite3MallocZero(p->nCol * 25);
    if( zRet==0 ){
      sqlite3_result_error_nomem(context);
      return;
    }

    sqlite3_snprintf(24, zRet, "%llu", (u64)p->nRow);
    z = zRet + sqlite3Strlen30(zRet);
    for(i=0; i<(p->nCol-1); i++){
      u64 nDistinct = p->current.anDLt[i] + 1;
      u64 iVal = (p->nRow + nDistinct - 1) / nDistinct;
      sqlite3_snprintf(24, z, " %llu", iVal);
      z += sqlite3Strlen30(z);
      assert( p->current.anEq[i] );
    }
    assert( z[0]=='\0' && z>zRet );

    sqlite3_result_text(context, zRet, -1, sqlite3_free);
  }
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
      char *zRet = sqlite3MallocZero(p->nCol * 25);
      if( zRet==0 ){
        sqlite3_result_error_nomem(context);
      }else{
        int i;
        char *z = zRet;
        for(i=0; i<p->nCol; i++){
          sqlite3_snprintf(24, z, "%lld ", aCnt[i]);
          z += sqlite3Strlen30(z);
        }
        assert( z[0]=='\0' && z>zRet );
        z[-1] = '\0';
        sqlite3_result_text(context, zRet, -1, sqlite3_free);
      }
    }







|







785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
      char *zRet = sqlite3MallocZero(p->nCol * 25);
      if( zRet==0 ){
        sqlite3_result_error_nomem(context);
      }else{
        int i;
        char *z = zRet;
        for(i=0; i<p->nCol; i++){
          sqlite3_snprintf(24, z, "%llu ", (u64)aCnt[i]);
          z += sqlite3Strlen30(z);
        }
        assert( z[0]=='\0' && z>zRet );
        z[-1] = '\0';
        sqlite3_result_text(context, zRet, -1, sqlite3_free);
      }
    }