SQLite4
Check-in [02ec769ae0]
Not logged in

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

Overview
Comment:Remove the sqlite4_progress_handler interface. Change the documentation of load_extension() to say that it sets the db handle error message and code.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 02ec769ae03dee879ee5f4be76f0489000d73efb
User & Date: dan 2013-06-17 05:35:33
Context
2013-06-17
20:15
Modifications to make the ANALYZE command work (sqlite_stat1 only). check-in: 7d8efac62f user: dan tags: trunk
05:35
Remove the sqlite4_progress_handler interface. Change the documentation of load_extension() to say that it sets the db handle error message and code. check-in: 02ec769ae0 user: dan tags: trunk
2013-06-15
19:47
Add destructors to the sqlite4_trace and sqlite4_profile routines. check-in: fd63f9cb75 user: dan tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/main.c.

504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
  if( ALWAYS(rc>=0) && rc<(int)(sizeof(aMsg)/sizeof(aMsg[0])) && aMsg[rc]!=0 ){
    return aMsg[rc];
  }else{
    return "unknown error";
  }
}

#ifndef SQLITE4_OMIT_PROGRESS_CALLBACK
/*
** This routine sets the progress callback for an Sqlite database to the
** given callback function with the given argument. The progress callback will
** be invoked every nOps opcodes.
*/
void sqlite4_progress_handler(
  sqlite4 *db, 
  int nOps,
  int (*xProgress)(void*), 
  void *pArg
){
  sqlite4_mutex_enter(db->mutex);
  if( nOps>0 ){
    db->xProgress = xProgress;
    db->nProgressOps = nOps;
    db->pProgressArg = pArg;
  }else{
    db->xProgress = 0;
    db->nProgressOps = 0;
    db->pProgressArg = 0;
  }
  sqlite4_mutex_leave(db->mutex);
}
#endif

/*
** Cause any pending operation to stop at its earliest opportunity.
*/
void sqlite4_interrupt(sqlite4 *db){
  db->u1.isInterrupted = 1;
}








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







504
505
506
507
508
509
510


























511
512
513
514
515
516
517
  if( ALWAYS(rc>=0) && rc<(int)(sizeof(aMsg)/sizeof(aMsg[0])) && aMsg[rc]!=0 ){
    return aMsg[rc];
  }else{
    return "unknown error";
  }
}



























/*
** Cause any pending operation to stop at its earliest opportunity.
*/
void sqlite4_interrupt(sqlite4 *db){
  db->u1.isInterrupted = 1;
}

Changes to src/sqlite.h.in.

1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
....
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000



3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
void sqlite4_profile(
  sqlite4*,
  void *,
  void(*xProfile)(void*,const char*,sqlite4_uint64),
  void(*xDestroy)(void*)
);

/*
** CAPIREF: Query Progress Callbacks
**
** ^The sqlite4_progress_handler(D,N,X,P) interface causes the callback
** function X to be invoked periodically during long running calls to
** [sqlite4_exec()] and [sqlite4_step()] for
** database connection D.  An example use for this
** interface is to keep a GUI updated during a large query.
**
** ^The parameter P is passed through as the only parameter to the 
** callback function X.  ^The parameter N is the number of 
** [virtual machine instructions] that are evaluated between successive
** invocations of the callback X.
**
** ^Only a single progress handler may be defined at one time per
** [database connection]; setting a new progress handler cancels the
** old one.  ^Setting parameter X to NULL disables the progress handler.
** ^The progress handler is also disabled by setting N to a value less
** than 1.
**
** ^If the progress callback returns non-zero, the operation is
** interrupted.  This feature can be used to implement a
** "Cancel" button on a GUI progress dialog box.
**
** The progress handler callback must not do anything that will modify
** the database connection that invoked the progress handler.
** Note that [sqlite4_prepare()] and [sqlite4_step()] both modify their
** database connections for the meaning of "modify" in this paragraph.
**
*/
void sqlite4_progress_handler(sqlite4*, int, int(*)(void*), void*);

/*
** CAPIREF: Opening A New Database Connection
**
** ^These routines open an SQLite4 database file as specified by the 
** URI argument.
** ^(A [database connection] handle is usually
** returned in *ppDb, even if an error occurs.  The only exception is that
................................................................................
);

/*
** CAPIREF: Load An Extension
**
** ^This interface loads an SQLite extension library from the named file.
**
** ^The sqlite4_load_extension() interface attempts to load an
** SQLite extension library contained in the file zFile.
**
** ^The entry point is zProc.
** ^zProc may be 0, in which case the name of the entry point
** defaults to "sqlite4_extension_init".
** ^The sqlite4_load_extension() interface returns
** [SQLITE4_OK] on success and [SQLITE4_ERROR] if something goes wrong.
** ^If an error occurs and pzErrMsg is not 0, then the
** [sqlite4_load_extension()] interface shall attempt to
** fill *pzErrMsg with error message text stored in memory
** obtained from [sqlite4_malloc()]. The calling function
** should free this memory by calling [sqlite4_free()].
**
** ^Extension loading must be enabled using
** [sqlite4_enable_load_extension()] prior to calling this API,
** otherwise an error will be returned.



**
** See also the [load_extension() SQL function].
*/
int sqlite4_load_extension(
  sqlite4 *db,          /* Load the extension into this database connection */
  const char *zFile,    /* Name of the shared library containing extension */
  const char *zProc,    /* Entry point.  Derived from zFile if 0 */
  char **pzErrMsg       /* Put error message here if not 0 */
);

/*
** CAPIREF: Enable Or Disable Extension Loading
**
** ^So as not to open security holes in older applications that are
** unprepared to deal with extension loading, and as a means of disabling







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







 







|
|

|
<
|
|
|
<
<
<
<
<

|
<
|
>
>
>






|
<







1341
1342
1343
1344
1345
1346
1347
































1348
1349
1350
1351
1352
1353
1354
....
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955

2956
2957
2958





2959
2960

2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971

2972
2973
2974
2975
2976
2977
2978
void sqlite4_profile(
  sqlite4*,
  void *,
  void(*xProfile)(void*,const char*,sqlite4_uint64),
  void(*xDestroy)(void*)
);

































/*
** CAPIREF: Opening A New Database Connection
**
** ^These routines open an SQLite4 database file as specified by the 
** URI argument.
** ^(A [database connection] handle is usually
** returned in *ppDb, even if an error occurs.  The only exception is that
................................................................................
);

/*
** CAPIREF: Load An Extension
**
** ^This interface loads an SQLite extension library from the named file.
**
** ^The sqlite4_load_extension() interface attempts to load an SQLite 
** extension library contained in the file zFile.
**
** ^The entry point is zProc. ^zProc may be 0, in which case the name 

** of the entry point defaults to "sqlite4_extension_init". ^The 
** sqlite4_load_extension() interface returns [SQLITE4_OK] on success 
** and [SQLITE4_ERROR] if something goes wrong.





**
** ^Extension loading must be enabled using [sqlite4_enable_load_extension()] 

** prior to calling this API, otherwise an error will be returned.
**
** This function sets the values returned by sqlite4_errcode() and
** sqlite4_errmsg() before returning.
**
** See also the [load_extension() SQL function].
*/
int sqlite4_load_extension(
  sqlite4 *db,          /* Load the extension into this database connection */
  const char *zFile,    /* Name of the shared library containing extension */
  const char *zProc     /* Entry point.  Derived from zFile if 0 */

);

/*
** CAPIREF: Enable Or Disable Extension Loading
**
** ^So as not to open security holes in older applications that are
** unprepared to deal with extension loading, and as a means of disabling