Re: [sqlite] Accessibility dependend on command and folder

2008-06-11 Thread maximi

Great Guys! Big Thanks to all of you!
I just set the directory of the calling script to writable and everythings
working fine now.
and as you suggested: would be great to have an appropriate error-message...

Max Fechner




Dennis Cote wrote:
> 
> 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
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Accessibility-dependend-on-command-and-folder-tp17764999p17786830.html
Sent from the SQLite mailing list archive at Nabble.com.

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


Re: [sqlite] Accessibility dependend on command and folder

2008-06-11 Thread Dennis Cote
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


Re: [sqlite] Accessibility dependend on command and folder

2008-06-11 Thread D. Richard Hipp

On Jun 11, 2008, at 10:07 AM, Dennis Cote wrote:

> D. Richard Hipp wrote:
>>> i always get the error "unable to open database file", error number
>>> is 14
>>>
>>
>> Probably it is unable to open a temporary file in /tmp or /var/tmp or
>> wherever temporary files are suppose to live on your system.
>>
>
> This situation seems to come up fairly often. Perhaps it would be a  
> good
> idea to return a different error for this situation, something like
> "unable to create temporary file", which would give users a more
> explicit indication of what the real problem is. I think most users  
> jump
> to the conclusion that this error always refers to the main database
> file, and the existing error doesn't give any indication that there
> could be other causes.
>

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.  ;-)

D. Richard Hipp
[EMAIL PROTECTED]



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


Re: [sqlite] Accessibility dependend on command and folder

2008-06-11 Thread Dennis Cote
D. Richard Hipp wrote:
>> i always get the error "unable to open database file", error number  
>> is 14
>>
> 
> Probably it is unable to open a temporary file in /tmp or /var/tmp or  
> wherever temporary files are suppose to live on your system.
> 

This situation seems to come up fairly often. Perhaps it would be a good 
idea to return a different error for this situation, something like 
"unable to create temporary file", which would give users a more 
explicit indication of what the real problem is. I think most users jump 
to the conclusion that this error always refers to the main database 
file, and the existing error doesn't give any indication that there 
could be other causes.

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


Re: [sqlite] Accessibility dependend on command and folder

2008-06-10 Thread D. Richard Hipp

On Jun 10, 2008, at 5:24 PM, maximi wrote:

>
> Hi
> im using php in a webapp to access a sqlite database. now since  
> hours i'm
> confronted with a weird error:
>
> i can access my database just fine, as long as i use commands as  
> simple as
> "select * from testtable where a='b'"
> as soon as there comes any 'distinct' or 'order by' or 'group by'  
> into play,
> i always get the error "unable to open database file", error number  
> is 14
> (which should be just that) and there is another error code: hy000
>
> anybody an idea??
>

Probably it is unable to open a temporary file in /tmp or /var/tmp or  
wherever temporary files are suppose to live on your system.

D. Richard Hipp
[EMAIL PROTECTED]



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