From: drh Date: Wed, 14 Jun 2006 15:35:36 +0000 (+0000) Subject: Better documentation on the limits of user-defined functions. And a X-Git-Tag: version-3.6.10~2920 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=badf7a7a2fa7af2e78341999a3de812d04d1eaeb;p=thirdparty%2Fsqlite.git Better documentation on the limits of user-defined functions. And a marginally better error message when those limits are exceeded. Ticket #1847. (CVS 3247) FossilOrigin-Name: 0d369ff071d296501cc33d4622144b22946ac555 --- diff --git a/manifest b/manifest index 3c1610e642..ad0c30492c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sxUpdate\smethod\sto\sthe\secho\stest\smodule.\sCurrently\suntested.\s(CVS\s3246) -D 2006-06-14T15:16:36 +C Better\sdocumentation\son\sthe\slimits\sof\suser-defined\sfunctions.\s\sAnd\sa\nmarginally\sbetter\serror\smessage\swhen\sthose\slimits\sare\sexceeded.\nTicket\s#1847.\s(CVS\s3247) +D 2006-06-14T15:35:37 F Makefile.in 200f6dc376ecfd9b01e5359c4e0c10c02f649b34 F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 @@ -49,7 +49,7 @@ F src/hash.h 1b3f7e2609141fd571f62199fc38687d262e9564 F src/insert.c 2c3eeb4bcde13c1006824ef14953c2fdad31cf36 F src/legacy.c fa15d505dd4e45044177ee4d1c6aeaf8c836d390 F src/loadext.c d8c7bd14e6ebc4e9f1ff269475bf63e131919449 -F src/main.c f4397bf95216496e49db2153789788f4b1207b91 +F src/main.c 4e48472d06ac3fc0250023e2eb406fc7d8d0a27c F src/md5.c c5fdfa5c2593eaee2e32a5ce6c6927c986eaf217 F src/os.c 59f05de8c5777c34876607114a2fbe55ae578235 F src/os.h ac2ccb4f48902c1611a7e1f171eb81d17e3b8eb2 @@ -322,7 +322,7 @@ F www/audit.tcl 90e09d580f79c7efec0c7d6f447b7ec5c2dce5c0 F www/autoinc.tcl b357f5ba954b046ee35392ce0f884a2fcfcdea06 F www/c_interface.tcl b51b08591554c16a0c3ef718364a508ac25abc7e F www/capi3.tcl 7a7cc225fe02eb7ab861a6019b08baa0014409e1 -F www/capi3ref.tcl ab76e918c52f7d4027accc6f84a8845ee5c43b16 +F www/capi3ref.tcl 530fffe3b5729981dc4cfd32e2bafd4ba3dad2ec F www/changes.tcl ec6d4fa4d302a76d662509c7c4796a159bd66b31 F www/common.tcl 14d121c28532ad20c3e349caa4db708b0b822083 F www/compile.tcl 276546d7eb445add5a867193bbd80f6919a6b084 @@ -366,7 +366,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513 -P e5fff87d004ccf0cf8ba1f6afa032f31144527d9 -R d24bc91ccb9a06f930675327990c7800 -U danielk1977 -Z db7c917a9ca4e17b1b7a1b3ea7331c7f +P 676de55b28f0b22cf78f5e71f4a960f3d76c2d72 +R a8a1cc8c95b40bc320a675a33fc7e864 +U drh +Z a5cbc134908c784d2a3323e83c952926 diff --git a/manifest.uuid b/manifest.uuid index 8a37057c31..c5f3627f59 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -676de55b28f0b22cf78f5e71f4a960f3d76c2d72 \ No newline at end of file +0d369ff071d296501cc33d4622144b22946ac555 \ No newline at end of file diff --git a/src/main.c b/src/main.c index 6eb047df63..526eaed6a2 100644 --- a/src/main.c +++ b/src/main.c @@ -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.342 2006/06/11 23:41:55 drh Exp $ +** $Id: main.c,v 1.343 2006/06/14 15:35:37 drh Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -415,6 +415,7 @@ int sqlite3CreateFunc( (!xFunc && (!xFinal && xStep)) || (nArg<-1 || nArg>127) || (255<(nName = strlen(zFunctionName))) ){ + sqlite3Error(db, SQLITE_ERROR, "bad parameters"); return SQLITE_ERROR; } diff --git a/www/capi3ref.tcl b/www/capi3ref.tcl index 88519b2d4a..a897a863e0 100644 --- a/www/capi3ref.tcl +++ b/www/capi3ref.tcl @@ -1,4 +1,4 @@ -set rcsid {$Id: capi3ref.tcl,v 1.39 2006/05/27 11:15:48 drh Exp $} +set rcsid {$Id: capi3ref.tcl,v 1.40 2006/06/14 15:35:37 drh Exp $} source common.tcl header {C/C++ Interface For SQLite Version 3} puts { @@ -669,7 +669,11 @@ int sqlite3_create_function16( only difference between these two routines is that the second argument, the name of the (scalar) function or aggregate, is encoded in UTF-8 for sqlite3_create_function() and UTF-16 for sqlite3_create_function16(). - + The length of the name is limited to 255 bytes, exclusive of the + zero-terminator. Note that the name length limit is in bytes, not + characters. Any attempt to create a function with a longer name + will result in an SQLITE_ERROR error. + The first argument is the database handle that the new function or aggregate is to be added to. If a single program uses more than one database handle internally, then user functions or aggregates must @@ -678,7 +682,9 @@ int sqlite3_create_function16( The third argument is the number of arguments that the function or aggregate takes. If this argument is -1 then the function or - aggregate may take any number of arguments. + aggregate may take any number of arguments. The maximum number + of arguments to a new SQL function is 127. A number larger than + 127 for the third argument results in an SQLITE_ERROR error. The fourth argument, eTextRep, specifies what type of text arguments this function prefers to receive. Any function should be able to work