SQLite

Check-in [24c3ebc0c5]
Login

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

Overview
Comment:Test string values passed to bind_text() and result_text() for a nul-terminator. (CVS 4915)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 24c3ebc0c5c53c234516d16dce761d713fb29578
User & Date: danielk1977 2008-03-25 16:16:29.000
Context
2008-03-25
17:23
Modify the {quote: IdxDelete} opcode so that it takes an array of registers rather than a record formed using {quote: MakeRecord.} This avoids a needless packing and unpacking of the record to be deleted. (CVS 4916) (check-in: ee381b4356 user: drh tags: trunk)
16:16
Test string values passed to bind_text() and result_text() for a nul-terminator. (CVS 4915) (check-in: 24c3ebc0c5 user: danielk1977 tags: trunk)
14:24
Have each {quote: BtShared} structure hang on to a buffer of just under page-size bytes for temporary use. This reduces the number of calls to malloc(). (CVS 4914) (check-in: fe1bc0f3b7 user: danielk1977 tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/tclsqlite.c.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** A TCL Interface to SQLite.  Append this file to sqlite3.c and
** compile the whole thing to build a TCL-enabled version of SQLite.
**
** $Id: tclsqlite.c,v 1.211 2008/03/19 19:01:22 drh Exp $
*/
#include "tcl.h"
#include <errno.h>

/*
** Some additional include files are needed if this file is not
** appended to the amalgamation.







|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** A TCL Interface to SQLite.  Append this file to sqlite3.c and
** compile the whole thing to build a TCL-enabled version of SQLite.
**
** $Id: tclsqlite.c,v 1.212 2008/03/25 16:16:29 danielk1977 Exp $
*/
#include "tcl.h"
#include <errno.h>

/*
** Some additional include files are needed if this file is not
** appended to the amalgamation.
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
            }else if( (c=='w' && strcmp(zType,"wideInt")==0) ||
                  (c=='i' && strcmp(zType,"int")==0) ){
              Tcl_WideInt v;
              Tcl_GetWideIntFromObj(interp, pVar, &v);
              sqlite3_bind_int64(pStmt, i, v);
            }else{
              data = (unsigned char *)Tcl_GetStringFromObj(pVar, &n);
              sqlite3_bind_text(pStmt, i, (char *)data, n, SQLITE_STATIC);
              Tcl_IncrRefCount(pVar);
              apParm[nParm++] = pVar;
            }
          }else{
            sqlite3_bind_null( pStmt, i );
          }
        }







|







1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
            }else if( (c=='w' && strcmp(zType,"wideInt")==0) ||
                  (c=='i' && strcmp(zType,"int")==0) ){
              Tcl_WideInt v;
              Tcl_GetWideIntFromObj(interp, pVar, &v);
              sqlite3_bind_int64(pStmt, i, v);
            }else{
              data = (unsigned char *)Tcl_GetStringFromObj(pVar, &n);
              sqlite3_bind_text(pStmt, i, (char *)data, n+1, SQLITE_STATIC);
              Tcl_IncrRefCount(pVar);
              apParm[nParm++] = pVar;
            }
          }else{
            sqlite3_bind_null( pStmt, i );
          }
        }
Changes to src/vdbemem.c.
632
633
634
635
636
637
638








639
640
641
642
643
644
645
    assert( enc!=0 );
    if( enc==SQLITE_UTF8 ){
      for(nByte=0; z[nByte]; nByte++){}
    }else{
      for(nByte=0; z[nByte] | z[nByte+1]; nByte+=2){}
    }
    flags |= MEM_Term;








  }

  /* The following block sets the new values of Mem.z and Mem.xDel. It
  ** also sets a flag in local variable "flags" to indicate the memory
  ** management (one of MEM_Dyn or MEM_Static).
  */
  if( xDel==SQLITE_TRANSIENT ){







>
>
>
>
>
>
>
>







632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
    assert( enc!=0 );
    if( enc==SQLITE_UTF8 ){
      for(nByte=0; z[nByte]; nByte++){}
    }else{
      for(nByte=0; z[nByte] | z[nByte+1]; nByte+=2){}
    }
    flags |= MEM_Term;
  }else if( enc==SQLITE_UTF8 && nByte>0 && z[nByte-1]=='\0' ){
    nByte--;
    flags |= MEM_Term;
#ifndef SQLITE_OMIT_UTF16
  }else if( enc && nByte>1 && z[nByte-1]=='\0' && z[nByte-2]=='\0' ){
    nByte -= 2;
    flags |= MEM_Term;
#endif
  }

  /* The following block sets the new values of Mem.z and Mem.xDel. It
  ** also sets a flag in local variable "flags" to indicate the memory
  ** management (one of MEM_Dyn or MEM_Static).
  */
  if( xDel==SQLITE_TRANSIENT ){