D. Richard Hipp wrote:
> 
> Better error messages are always a good idea.  But implementing them,  
> especially this one, can be much harder than you might expect.   
> Suggested patches are welcomed.  ;-)
> 

Point taken. :-)

This actually looks like it might be fairly simple to me.

Add a new error code in sqlite.h.in

#define SQLITE_CANTOPENTEMP 27   /* Unable to create a temporary file */

Add a test for the returned error in sqlite3PagerOpentemp() in pager.c 
which changes the existing error code into the new error code. This 
seems to be the only place that creates temporary files (which are 
signaled by a NULL path pointer), so the fix is well localized.

   rc = sqlite3OsOpen(pPager->pVfs, 0, pFile, vfsFlags, 0);
   if( rc == SQLITE_CANTOPEN ) rc = SQLITE_CANTOPENTEMP;

Add a case for the new error code in sqlite3ErrStr() in main.c

     case SQLITE_CANTOPENTEMP:   z = "unable to create a temporary 
file";          break;

And finally add suitable test cases. This step is left as an exercise 
for the reader. ;-)

Dennis Cote
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to