/ Check-in [76e0b749]
Login

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

Overview
Comment:Fix TRACE7 in os_common.h. (CVS 1765)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 76e0b74961af3ff285757ac428b82fe7eaffc025
User & Date: drh 2004-06-29 13:54:50
Context
2004-06-29
14:03
Fix capi3.test so that it works with production (as well as debugging ) builds. (CVS 1766) check-in: 9cf371d8 user: danielk1977 tags: trunk
13:54
Fix TRACE7 in os_common.h. (CVS 1765) check-in: 76e0b749 user: drh tags: trunk
13:41
Ensure the tcl interface returns an error when sqlite3_create_function() fails. (CVS 1764) check-in: 357a82cd user: danielk1977 tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/os_common.h.

52
53
54
55
56
57
58

59
60
61
62
63
64
65
#define SEEK(X)
#define TRACE1(X)
#define TRACE2(X,Y)
#define TRACE3(X,Y,Z)
#define TRACE4(X,Y,Z,A)
#define TRACE5(X,Y,Z,A,B)
#define TRACE6(X,Y,Z,A,B,C)

#endif


/*
** If we compile with the SQLITE_TEST macro set, then the following block
** of code will give us the ability to simulate a disk I/O error.  This
** is used for testing the I/O recovery logic.







>







52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#define SEEK(X)
#define TRACE1(X)
#define TRACE2(X,Y)
#define TRACE3(X,Y,Z)
#define TRACE4(X,Y,Z,A)
#define TRACE5(X,Y,Z,A,B)
#define TRACE6(X,Y,Z,A,B,C)
#define TRACE7(X,Y,Z,A,B,C,D)
#endif


/*
** If we compile with the SQLITE_TEST macro set, then the following block
** of code will give us the ability to simulate a disk I/O error.  This
** is used for testing the I/O recovery logic.

Changes to src/vdbe.c.

39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
...
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
....
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
**
** 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.393 2004/06/28 13:09:11 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include <ctype.h>
#include "vdbeInt.h"

/*
................................................................................
  }

  /* If it wasn't already, P3 has been converted to the database text
  ** encoding. Fall through to OP_Concat to process this instruction.
  */
}

/* Opcode: Concat P1 P2 P3
**
** Look at the first P1 elements of the stack.  Append them all 
** together with the lowest element first.  Use P3 as a separator.  
** Put the result on the top of the stack.  The original P1 elements
** are popped from the stack if P2==0 and retained if P2==1.  If
** any element of the stack is NULL, then the result is NULL.
**
** If P3 is NULL, then use no separator.  When P1==1, this routine
** makes a copy of the top stack element into memory obtained
** from sqliteMalloc().
*/
case OP_Concat: {
  char *zNew;
  int nByte;
  int nField;
  int i, j;
  Mem *pTerm;
  Mem mSep;     /* Memory cell containing the seperator string, if any */

  if( pOp->p3 ){
    mSep.z = pOp->p3;
    if( db->enc==SQLITE_UTF8 ){
      mSep.n = strlen(mSep.z);
    }else{
      mSep.n = sqlite3utf16ByteLen(mSep.z, -1);
    }
    mSep.flags = MEM_Str|MEM_Static|MEM_Term;
    mSep.enc = db->enc;
  }else{
    mSep.flags = MEM_Null;
    mSep.n = 0;
  }

  /* Loop through the stack elements to see how long the result will be. */
  nField = pOp->p1;
  pTerm = &pTos[1-nField];
  nByte = (nField-1)*mSep.n;
  for(i=0; i<nField; i++, pTerm++){
    assert( pOp->p2==0 || (pTerm->flags&MEM_Str) );
    if( pTerm->flags&MEM_Null ){
      nByte = -1;
      break;
    }
    Stringify(pTerm, db->enc);
................................................................................
    j = 0;
    pTerm = &pTos[1-nField];
    for(i=j=0; i<nField; i++, pTerm++){
      int n = pTerm->n;
      assert( pTerm->flags & MEM_Str );
      memcpy(&zNew[j], pTerm->z, n);
      j += n;
      if( i<nField-1 && !(mSep.flags|MEM_Null) ){
        memcpy(&zNew[j], mSep.z, mSep.n);
        j += mSep.n;
      }
    }
    zNew[j] = 0;
    zNew[j+1] = 0;
    assert( j==nByte );

    if( pOp->p2==0 ){
      popStack(&pTos, nField);







|







 







|


|
<



<
|
|







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




|







 







<
<
<
<







39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
...
981
982
983
984
985
986
987
988
989
990
991

992
993
994

995
996
997
998
999
1000
1001
1002
1003















1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
....
1035
1036
1037
1038
1039
1040
1041




1042
1043
1044
1045
1046
1047
1048
**
** 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.394 2004/06/29 13:54:50 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include <ctype.h>
#include "vdbeInt.h"

/*
................................................................................
  }

  /* If it wasn't already, P3 has been converted to the database text
  ** encoding. Fall through to OP_Concat to process this instruction.
  */
}

/* Opcode: Concat P1 P2 *
**
** Look at the first P1 elements of the stack.  Append them all 
** together with the lowest element first.  The original P1 elements

** are popped from the stack if P2==0 and retained if P2==1.  If
** any element of the stack is NULL, then the result is NULL.
**

** When P1==1, this routine makes a copy of the top stack element
** into memory obtained from sqliteMalloc().
*/
case OP_Concat: {
  char *zNew;
  int nByte;
  int nField;
  int i, j;
  Mem *pTerm;
















  /* Loop through the stack elements to see how long the result will be. */
  nField = pOp->p1;
  pTerm = &pTos[1-nField];
  nByte = 0;
  for(i=0; i<nField; i++, pTerm++){
    assert( pOp->p2==0 || (pTerm->flags&MEM_Str) );
    if( pTerm->flags&MEM_Null ){
      nByte = -1;
      break;
    }
    Stringify(pTerm, db->enc);
................................................................................
    j = 0;
    pTerm = &pTos[1-nField];
    for(i=j=0; i<nField; i++, pTerm++){
      int n = pTerm->n;
      assert( pTerm->flags & MEM_Str );
      memcpy(&zNew[j], pTerm->z, n);
      j += n;




    }
    zNew[j] = 0;
    zNew[j+1] = 0;
    assert( j==nByte );

    if( pOp->p2==0 ){
      popStack(&pTos, nField);