/ Check-in [6e19ef75]
Login

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

Overview
Comment:Make sure zeroblob() works with the concatenation operator. Ticket #2379. (CVS 4028)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 6e19ef758207cedd6db8b2796ef5d4d688cc0b62
User & Date: drh 2007-05-23 06:31:39
Context
2007-05-23
07:20
Additional comments ono the SQLITE_MIXED_ENDIAN_64BIT_FLOAT issue. (CVS 4029) check-in: dd48a31e user: drh tags: trunk
06:31
Make sure zeroblob() works with the concatenation operator. Ticket #2379. (CVS 4028) check-in: 6e19ef75 user: drh tags: trunk
06:25
Increase the number of repititions in crash.test. (CVS 4027) check-in: f3c3412a user: danielk1977 tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/vdbe.c.

39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
....
1029
1030
1031
1032
1033
1034
1035

1036
1037
1038
1039
1040
1041
1042
**
** 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.622 2007/05/17 16:38:30 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include <ctype.h>
#include <math.h>
#include "vdbeInt.h"

................................................................................
  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, encoding);
    nByte += pTerm->n;
  }

  if( nByte<0 ){
    /* If nByte is less than zero, then there is a NULL value on the stack.
    ** In this case just pop the values off the stack (if required) and







|







 







>







39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
....
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
**
** 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.623 2007/05/23 06:31:39 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
#include <ctype.h>
#include <math.h>
#include "vdbeInt.h"

................................................................................
  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;
    }
    ExpandBlob(pTerm);
    Stringify(pTerm, encoding);
    nByte += pTerm->n;
  }

  if( nByte<0 ){
    /* If nByte is less than zero, then there is a NULL value on the stack.
    ** In this case just pop the values off the stack (if required) and

Changes to test/zeroblob.test.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
...
115
116
117
118
119
120
121








122
123
124
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this file is testing of the zero-filled blob functionality
# including the sqlite3_bind_zeroblob(), sqlite3_result_zeroblob(),
# and the built-in zeroblob() SQL function.
#
# $Id: zeroblob.test,v 1.3 2007/05/17 06:44:29 danielk1977 Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

ifcapable !incrblob {
  finish_test
  return
................................................................................
    SELECT count(DISTINCT a) FROM (
      SELECT x'00000000000000000000' AS a
      UNION ALL
      SELECT zeroblob(10) AS a
    )
  }
} {1}








  

finish_test







|







 







>
>
>
>
>
>
>
>



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
...
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#
#***********************************************************************
# This file implements regression tests for SQLite library.  The
# focus of this file is testing of the zero-filled blob functionality
# including the sqlite3_bind_zeroblob(), sqlite3_result_zeroblob(),
# and the built-in zeroblob() SQL function.
#
# $Id: zeroblob.test,v 1.4 2007/05/23 06:31:39 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

ifcapable !incrblob {
  finish_test
  return
................................................................................
    SELECT count(DISTINCT a) FROM (
      SELECT x'00000000000000000000' AS a
      UNION ALL
      SELECT zeroblob(10) AS a
    )
  }
} {1}

# Concatentation works with zeroblob
#
do_test zeroblob-4.1 {
  execsql {
    SELECT hex(zeroblob(2) || x'61')
  }
} {000061}
  

finish_test