SQLite

Check-in [0628f5864f]
Login

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

Overview
Comment:Simplify the implementation of the columnName() function in vdbeapi.c. This is a code cleanup only - no behavior changes. (CVS 6474)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 0628f5864f8cc035b41bbe644bd8ec8fb43c70ce
User & Date: drh 2009-04-08 23:05:29.000
Context
2009-04-09
01:23
Enhance sqlite3_shutdown() so that it automatically invokes sqlite3_reset_auto_extension(). This is a harmless no-op if applications are already calling sqlite3_reset_auto_extension() prior to sqlite3_shutdown(). And it prevents possible memory corruption if they do not. So it works either way. Most of the changes are to the test cases. (CVS 6475) (check-in: 0c41f7cff4 user: drh tags: trunk)
2009-04-08
23:05
Simplify the implementation of the columnName() function in vdbeapi.c. This is a code cleanup only - no behavior changes. (CVS 6474) (check-in: 0628f5864f user: drh tags: trunk)
23:04
Add an assert() to the implementation of count(*) that checks the correct operation of the sqlite3_aggregate_count() function. (CVS 6473) (check-in: f322be3833 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/vdbeapi.c.
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
**    May you share freely, never taking more than you give.
**
*************************************************************************
**
** This file contains code use to implement APIs that are part of the
** VDBE.
**
** $Id: vdbeapi.c,v 1.157 2009/04/08 15:45:32 drh Exp $
*/
#include "sqliteInt.h"
#include "vdbeInt.h"

#if 0 && defined(SQLITE_ENABLE_MEMORY_MANAGEMENT)
/*
** The following structure contains pointers to the end points of a







|







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
**    May you share freely, never taking more than you give.
**
*************************************************************************
**
** This file contains code use to implement APIs that are part of the
** VDBE.
**
** $Id: vdbeapi.c,v 1.158 2009/04/08 23:05:29 drh Exp $
*/
#include "sqliteInt.h"
#include "vdbeInt.h"

#if 0 && defined(SQLITE_ENABLE_MEMORY_MANAGEMENT)
/*
** The following structure contains pointers to the end points of a
900
901
902
903
904
905
906

907
908
909

910
911
912
913

914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
  int N,
  const void *(*xFunc)(Mem*),
  int useType
){
  const void *ret = 0;
  Vdbe *p = (Vdbe *)pStmt;
  int n;

  

  if( p!=0 ){

    n = sqlite3_column_count(pStmt);
    if( N<n && N>=0 ){
      N += useType*n;
      sqlite3_mutex_enter(p->db->mutex);

      ret = xFunc(&p->aColName[N]);

      /* A malloc may have failed inside of the xFunc() call. If this
      ** is the case, clear the mallocFailed flag and return NULL.
      */
      if( p->db && p->db->mallocFailed ){
        p->db->mallocFailed = 0;
        ret = 0;
      }
      sqlite3_mutex_leave(p->db->mutex);
    }
  }
  return ret;
}

/*
** Return the name of the Nth column of the result set returned by SQL







>



>



|
>





|
|


|







900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
  int N,
  const void *(*xFunc)(Mem*),
  int useType
){
  const void *ret = 0;
  Vdbe *p = (Vdbe *)pStmt;
  int n;
  sqlite3 *db = p->db;
  

  if( p!=0 ){
    assert( db!=0 );
    n = sqlite3_column_count(pStmt);
    if( N<n && N>=0 ){
      N += useType*n;
      sqlite3_mutex_enter(db->mutex);
      assert( db->mallocFailed==0 );
      ret = xFunc(&p->aColName[N]);

      /* A malloc may have failed inside of the xFunc() call. If this
      ** is the case, clear the mallocFailed flag and return NULL.
      */
      if( db->mallocFailed ){
        db->mallocFailed = 0;
        ret = 0;
      }
      sqlite3_mutex_leave(db->mutex);
    }
  }
  return ret;
}

/*
** Return the name of the Nth column of the result set returned by SQL