SQLite4
Check-in [22b6bdf65a]
Not logged in

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

Overview
Comment:Change the order of the parameters passed to sqlite4_collation_needed() and needed16() to be consistent with other callback APIs.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 22b6bdf65a7ebc72789c109311caf210b61b8c0e
User & Date: dan 2013-06-07 14:36:19
Context
2013-06-07
19:29
Allow collation sequence comparison functions to return errors. check-in: 596c1f3869 user: dan tags: trunk
14:36
Change the order of the parameters passed to sqlite4_collation_needed() and needed16() to be consistent with other callback APIs. check-in: 22b6bdf65a user: dan tags: trunk
14:22
Remove the error message output parameter from sqlite4_exec(). check-in: 6833c6df33 user: dan tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/main.c.

1532
1533
1534
1535
1536
1537
1538
1539
1540

1541
1542
1543
1544
1545
1546
1547
....
1550
1551
1552
1553
1554
1555
1556
1557
1558

1559
1560
1561
1562
1563
1564
1565

/*
** Register a collation sequence factory callback with the database handle
** db. Replace any previously installed collation sequence factory.
*/
int sqlite4_collation_needed(
  sqlite4 *db, 
  void *pCollNeededArg, 
  void(*xCollNeeded)(void*,sqlite4*,int eTextRep,const char*)

){
  sqlite4_mutex_enter(db->mutex);
  db->xCollNeeded = xCollNeeded;
  db->xCollNeeded16 = 0;
  db->pCollNeededArg = pCollNeededArg;
  sqlite4_mutex_leave(db->mutex);
  return SQLITE4_OK;
................................................................................
#ifndef SQLITE4_OMIT_UTF16
/*
** Register a collation sequence factory callback with the database handle
** db. Replace any previously installed collation sequence factory.
*/
int sqlite4_collation_needed16(
  sqlite4 *db, 
  void *pCollNeededArg, 
  void(*xCollNeeded16)(void*,sqlite4*,int eTextRep,const void*)

){
  sqlite4_mutex_enter(db->mutex);
  db->xCollNeeded = 0;
  db->xCollNeeded16 = xCollNeeded16;
  db->pCollNeededArg = pCollNeededArg;
  sqlite4_mutex_leave(db->mutex);
  return SQLITE4_OK;







<
|
>







 







<
|
>







1532
1533
1534
1535
1536
1537
1538

1539
1540
1541
1542
1543
1544
1545
1546
1547
....
1550
1551
1552
1553
1554
1555
1556

1557
1558
1559
1560
1561
1562
1563
1564
1565

/*
** Register a collation sequence factory callback with the database handle
** db. Replace any previously installed collation sequence factory.
*/
int sqlite4_collation_needed(
  sqlite4 *db, 

  void(*xCollNeeded)(void*,sqlite4*,int eTextRep,const char*),
  void *pCollNeededArg
){
  sqlite4_mutex_enter(db->mutex);
  db->xCollNeeded = xCollNeeded;
  db->xCollNeeded16 = 0;
  db->pCollNeededArg = pCollNeededArg;
  sqlite4_mutex_leave(db->mutex);
  return SQLITE4_OK;
................................................................................
#ifndef SQLITE4_OMIT_UTF16
/*
** Register a collation sequence factory callback with the database handle
** db. Replace any previously installed collation sequence factory.
*/
int sqlite4_collation_needed16(
  sqlite4 *db, 

  void(*xCollNeeded16)(void*,sqlite4*,int eTextRep,const void*),
  void *pCollNeededArg
){
  sqlite4_mutex_enter(db->mutex);
  db->xCollNeeded = 0;
  db->xCollNeeded16 = xCollNeeded16;
  db->pCollNeededArg = pCollNeededArg;
  sqlite4_mutex_leave(db->mutex);
  return SQLITE4_OK;

Changes to src/sqlite.h.in.

2798
2799
2800
2801
2802
2803
2804
2805
2806

2807
2808
2809
2810
2811

2812
2813
2814
2815
2816
2817
2818
**
** The callback function should register the desired collation using
** [sqlite4_create_collation()], [sqlite4_create_collation16()], or
** [sqlite4_create_collation_v2()].
*/
int sqlite4_collation_needed(
  sqlite4*, 
  void*, 
  void(*)(void*,sqlite4*,int eTextRep,const char*)

);
int sqlite4_collation_needed16(
  sqlite4*, 
  void*,
  void(*)(void*,sqlite4*,int eTextRep,const void*)

);

/*
** CAPIREF: Suspend Execution For A Short Time
**
** The sqlite4_sleep() function causes the current thread to suspend execution
** for at least a number of milliseconds specified in its parameter.







<
|
>



<
|
>







2798
2799
2800
2801
2802
2803
2804

2805
2806
2807
2808
2809

2810
2811
2812
2813
2814
2815
2816
2817
2818
**
** The callback function should register the desired collation using
** [sqlite4_create_collation()], [sqlite4_create_collation16()], or
** [sqlite4_create_collation_v2()].
*/
int sqlite4_collation_needed(
  sqlite4*, 

  void(*)(void*,sqlite4*,int eTextRep,const char*),
  void* 
);
int sqlite4_collation_needed16(
  sqlite4*, 

  void(*)(void*,sqlite4*,int eTextRep,const void*),
  void*
);

/*
** CAPIREF: Suspend Execution For A Short Time
**
** The sqlite4_sleep() function causes the current thread to suspend execution
** for at least a number of milliseconds specified in its parameter.

Changes to src/tclsqlite.c.

1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
      return TCL_ERROR;
    }
    if( pDb->pCollateNeeded ){
      Tcl_DecrRefCount(pDb->pCollateNeeded);
    }
    pDb->pCollateNeeded = Tcl_DuplicateObj(objv[2]);
    Tcl_IncrRefCount(pDb->pCollateNeeded);
    sqlite4_collation_needed(pDb->db, pDb, tclCollateNeeded);
    break;
  }

  /*    $db complete SQL
  **
  ** Return TRUE if SQL is a complete SQL statement.  Return FALSE if
  ** additional lines of input are needed.  This is similar to the







|







1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
      return TCL_ERROR;
    }
    if( pDb->pCollateNeeded ){
      Tcl_DecrRefCount(pDb->pCollateNeeded);
    }
    pDb->pCollateNeeded = Tcl_DuplicateObj(objv[2]);
    Tcl_IncrRefCount(pDb->pCollateNeeded);
    sqlite4_collation_needed(pDb->db, tclCollateNeeded, (void *)pDb);
    break;
  }

  /*    $db complete SQL
  **
  ** Return TRUE if SQL is a complete SQL statement.  Return FALSE if
  ** additional lines of input are needed.  This is similar to the

Changes to test/test_main.c.

2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
  Tcl_Obj *CONST objv[]
){
  sqlite4 *db;
  int rc;

  if( objc!=2 ) goto bad_args;
  if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR;
  rc = sqlite4_collation_needed16(db, 0, test_collate_needed_cb);
  zNeededCollation[0] = 0;
  if( sqlite4TestErrCode(interp, db, rc) ) return TCL_ERROR;
  return TCL_OK;

bad_args:
  Tcl_WrongNumArgs(interp, 1, objv, "DB");
  return TCL_ERROR;







|







2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
  Tcl_Obj *CONST objv[]
){
  sqlite4 *db;
  int rc;

  if( objc!=2 ) goto bad_args;
  if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR;
  rc = sqlite4_collation_needed16(db, test_collate_needed_cb, 0);
  zNeededCollation[0] = 0;
  if( sqlite4TestErrCode(interp, db, rc) ) return TCL_ERROR;
  return TCL_OK;

bad_args:
  Tcl_WrongNumArgs(interp, 1, objv, "DB");
  return TCL_ERROR;