SQLite

Check-in [7b9682c65f]
Login

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

Overview
Comment:Fix build whether compiling with or without auto-extension enabled (CVS 4891)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 7b9682c65f545b09d410173cf282f7c4f4438097
User & Date: mlcreech 2008-03-19 23:52:35.000
Context
2008-03-20
00:32
Fix the load-extension mechanism so that tests build with or without it. This check-in also includes prototypes for the new sqlite3_limit() interface, but no implementation. (CVS 4892) (check-in: bee38c2dda user: drh tags: trunk)
2008-03-19
23:52
Fix build whether compiling with or without auto-extension enabled (CVS 4891) (check-in: 7b9682c65f user: mlcreech tags: trunk)
23:15
Don't wrongly look for the amalgamation in $(TOP) (CVS 4890) (check-in: 41d6ca31ac user: mlcreech tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/loadext.c.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23


24
25
26
27
28
29
30
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code used to dynamically load extensions into
** the SQLite library.
*/
#ifndef SQLITE_OMIT_LOAD_EXTENSION

#ifndef SQLITE_CORE
  #define SQLITE_CORE 1  /* Disable the API redefinition in sqlite3ext.h */
#endif
#include "sqlite3ext.h"
#include "sqliteInt.h"
#include <string.h>
#include <ctype.h>



/*
** Some API routines are omitted when various features are
** excluded from a build of SQLite.  Substitute a NULL pointer
** for any missing APIs.
*/
#ifndef SQLITE_ENABLE_COLUMN_METADATA







<








>
>







8
9
10
11
12
13
14

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code used to dynamically load extensions into
** the SQLite library.
*/


#ifndef SQLITE_CORE
  #define SQLITE_CORE 1  /* Disable the API redefinition in sqlite3ext.h */
#endif
#include "sqlite3ext.h"
#include "sqliteInt.h"
#include <string.h>
#include <ctype.h>

#ifndef SQLITE_OMIT_LOAD_EXTENSION

/*
** Some API routines are omitted when various features are
** excluded from a build of SQLite.  Substitute a NULL pointer
** for any missing APIs.
*/
#ifndef SQLITE_ENABLE_COLUMN_METADATA
496
497
498
499
500
501
502



503
504
505
506
507
508
509
  sqlite3_mutex_enter(mutex);
  sqlite3_free(autoext.aExt);
  autoext.aExt = 0;
  autoext.nExt = 0;
  sqlite3_mutex_leave(mutex);
}




/*
** Load all automatic extensions.
*/
int sqlite3AutoLoadExtensions(sqlite3 *db){
  int i;
  int go = 1;
  int rc = SQLITE_OK;







>
>
>







497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
  sqlite3_mutex_enter(mutex);
  sqlite3_free(autoext.aExt);
  autoext.aExt = 0;
  autoext.nExt = 0;
  sqlite3_mutex_leave(mutex);
}


#ifndef SQLITE_OMIT_LOAD_EXTENSION

/*
** Load all automatic extensions.
*/
int sqlite3AutoLoadExtensions(sqlite3 *db){
  int i;
  int go = 1;
  int rc = SQLITE_OK;
531
532
533
534
535
536
537


      go = 0;
      rc = SQLITE_ERROR;
      sqlite3_free(zErrmsg);
    }
  }
  return rc;
}









>
>
535
536
537
538
539
540
541
542
543
      go = 0;
      rc = SQLITE_ERROR;
      sqlite3_free(zErrmsg);
    }
  }
  return rc;
}

#endif /* SQLITE_OMIT_LOADEXTENSION */
Changes to src/test_autoext.c.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18


19
20
21
22
23
24
25
/*
** 2006 August 23
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** Test extension for testing the sqlite3_auto_extension() function.
**
** $Id: test_autoext.c,v 1.3 2008/03/19 16:08:54 drh Exp $
*/
#include "tcl.h"
#ifndef SQLITE_OMIT_LOAD_EXTENSION
#include "sqlite3ext.h"


static SQLITE_EXTENSION_INIT1

/*
** The sqr() SQL function returns the square of its input value.
*/
static void sqrFunc(
  sqlite3_context *context,













|


<

>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

17
18
19
20
21
22
23
24
25
26
/*
** 2006 August 23
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** Test extension for testing the sqlite3_auto_extension() function.
**
** $Id: test_autoext.c,v 1.4 2008/03/19 23:52:35 mlcreech Exp $
*/
#include "tcl.h"

#include "sqlite3ext.h"

#ifndef SQLITE_OMIT_LOAD_EXTENSION
static SQLITE_EXTENSION_INIT1

/*
** The sqr() SQL function returns the square of its input value.
*/
static void sqrFunc(
  sqlite3_context *context,
123
124
125
126
127
128
129



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
  Tcl_Interp *interp,
  int objc,
  Tcl_Obj *CONST objv[]
){
  sqlite3_auto_extension((void*)broken_init);
  return SQLITE_OK;
}




/*
** tclcmd:   sqlite3_reset_auto_extension
**
** Reset all auto-extensions
*/
static int resetAutoExtObjCmd(
  void * clientData,
  Tcl_Interp *interp,
  int objc,
  Tcl_Obj *CONST objv[]
){
  sqlite3_reset_auto_extension();
  return SQLITE_OK;
}


#endif /* SQLITE_OMIT_LOAD_EXTENSION */

/*
** This procedure registers the TCL procs defined in this file.
*/
int Sqlitetest_autoext_Init(Tcl_Interp *interp){
#ifndef SQLITE_OMIT_LOAD_EXTENSION
  Tcl_CreateObjCommand(interp, "sqlite3_auto_extension_sqr",
          autoExtSqrObjCmd, 0, 0);







>
>
>

















<
<







124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150


151
152
153
154
155
156
157
  Tcl_Interp *interp,
  int objc,
  Tcl_Obj *CONST objv[]
){
  sqlite3_auto_extension((void*)broken_init);
  return SQLITE_OK;
}

#endif /* SQLITE_OMIT_LOAD_EXTENSION */


/*
** tclcmd:   sqlite3_reset_auto_extension
**
** Reset all auto-extensions
*/
static int resetAutoExtObjCmd(
  void * clientData,
  Tcl_Interp *interp,
  int objc,
  Tcl_Obj *CONST objv[]
){
  sqlite3_reset_auto_extension();
  return SQLITE_OK;
}




/*
** This procedure registers the TCL procs defined in this file.
*/
int Sqlitetest_autoext_Init(Tcl_Interp *interp){
#ifndef SQLITE_OMIT_LOAD_EXTENSION
  Tcl_CreateObjCommand(interp, "sqlite3_auto_extension_sqr",
          autoExtSqrObjCmd, 0, 0);