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
diff --git a/src/date.c b/src/date.c
index 0f05226..f1230d6 100644
--- a/src/date.c
+++ b/src/date.c
@@ -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 @@
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 @@
}
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;