Introduce the (experimental) sqlite3_result_error_toobig() API that
function implementations can use to signal SQLite that the function result is too big to represent. (CVS 3949) FossilOrigin-Name: 17c4235c492f746867c1d2b8621043b93f8aa10e
This commit is contained in:
parent
f8e632b630
commit
a0206bc81c
20
manifest
20
manifest
@ -1,5 +1,5 @@
|
||||
C Add\sthe\smax_page_count\spragma\sused\sto\slimit\sthe\smaximum\ssize\sof\sa\sdatabase\nfile.\s\sUntested.\s(CVS\s3948)
|
||||
D 2007-05-08T14:51:37
|
||||
C Introduce\sthe\s(experimental)\ssqlite3_result_error_toobig()\sAPI\sthat\nfunction\simplementations\scan\suse\sto\ssignal\sSQLite\sthat\sthe\sfunction\nresult\sis\stoo\sbig\sto\srepresent.\s(CVS\s3949)
|
||||
D 2007-05-08T15:15:02
|
||||
F Makefile.in 87b200ad9970907f76df734d29dff3d294c10935
|
||||
F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
|
||||
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
|
||||
@ -67,16 +67,16 @@ F src/btreeInt.h cb3c0e9eb842d06079a62cdf3492c90c5db7ba75
|
||||
F src/build.c 5a60e2e4a21fa8cbdf9e01a95e6d5ca44ff4a2b9
|
||||
F src/callback.c 9c12535669a638f90a67e10440b99c7b93c0fbf4
|
||||
F src/complete.c 7d1a44be8f37de125fcafd3d3a018690b3799675
|
||||
F src/date.c c34a9c86ffd6da4cb3903ea038d977ec539d07e2
|
||||
F src/date.c 263ef5b81b4ffdd80e8a830645798967bbbcfd05
|
||||
F src/delete.c 5c0d89b3ef7d48fe1f5124bfe8341f982747fe29
|
||||
F src/experimental.c 1b2d1a6cd62ecc39610e97670332ca073c50792b
|
||||
F src/expr.c 2f0f9f89efe9170e5e6ca5d5e93a9d5896fff5ac
|
||||
F src/func.c 72801217dadcbee33a0fda48c02b89db5b5da659
|
||||
F src/func.c f06e14b427725c1e07f59018cefc6178df0eb09d
|
||||
F src/hash.c 67b23e14f0257b69a3e8aa663e4eeadc1a2b6fd5
|
||||
F src/hash.h 1b3f7e2609141fd571f62199fc38687d262e9564
|
||||
F src/insert.c e595ca26805dfb3a9ebaabc28e7947c479f3b14d
|
||||
F src/legacy.c 388c71ad7fbcd898ba1bcbfc98a3ac954bfa5d01
|
||||
F src/limits.h e8d89699ff06f1492f5ddcf1ec61eab0df623975
|
||||
F src/limits.h a912a42c164f4e3dca1fbb2f062d503f523390be
|
||||
F src/loadext.c afe4f4755dc49c36ef505748bbdddecb9f1d02a2
|
||||
F src/main.c 35b340716319e88817493172aa63abe8be13b543
|
||||
F src/malloc.c b89e31258a85158d15795bf87ae3ba007e56329b
|
||||
@ -102,7 +102,7 @@ F src/random.c 6119474a6f6917f708c1dee25b9a8e519a620e88
|
||||
F src/select.c 114e7ebaa2e41d83687f0c7c5f53daa7e7af8d3a
|
||||
F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96
|
||||
F src/shell.c d07ae326b3815d80f71c69b3c7584382e47f6447
|
||||
F src/sqlite.h.in 8e00b44bf4e049df5b1520230c311bd39e264a49
|
||||
F src/sqlite.h.in 664b8702c27dc742584788823c548491ac8935d6
|
||||
F src/sqlite3ext.h 7d0d363ea7327e817ef0dfe1b7eee1f171b72890
|
||||
F src/sqliteInt.h 2933fb3d045f85c481453276ed737bd7e65364d5
|
||||
F src/table.c a8de75bcedf84d4060d804264b067ab3b1a3561d
|
||||
@ -135,7 +135,7 @@ F src/vacuum.c 8bd895d29e7074e78d4e80f948e35ddc9cf2beef
|
||||
F src/vdbe.c 07f70528ed4e51753e4416ed4faac33696e65c04
|
||||
F src/vdbe.h 0025259af1939fb264a545816c69e4b5b8d52691
|
||||
F src/vdbeInt.h 77a17f1a8bcbbb660bf4515c78d74280b4e8be5c
|
||||
F src/vdbeapi.c 37d793559390bec8a00c556f651f21b5f9e589af
|
||||
F src/vdbeapi.c 120e04492e98e3cfd5545dd7130c76987e40e8b3
|
||||
F src/vdbeaux.c c432e17fef6efaf102d507e979cee4e47f6ceac4
|
||||
F src/vdbeblob.c 57127dc9fd01f3fded2eab30b5842f5f96b1c42b
|
||||
F src/vdbefifo.c 3ca8049c561d5d67cbcb94dc909ae9bb68c0bf8f
|
||||
@ -485,7 +485,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
|
||||
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
||||
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
|
||||
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
|
||||
P b0fb4a3cf6ddbc17ccd0c719b34a720d9090bc93
|
||||
R e3726b52936aa8a8c64158a436e46313
|
||||
P b1b74f06688fd90fcaf54cf95e2e7beeb5fc1040
|
||||
R 40ca2b4e3466e1b036e5014d465b679f
|
||||
U drh
|
||||
Z f695cedfb2999b1238e46a40ecfacacd
|
||||
Z 55ff99acd1ae44d56a185a619d6a1cda
|
||||
|
@ -1 +1 @@
|
||||
b1b74f06688fd90fcaf54cf95e2e7beeb5fc1040
|
||||
17c4235c492f746867c1d2b8621043b93f8aa10e
|
@ -16,7 +16,7 @@
|
||||
** sqlite3RegisterDateTimeFunctions() found at the bottom of the file.
|
||||
** All other code has file scope.
|
||||
**
|
||||
** $Id: date.c,v 1.64 2007/05/04 13:15:56 drh Exp $
|
||||
** $Id: date.c,v 1.65 2007/05/08 15:15:02 drh Exp $
|
||||
**
|
||||
** NOTES:
|
||||
**
|
||||
@ -774,7 +774,8 @@ static void strftimeFunc(
|
||||
sqlite3_value **argv
|
||||
){
|
||||
DateTime x;
|
||||
int n, i, j;
|
||||
u64 n;
|
||||
int i, j;
|
||||
char *z;
|
||||
const char *zFmt = (const char*)sqlite3_value_text(argv[0]);
|
||||
char zBuf[100];
|
||||
@ -814,6 +815,9 @@ static void strftimeFunc(
|
||||
}
|
||||
if( n<sizeof(zBuf) ){
|
||||
z = zBuf;
|
||||
}else if( n>SQLITE_MAX_LENGTH ){
|
||||
sqlite3_result_error_toobig(context);
|
||||
return;
|
||||
}else{
|
||||
z = sqliteMalloc( n );
|
||||
if( z==0 ) return;
|
||||
|
12
src/func.c
12
src/func.c
@ -16,7 +16,7 @@
|
||||
** sqliteRegisterBuildinFunctions() found at the bottom of the file.
|
||||
** All other code has file scope.
|
||||
**
|
||||
** $Id: func.c,v 1.148 2007/05/08 14:39:04 danielk1977 Exp $
|
||||
** $Id: func.c,v 1.149 2007/05/08 15:15:02 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
#include <ctype.h>
|
||||
@ -301,7 +301,7 @@ static void randomBlob(
|
||||
n = 1;
|
||||
}
|
||||
if( n>SQLITE_MAX_LENGTH ){
|
||||
sqlite3_result_error(context, "randomblob() too large", -1);
|
||||
sqlite3_result_error_toobig(context);
|
||||
return;
|
||||
}
|
||||
p = sqliteMalloc(n);
|
||||
@ -624,7 +624,7 @@ static void quoteFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
|
||||
char const *zBlob = sqlite3_value_blob(argv[0]);
|
||||
|
||||
if( 2*nBlob+4>SQLITE_MAX_LENGTH ){
|
||||
sqlite3_result_error(context, "BLOB too big to quote", -1);
|
||||
sqlite3_result_error_toobig(context);
|
||||
return;
|
||||
}
|
||||
zText = (char *)sqliteMalloc((2*nBlob)+4);
|
||||
@ -654,7 +654,7 @@ static void quoteFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
|
||||
if( zArg==0 ) return;
|
||||
for(i=0, n=0; zArg[i]; i++){ if( zArg[i]=='\'' ) n++; }
|
||||
if( i+n+3>SQLITE_MAX_LENGTH ){
|
||||
sqlite3_result_error(context, "string too big to quote", -1);
|
||||
sqlite3_result_error_toobig(context);
|
||||
return;
|
||||
}
|
||||
z = sqliteMalloc( i+n+3 );
|
||||
@ -689,7 +689,7 @@ static void hexFunc(
|
||||
assert( argc==1 );
|
||||
n = sqlite3_value_bytes(argv[0]);
|
||||
if( n*2+1>SQLITE_MAX_LENGTH ){
|
||||
sqlite3_result_error(context, "BLOB too big to convert to hex", -1);
|
||||
sqlite3_result_error_toobig(context);
|
||||
return;
|
||||
}
|
||||
pBlob = sqlite3_value_blob(argv[0]);
|
||||
@ -764,7 +764,7 @@ static void replaceFunc(
|
||||
zOut[j++] = zStr[i];
|
||||
}else{
|
||||
if( (j+nRep+loopLimit-i)>SQLITE_MAX_LENGTH ){
|
||||
sqlite3_result_error(context, "replace() is too large", -1);
|
||||
sqlite3_result_error_toobig(context);
|
||||
sqlite3_free(zOut);
|
||||
return;
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
**
|
||||
** This file defines various limits of what SQLite can process.
|
||||
**
|
||||
** @(#) $Id: limits.h,v 1.3 2007/05/08 14:51:37 drh Exp $
|
||||
** @(#) $Id: limits.h,v 1.4 2007/05/08 15:15:02 drh Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -12,7 +12,7 @@
|
||||
** This header file defines the interface that the SQLite library
|
||||
** presents to client programs.
|
||||
**
|
||||
** @(#) $Id: sqlite.h.in,v 1.207 2007/05/08 01:08:49 drh Exp $
|
||||
** @(#) $Id: sqlite.h.in,v 1.208 2007/05/08 15:15:02 drh Exp $
|
||||
*/
|
||||
#ifndef _SQLITE3_H_
|
||||
#define _SQLITE3_H_
|
||||
@ -1224,6 +1224,7 @@ void sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*));
|
||||
void sqlite3_result_text16be(sqlite3_context*, const void*, int,void(*)(void*));
|
||||
void sqlite3_result_value(sqlite3_context*, sqlite3_value*);
|
||||
void sqlite3_result_zeroblob(sqlite3_context*, int n);
|
||||
void sqlite3_result_error_toobig(sqlite3_context*);
|
||||
|
||||
/*
|
||||
** These are the allowed values for the eTextRep argument to
|
||||
|
@ -156,6 +156,11 @@ void sqlite3_result_zeroblob(sqlite3_context *pCtx, int n){
|
||||
sqlite3VdbeMemSetZeroBlob(&pCtx->s, n);
|
||||
}
|
||||
|
||||
/* Force an SQLITE_TOOBIG error. */
|
||||
void sqlite3_result_error_toobig(sqlite3_context *pCtx){
|
||||
sqlite3VdbeMemSetZeroBlob(&pCtx->s, SQLITE_MAX_LENGTH+1);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Execute the statement pStmt, either until a row of data is ready, the
|
||||
|
Loading…
x
Reference in New Issue
Block a user