FYI: http://www.sqlite.org/src/info/150592b4b4.

Pavel


On Thu, Oct 13, 2011 at 10:34 AM, Black, Michael (IS)
<[email protected]> wrote:
> Or rather user UpperToLower...I just found that one...
>
>
>
>
>
> if( UpperToLower(zLeft[0])=='p' ){
>
>
>
> Michael D. Black
>
> Senior Scientist
>
> NG Information Systems
>
> Advanced Analytics Directorate
>
>
>
> ________________________________
> From: [email protected] [[email protected]] on 
> behalf of Black, Michael (IS) [[email protected]]
> Sent: Thursday, October 13, 2011 9:30 AM
> To: [email protected]; General Discussion of SQLite Database
> Subject: EXT :Re: [sqlite] pragma PAGE_COUNT != pragma page_count
>
> Easy fix me thinkst...this section was only check for lower-case 'p' -- 
> otherwise returning MaxPgCnt.
>
> so pAGECOUNT works OK.  Just add the tolower()...
>
>
>
>  if( sqlite3StrICmp(zLeft,"page_count")==0
>   || sqlite3StrICmp(zLeft,"max_page_count")==0
>  ){
>    int iReg;
>    if( sqlite3ReadSchema(pParse) ) goto pragma_out;
>    sqlite3CodeVerifySchema(pParse, iDb);
>    iReg = ++pParse->nMem;
>    if( tolower(zLeft[0])=='p' ){
>      sqlite3VdbeAddOp2(v, OP_Pagecount, iDb, iReg);
>    }else{
>      sqlite3VdbeAddOp3(v, OP_MaxPgcnt, iDb, iReg, sqlite3Atoi(zRight));
>    }
>    sqlite3VdbeAddOp2(v, OP_ResultRow, iRe
>
>
>
> Michael D. Black
>
> Senior Scientist
>
> NG Information Systems
>
> Advanced Analytics Directorate
>
>
>
> ________________________________
> From: [email protected] [[email protected]] on 
> behalf of Marshall Cline [[email protected]]
> Sent: Thursday, October 13, 2011 9:21 AM
> To: [email protected]
> Subject: EXT :[sqlite] pragma PAGE_COUNT != pragma page_count
>
> Symptoms: "pragma page_count" returns the correct number of pages, but
> "pragma PAGE_COUNT" always returns 1073741823:
>
>
>
> % sqlite3 sample.db
>
> SQLite version 3.7.8 2011-09-19 14:49:19
>
> Enter ".help" for instructions
>
> Enter SQL statements terminated with a ";"
>
> sqlite> pragma page_count;
>
> 3
>
> sqlite> pragma PAGE_COUNT;
>
> 1073741823
>
>
>
>
>
> Cause: in the code below, the line "if( zLeft[0]=='p' ){" does a
> case-sensitive comparison - if the first letter isn't lower-case 'p', the
> code assumes the pragma must be max_page_count.
>
>
>
>  /*
>
>  **  PRAGMA [database.]max_page_count
>
>  **  PRAGMA [database.]max_page_count=N
>
>  **
>
>  ** The first form reports the current setting for the
>
>  ** maximum number of pages in the database file.  The
>
>  ** second form attempts to change this setting.  Both
>
>  ** forms return the current setting.
>
>  **
>
>  **  PRAGMA [database.]page_count
>
>  **
>
>  ** Return the number of pages in the specified database.
>
>  */
>
>  if( sqlite3StrICmp(zLeft,"page_count")==0
>
>   || sqlite3StrICmp(zLeft,"max_page_count")==0
>
>  ){
>
>    int iReg;
>
>    if( sqlite3ReadSchema(pParse) ) goto pragma_out;
>
>    sqlite3CodeVerifySchema(pParse, iDb);
>
>    iReg = ++pParse->nMem;
>
>    if( zLeft[0]=='p' ){
>
>      sqlite3VdbeAddOp2(v, OP_Pagecount, iDb, iReg);
>
>    }else{
>
>      sqlite3VdbeAddOp3(v, OP_MaxPgcnt, iDb, iReg, sqlite3Atoi(zRight));
>
>    }
>
>    sqlite3VdbeAddOp2(v, OP_ResultRow, iReg, 1);
>
>    sqlite3VdbeSetNumCols(v, 1);
>
>    sqlite3VdbeSetColName(v, 0, COLNAME_NAME, zLeft, SQLITE_TRANSIENT);
>
>  }else
>
>
>
>
>
> Thank you,
>
> Marshall
>
>
>
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to