diff options
author | drh <drh@noemail.net> | 2007-05-08 15:15:02 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2007-05-08 15:15:02 +0000 |
commit | a0206bc81c7b709e5737eadcfbbcbcf11d49e0c1 (patch) | |
tree | 47df734ba61443d5c01eab60636cc682617d2de0 /src/func.c | |
parent | f8e632b630c57bc61ba6b8ddfdc6ad0ee56d03c6 (diff) | |
download | sqlite-a0206bc81c7b709e5737eadcfbbcbcf11d49e0c1.tar.gz sqlite-a0206bc81c7b709e5737eadcfbbcbcf11d49e0c1.zip |
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
Diffstat (limited to 'src/func.c')
-rw-r--r-- | src/func.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/func.c b/src/func.c index b6ac068a2..6c3cfdb78 100644 --- a/src/func.c +++ b/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; } |