/ Check-in [25acd965]
Login

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

Overview
Comment:Fix the exprCompareVariable() routine so that it works for non-UTF8 text.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | partial-index-variables
Files: files | file ages | folders
SHA3-256: 25acd9658be792d686b3ebfaa8c3692f9830e043538ed0afecf97110a07758a4
User & Date: drh 2017-06-29 01:23:12
Context
2017-06-29
12:59
The query planner examines the values of bound parameters to help determine if a partial index is usable. Reprepares may happen if the bindings change. This behavior is disabled by the QPSG setting. check-in: c322bfa2 user: drh tags: trunk
01:23
Fix the exprCompareVariable() routine so that it works for non-UTF8 text. Closed-Leaf check-in: 25acd965 user: drh tags: partial-index-variables
2017-06-28
21:47
Alternative implementation of exprCompareVariable(). check-in: b959c629 user: drh tags: partial-index-variables
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/expr.c.

4679
4680
4681
4682
4683
4684
4685




4686
4687
4688
4689
4690
4691
4692
4693
4694
  sqlite3_value *pL, *pR = 0;
  
  sqlite3ValueFromExpr(pParse->db, pExpr, SQLITE_UTF8, SQLITE_AFF_BLOB, &pR);
  if( pR ){
    iVar = pVar->iColumn;
    sqlite3VdbeSetVarmask(pParse->pVdbe, iVar);
    pL = sqlite3VdbeGetBoundValue(pParse->pReprepare, iVar, SQLITE_AFF_BLOB);




    if( pL && 0==sqlite3MemCompare(pL, pR, 0) ){
      res = 1;
    }
    sqlite3ValueFree(pR);
    sqlite3ValueFree(pL);
  }

  return res;
}







>
>
>
>
|
<







4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690

4691
4692
4693
4694
4695
4696
4697
  sqlite3_value *pL, *pR = 0;
  
  sqlite3ValueFromExpr(pParse->db, pExpr, SQLITE_UTF8, SQLITE_AFF_BLOB, &pR);
  if( pR ){
    iVar = pVar->iColumn;
    sqlite3VdbeSetVarmask(pParse->pVdbe, iVar);
    pL = sqlite3VdbeGetBoundValue(pParse->pReprepare, iVar, SQLITE_AFF_BLOB);
    if( pL ){
      if( sqlite3_value_type(pL)==SQLITE_TEXT ){
        sqlite3_value_text(pL); /* Make sure the encoding is UTF-8 */
      }
      res =  0==sqlite3MemCompare(pL, pR, 0);

    }
    sqlite3ValueFree(pR);
    sqlite3ValueFree(pL);
  }

  return res;
}