Remove the iCollate argument from sqlite3_create_function() (CVS 1632)

FossilOrigin-Name: 728d57ff5517a51c3aad4ba95525b1aa2065bd19
This commit is contained in:
danielk1977
2004-06-19 08:18:07 +00:00
parent 96d81f99d4
commit f9d64d2c30
11 changed files with 59 additions and 62 deletions
+2 -2
View File
@@ -16,7 +16,7 @@
** sqlite3RegisterDateTimeFunctions() found at the bottom of the file.
** All other code has file scope.
**
** $Id: date.c,v 1.29 2004/06/12 09:25:14 danielk1977 Exp $
** $Id: date.c,v 1.30 2004/06/19 08:18:08 danielk1977 Exp $
**
** NOTES:
**
@@ -886,6 +886,6 @@ void sqlite3RegisterDateTimeFunctions(sqlite *db){
for(i=0; i<sizeof(aFuncs)/sizeof(aFuncs[0]); i++){
sqlite3_create_function(db, aFuncs[i].zName, aFuncs[i].nArg,
SQLITE_UTF8, 0, 0, aFuncs[i].xFunc, 0, 0);
SQLITE_UTF8, 0, aFuncs[i].xFunc, 0, 0);
}
}
+3 -3
View File
@@ -16,7 +16,7 @@
** sqliteRegisterBuildinFunctions() found at the bottom of the file.
** All other code has file scope.
**
** $Id: func.c,v 1.71 2004/06/17 05:36:44 danielk1977 Exp $
** $Id: func.c,v 1.72 2004/06/19 08:18:09 danielk1977 Exp $
*/
#include <ctype.h>
#include <math.h>
@@ -1066,7 +1066,7 @@ void sqlite3RegisterBuiltinFunctions(sqlite *db){
case 2: pArg = (void *)(-1); break;
}
sqlite3_create_function(db, aFuncs[i].zName, aFuncs[i].nArg,
aFuncs[i].eTextRep, 0, pArg, aFuncs[i].xFunc, 0, 0);
aFuncs[i].eTextRep, pArg, aFuncs[i].xFunc, 0, 0);
if( aFuncs[i].needCollSeq ){
FuncDef *pFunc = sqlite3FindFunction(db, aFuncs[i].zName,
strlen(aFuncs[i].zName), aFuncs[i].nArg, aFuncs[i].eTextRep, 0);
@@ -1082,7 +1082,7 @@ void sqlite3RegisterBuiltinFunctions(sqlite *db){
case 2: pArg = (void *)(-1); break;
}
sqlite3_create_function(db, aAggs[i].zName, aAggs[i].nArg, SQLITE_UTF8,
0, pArg, 0, aAggs[i].xStep, aAggs[i].xFinalize);
pArg, 0, aAggs[i].xStep, aAggs[i].xFinalize);
if( aAggs[i].needCollSeq ){
FuncDef *pFunc = sqlite3FindFunction( db, aAggs[i].zName,
strlen(aAggs[i].zName), aAggs[i].nArg, SQLITE_UTF8, 0);
+9 -10
View File
@@ -14,7 +14,7 @@
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
** $Id: main.c,v 1.228 2004/06/19 03:33:57 danielk1977 Exp $
** $Id: main.c,v 1.229 2004/06/19 08:18:12 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@@ -626,13 +626,14 @@ static int sqliteDefaultBusyCallback(
** This routine sets the busy callback for an Sqlite database to the
** given callback function with the given argument.
*/
void sqlite3_busy_handler(
sqlite *db,
int sqlite3_busy_handler(
sqlite3 *db,
int (*xBusy)(void*,int),
void *pArg
){
db->busyHandler.xFunc = xBusy;
db->busyHandler.pArg = pArg;
return SQLITE_OK;
}
#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
@@ -664,12 +665,13 @@ void sqlite3_progress_handler(
** This routine installs a default busy handler that waits for the
** specified number of milliseconds before returning 0.
*/
void sqlite3_busy_timeout(sqlite *db, int ms){
int sqlite3_busy_timeout(sqlite3 *db, int ms){
if( ms>0 ){
sqlite3_busy_handler(db, sqliteDefaultBusyCallback, (void*)ms);
}else{
sqlite3_busy_handler(db, 0, 0);
}
return SQLITE_OK;
}
/*
@@ -699,7 +701,6 @@ int sqlite3_create_function(
const char *zFunctionName,
int nArg,
int enc,
int iCollateArg,
void *pUserData,
void (*xFunc)(sqlite3_context*,int,sqlite3_value **),
void (*xStep)(sqlite3_context*,int,sqlite3_value **),
@@ -729,10 +730,10 @@ int sqlite3_create_function(
}else if( enc==SQLITE_ANY ){
int rc;
rc = sqlite3_create_function(db, zFunctionName, nArg, SQLITE_UTF8,
iCollateArg, pUserData, xFunc, xStep, xFinal);
pUserData, xFunc, xStep, xFinal);
if( rc!=SQLITE_OK ) return rc;
rc = sqlite3_create_function(db, zFunctionName, nArg, SQLITE_UTF16LE,
iCollateArg, pUserData, xFunc, xStep, xFinal);
pUserData, xFunc, xStep, xFinal);
if( rc!=SQLITE_OK ) return rc;
enc = SQLITE_UTF16BE;
}
@@ -750,7 +751,6 @@ int sqlite3_create_function16(
const void *zFunctionName,
int nArg,
int eTextRep,
int iCollateArg,
void *pUserData,
void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
void (*xStep)(sqlite3_context*,int,sqlite3_value**),
@@ -767,7 +767,7 @@ int sqlite3_create_function16(
return SQLITE_NOMEM;
}
rc = sqlite3_create_function(db, zFunc8, nArg, eTextRep,
iCollateArg, pUserData, xFunc, xStep, xFinal);
pUserData, xFunc, xStep, xFinal);
return rc;
}
@@ -1282,7 +1282,6 @@ int sqlite3_create_collation16(
void* pCtx,
int(*xCompare)(void*,int,const void*,int,const void*)
){
int rc;
char const *zName8;
sqlite3_value *pTmp = sqlite3GetTransientValue(db);
sqlite3ValueSetStr(pTmp, -1, zName, SQLITE_UTF16NATIVE, SQLITE_STATIC);
+2 -2
View File
@@ -381,7 +381,7 @@ static void md5finalize(sqlite3_context *context){
DigestToBase16(digest, zBuf);
sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT);
}
void Md5_Register(sqlite *db){
sqlite3_create_function(db, "md5sum", -1, SQLITE_UTF8, 0, 0, 0,
void Md5_Register(sqlite3 *db){
sqlite3_create_function(db, "md5sum", -1, SQLITE_UTF8, 0, 0,
md5step, md5finalize);
}
+14 -17
View File
@@ -12,7 +12,7 @@
** This header file defines the interface that the SQLite library
** presents to client programs.
**
** @(#) $Id: sqlite.h.in,v 1.103 2004/06/19 03:33:57 danielk1977 Exp $
** @(#) $Id: sqlite.h.in,v 1.104 2004/06/19 08:18:16 danielk1977 Exp $
*/
#ifndef _SQLITE_H_
#define _SQLITE_H_
@@ -41,7 +41,6 @@ extern const char sqlite3_version[];
** Each open sqlite database is represented by an instance of the
** following opaque structure.
*/
typedef struct sqlite sqlite;
typedef struct sqlite sqlite3;
@@ -56,7 +55,7 @@ typedef struct sqlite sqlite3;
** this routine is called. Otherwise, SQLITE_BUSY is returned and the
** database connection remains open.
*/
int sqlite3_close(sqlite *);
int sqlite3_close(sqlite3 *);
/*
** The type for a callback function.
@@ -104,7 +103,7 @@ typedef int (*sqlite_callback)(void*,int,char**, char**);
** and sqlite3_busy_timeout() functions below.)
*/
int sqlite3_exec(
sqlite*, /* An open database */
sqlite3*, /* An open database */
const char *sql, /* SQL to be executed */
sqlite_callback, /* Callback function */
void *, /* 1st argument to callback function */
@@ -153,7 +152,7 @@ int sqlite3_exec(
**
** This function is similar to the mysql_insert_id() function from MySQL.
*/
long long int sqlite3_last_insert_rowid(sqlite*);
long long int sqlite3_last_insert_rowid(sqlite3*);
/*
** This function returns the number of database rows that were changed
@@ -175,7 +174,7 @@ long long int sqlite3_last_insert_rowid(sqlite*);
** table. To get an accurate count of the number of rows deleted, use
** "DELETE FROM table WHERE 1" instead.
*/
int sqlite3_changes(sqlite*);
int sqlite3_changes(sqlite3*);
/*
** This function returns the number of database rows that were changed
@@ -201,7 +200,7 @@ int sqlite3_changes(sqlite*);
**
******* THIS IS AN EXPERIMENTAL API AND IS SUBJECT TO CHANGE ******
*/
int sqlite3_last_statement_changes(sqlite*);
int sqlite3_last_statement_changes(sqlite3*);
/* This function causes any pending database operation to abort and
** return at its earliest opportunity. This routine is typically
@@ -209,7 +208,7 @@ int sqlite3_last_statement_changes(sqlite*);
** or Ctrl-C where the user wants a long query operation to halt
** immediately.
*/
void sqlite3_interrupt(sqlite*);
void sqlite3_interrupt(sqlite3*);
/* These functions return true if the given input string comprises
@@ -247,7 +246,7 @@ int sqlite3_complete16(const void *sql);
** data structures out from under the executing query and will
** probably result in a coredump.
*/
void sqlite3_busy_handler(sqlite*, int(*)(void*,int), void*);
int sqlite3_busy_handler(sqlite3*, int(*)(void*,int), void*);
/*
** This routine sets a busy handler that sleeps for a while when a
@@ -259,7 +258,7 @@ void sqlite3_busy_handler(sqlite*, int(*)(void*,int), void*);
** Calling this routine with an argument less than or equal to zero
** turns off all busy handlers.
*/
void sqlite3_busy_timeout(sqlite*, int ms);
int sqlite3_busy_timeout(sqlite3*, int ms);
/*
** This next routine is really just a wrapper around sqlite3_exec().
@@ -303,7 +302,7 @@ void sqlite3_busy_timeout(sqlite*, int ms);
** The return value of this routine is the same as from sqlite3_exec().
*/
int sqlite3_get_table(
sqlite*, /* An open database */
sqlite3*, /* An open database */
const char *sql, /* SQL to be executed */
char ***resultp, /* Result written to a char *[] that this points to */
int *nrow, /* Number of result rows written here */
@@ -369,7 +368,7 @@ void sqlite3_free(char *z);
** if the column should be treated as a NULL value.
*/
int sqlite3_set_authorizer(
sqlite*,
sqlite3*,
int (*xAuth)(void*,int,const char*,const char*,const char*,const char*),
void *pUserData
);
@@ -428,7 +427,7 @@ int sqlite3_set_authorizer(
** or sqlite3_prepare(). This function can be used (for example) to generate
** a log file of all SQL executed against a database.
*/
void *sqlite3_trace(sqlite*, void(*xTrace)(void*,const char*), void*);
void *sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*);
/*
** This routine configures a callback function - the progress callback - that
@@ -456,7 +455,7 @@ void *sqlite3_trace(sqlite*, void(*xTrace)(void*,const char*), void*);
**
******* THIS IS AN EXPERIMENTAL API AND IS SUBJECT TO CHANGE ******
*/
void sqlite3_progress_handler(sqlite*, int, int(*)(void*), void*);
void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
/*
** Register a callback function to be invoked whenever a new transaction
@@ -471,7 +470,7 @@ void sqlite3_progress_handler(sqlite*, int, int(*)(void*), void*);
**
******* THIS IS AN EXPERIMENTAL API AND IS SUBJECT TO CHANGE ******
*/
void *sqlite3_commit_hook(sqlite*, int(*)(void*), void*);
void *sqlite3_commit_hook(sqlite3*, int(*)(void*), void*);
/*
** Open the sqlite database file "filename". The "filename" is UTF-8
@@ -861,7 +860,6 @@ int sqlite3_create_function(
const char *zFunctionName,
int nArg,
int eTextRep,
int iCollateArg,
void*,
void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
void (*xStep)(sqlite3_context*,int,sqlite3_value**),
@@ -872,7 +870,6 @@ int sqlite3_create_function16(
const void *zFunctionName,
int nArg,
int eTextRep,
int iCollateArg,
void*,
void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
void (*xStep)(sqlite3_context*,int,sqlite3_value**),
+3 -2
View File
@@ -11,7 +11,7 @@
*************************************************************************
** Internal interface definitions for SQLite.
**
** @(#) $Id: sqliteInt.h,v 1.290 2004/06/19 03:33:57 danielk1977 Exp $
** @(#) $Id: sqliteInt.h,v 1.291 2004/06/19 08:18:19 danielk1977 Exp $
*/
#include "config.h"
#include "sqlite3.h"
@@ -138,6 +138,8 @@ extern const int sqlite3one;
#define SQLITE_BIGENDIAN (*(char *)(&sqlite3one)==0)
#define SQLITE_LITTLEENDIAN (*(char *)(&sqlite3one)==1)
typedef struct sqlite sqlite;
/*
** Defer sourcing vdbe.h until after the "u8" typedef is defined.
*/
@@ -273,7 +275,6 @@ typedef struct CollSeq CollSeq;
typedef struct KeyInfo KeyInfo;
typedef struct BusyHandler BusyHandler;
/*
** Each database file to be accessed by the system is an instance
** of the following structure. There are normally two of these structures
+2 -2
View File
@@ -11,7 +11,7 @@
*************************************************************************
** A TCL Interface to SQLite
**
** $Id: tclsqlite.c,v 1.88 2004/06/19 00:16:31 drh Exp $
** $Id: tclsqlite.c,v 1.89 2004/06/19 08:18:21 danielk1977 Exp $
*/
#ifndef NO_TCL /* Omit this whole file if TCL is unavailable */
@@ -785,7 +785,7 @@ static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
pFunc->pNext = pDb->pFunc;
pFunc->zScript = (char*)&pFunc[1];
strcpy(pFunc->zScript, zScript);
sqlite3_create_function(pDb->db, zName, -1, SQLITE_UTF8, 0,
sqlite3_create_function(pDb->db, zName, -1, SQLITE_UTF8,
pFunc, tclSqlFunc, 0, 0);
break;
}
+7 -7
View File
@@ -13,7 +13,7 @@
** is not included in the SQLite library. It is used for automated
** testing of the SQLite library.
**
** $Id: test1.c,v 1.79 2004/06/19 03:33:57 danielk1977 Exp $
** $Id: test1.c,v 1.80 2004/06/19 08:18:23 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
@@ -331,7 +331,7 @@ static int sqlite_test_close(
}
if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR;
rc = sqlite3_close(db);
Tcl_SetResult(interp, errorName(rc), TCL_STATIC);
Tcl_SetResult(interp, (char *)errorName(rc), TCL_STATIC);
return TCL_OK;
}
@@ -452,9 +452,9 @@ static int test_create_function(
return TCL_ERROR;
}
if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR;
sqlite3_create_function(db, "x_coalesce", -1, SQLITE_UTF8, 0, 0,
sqlite3_create_function(db, "x_coalesce", -1, SQLITE_UTF8, 0,
ifnullFunc, 0, 0);
sqlite3_create_function(db, "x_sqlite3_exec", 1, SQLITE_UTF8, 0, db,
sqlite3_create_function(db, "x_sqlite3_exec", 1, SQLITE_UTF8, db,
sqlite3ExecFunc, 0, 0);
return TCL_OK;
}
@@ -503,9 +503,9 @@ static int test_create_aggregate(
return TCL_ERROR;
}
if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR;
sqlite3_create_function(db, "x_count", 0, SQLITE_UTF8, 0, 0, 0,
sqlite3_create_function(db, "x_count", 0, SQLITE_UTF8, 0, 0,
countStep,countFinalize);
sqlite3_create_function(db, "x_count", 1, SQLITE_UTF8, 0, 0, 0,
sqlite3_create_function(db, "x_count", 1, SQLITE_UTF8, 0, 0,
countStep,countFinalize);
return TCL_OK;
}
@@ -742,7 +742,7 @@ static int test_register_func(
return TCL_ERROR;
}
if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR;
rc = sqlite3_create_function(db, argv[2], -1, SQLITE_UTF8, 0, 0,
rc = sqlite3_create_function(db, argv[2], -1, SQLITE_UTF8, 0,
testFunc, 0, 0);
if( rc!=0 ){
Tcl_AppendResult(interp, sqlite3ErrStr(rc), 0);