SQLite

Check-in [e74f8dc436]
Login

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

Overview
Comment:Make sure the target register is allocated before adding the bogus OP_Variable opcode in isLikeOrGlob(). Bugfix for the new sqlite3_reoptimize() logic.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e74f8dc436213b7ef754adcab5ef7554d774474c
User & Date: drh 2009-10-17 13:13:02.000
Context
2009-10-17
14:19
Fix a problem in the icu.test script. (check-in: 8a21fdaf6a user: dan tags: trunk)
13:13
Make sure the target register is allocated before adding the bogus OP_Variable opcode in isLikeOrGlob(). Bugfix for the new sqlite3_reoptimize() logic. (check-in: e74f8dc436 user: drh tags: trunk)
08:26
Add documentation comment for new experimental API sqlite3_reoptimize(). (check-in: c48f8ffedc user: dan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/where.c.
691
692
693
694
695
696
697
698


699
700

701
702
703
704
705
706
707
        Vdbe *v = pParse->pVdbe;
        sqlite3VdbeSetVarmask(v, pRight->iColumn, 1);
        if( *pisComplete && pRight->u.zToken[1] ){
          /* If the rhs of the LIKE expression is a variable, and the current
          ** value of the variable means there is no need to invoke the LIKE
          ** function, then no OP_Variable will be added to the program.
          ** This causes problems for the sqlite3_bind_parameter_name()
          ** API. To workaround them, add a dummy OP_Variable here.  */ 


          sqlite3ExprCodeTarget(pParse, pRight, 1);
          sqlite3VdbeChangeP3(v, sqlite3VdbeCurrentAddr(v)-1, 0);

        }
      }
    }else{
      z = 0;
    }
  }








|
>
>
|

>







691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
        Vdbe *v = pParse->pVdbe;
        sqlite3VdbeSetVarmask(v, pRight->iColumn, 1);
        if( *pisComplete && pRight->u.zToken[1] ){
          /* If the rhs of the LIKE expression is a variable, and the current
          ** value of the variable means there is no need to invoke the LIKE
          ** function, then no OP_Variable will be added to the program.
          ** This causes problems for the sqlite3_bind_parameter_name()
          ** API. To workaround them, add a dummy OP_Variable here.
          */ 
          int r1 = sqlite3GetTempReg(pParse);
          sqlite3ExprCodeTarget(pParse, pRight, r1);
          sqlite3VdbeChangeP3(v, sqlite3VdbeCurrentAddr(v)-1, 0);
          sqlite3ReleaseTempReg(pParse, r1);
        }
      }
    }else{
      z = 0;
    }
  }