/ Check-in [8bb9f970]
Login

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

Overview
Comment:Add OP_MemSet, for setting a memory cell to a string value. (CVS 4674)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8bb9f970dd71cbf19e45774fc822aa1efebc1724
User & Date: danielk1977 2008-01-04 11:01:04
Context
2008-01-04
13:24
Modify the code generated for a DELETE to use registers instead of the vdbe stack. (CVS 4675) check-in: 173f2813 user: danielk1977 tags: trunk
11:01
Add OP_MemSet, for setting a memory cell to a string value. (CVS 4674) check-in: 8bb9f970 user: danielk1977 tags: trunk
2008-01-03
23:44
Change the sqlite3ExprCode() function so that callers can request that the result of the expression be left on the stack or in a register. (CVS 4673) check-in: 61bfb77c user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/alter.c.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
...
358
359
360
361
362
363
364
365


366
367
368
369
370
371
372
373
374
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains C code routines that used to generate VDBE code
** that implements the ALTER TABLE command.
**
** $Id: alter.c,v 1.37 2008/01/03 18:39:42 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>

/*
** The code in this file only exists if we are not omitting the
** ALTER TABLE logic from the build.
................................................................................
  /* If this is a virtual table, invoke the xRename() function if
  ** one is defined. The xRename() callback will modify the names
  ** of any resources used by the v-table implementation (including other
  ** SQLite tables) that are identified by the name of the virtual table.
  */
#ifndef SQLITE_OMIT_VIRTUALTABLE
  if( isVirtualRename ){
    int i;


    sqlite3VdbeAddOp4(v, OP_String8, 0, 0, 0, zName, 0);
    i = sqlite3StackToReg(pParse, 1);
    sqlite3VdbeAddOp4(v, OP_VRename, i, 0, 0,(const char*)pTab->pVtab, P4_VTAB);
  }
#endif

  /* figure out how many UTF-8 characters are in zName */
  zTabName = pTab->zName;
  nTabName = sqlite3Utf8CharLen(zTabName, -1);







|







 







|
>
>
|
<







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
...
358
359
360
361
362
363
364
365
366
367
368

369
370
371
372
373
374
375
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains C code routines that used to generate VDBE code
** that implements the ALTER TABLE command.
**
** $Id: alter.c,v 1.38 2008/01/04 11:01:04 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>

/*
** The code in this file only exists if we are not omitting the
** ALTER TABLE logic from the build.
................................................................................
  /* If this is a virtual table, invoke the xRename() function if
  ** one is defined. The xRename() callback will modify the names
  ** of any resources used by the v-table implementation (including other
  ** SQLite tables) that are identified by the name of the virtual table.
  */
#ifndef SQLITE_OMIT_VIRTUALTABLE
  if( isVirtualRename ){
    int i = ++pParse->nMem;
    sqlite3_value *pVal = sqlite3ValueNew(db);
    sqlite3ValueSetStr(pVal, -1, zName, SQLITE_UTF8, SQLITE_TRANSIENT);
    sqlite3VdbeAddOp4(v, OP_MemSet, i, 0, 0, (char *)pVal, P4_MEM);

    sqlite3VdbeAddOp4(v, OP_VRename, i, 0, 0,(const char*)pTab->pVtab, P4_VTAB);
  }
#endif

  /* figure out how many UTF-8 characters are in zName */
  zTabName = pTab->zName;
  nTabName = sqlite3Utf8CharLen(zTabName, -1);

Changes to src/vdbe.c.

39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
....
4761
4762
4763
4764
4765
4766
4767












4768
4769
4770
4771
4772
4773
4774
**
** Various scripts scan this source file in order to generate HTML
** documentation, headers files, or other derived files.  The formatting
** of the code in this file is, therefore, important.  See other comments
** in this file for details.  If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code.
**
** $Id: vdbe.c,v 1.673 2008/01/03 18:44:59 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
#include "vdbeInt.h"

/*
** The following global variable is incremented every time a cursor
................................................................................
*/
case OP_MemMove: {
  assert( pOp->p1>0 && pOp->p1<=p->nMem );
  assert( pOp->p2>0 && pOp->p2<=p->nMem );
  rc = sqlite3VdbeMemMove(&p->aMem[pOp->p1], &p->aMem[pOp->p2]);
  break;
}













/* Opcode: AggStep P1 P2 P4
**
** Execute the step function for an aggregate.  The
** function has P2 arguments.  P4 is a pointer to the FuncDef
** structure that specifies the function.  Use memory location
** P1 as the accumulator.







|







 







>
>
>
>
>
>
>
>
>
>
>
>







39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
....
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
**
** Various scripts scan this source file in order to generate HTML
** documentation, headers files, or other derived files.  The formatting
** of the code in this file is, therefore, important.  See other comments
** in this file for details.  If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code.
**
** $Id: vdbe.c,v 1.674 2008/01/04 11:01:04 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
#include "vdbeInt.h"

/*
** The following global variable is incremented every time a cursor
................................................................................
*/
case OP_MemMove: {
  assert( pOp->p1>0 && pOp->p1<=p->nMem );
  assert( pOp->p2>0 && pOp->p2<=p->nMem );
  rc = sqlite3VdbeMemMove(&p->aMem[pOp->p1], &p->aMem[pOp->p2]);
  break;
}

/* Opcode: MemSet P1 * * P4
**
** The P4 should be set to contain a P4_MEM value. The value is copied
** to memory cell P1.
*/
case OP_MemSet: {
  assert( pOp->p1>0 && pOp->p1<=p->nMem );
  assert( pOp->p4type==P4_MEM );
  rc = sqlite3VdbeMemCopy(&p->aMem[pOp->p1], pOp->p4.pMem);
  break;
}

/* Opcode: AggStep P1 P2 P4
**
** Execute the step function for an aggregate.  The
** function has P2 arguments.  P4 is a pointer to the FuncDef
** structure that specifies the function.  Use memory location
** P1 as the accumulator.