Re: [sqlite] Disk I/O errors

2019-02-24 Thread Rowan Worth
On Sun, 24 Feb 2019 at 01:55, Tim Streater  wrote:

> (sorry for the duplicate - vibrating finger).
>
> I have a hosted web site using the SQLite functions from PHP. The page
> where PHP is used was failing, and on investigation this is because an
> SQLite function called from within PHP is now returning:
>
> Code: 10 (SQLITE_IOERR)
> Msg:  disk I/O error
>
> I will be working with my hosting provider but, is there a way to get more
> specific information about this?
>

I don't know if it's tricky to arrange from php, but you can call
sqlite3_config(SQLITE_CONFIG_LOG, callback_function) to register a logging
function. sqlite will call it when I/O errors are encountered¹, and the
message it provides includes the underlying OS error code/message.

¹ and also at other times; you probably want to filter out SQLITE_BUSY and
SQLITE_SCHEMA events at least

The downside of this is that this is a global config change, and the
message doesn't always identify the affected database (but for I/O errors
the filename is generally there).

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


Re: [sqlite] Disk I/O errors

2019-02-24 Thread Jesse Rittner
No idea how you would call it from PHP, but the sqlite3_system_errno function
may also be of use for determining the underlying cause of the SQLITE_IOERR
error code. https://www.sqlite.org/c3ref/system_errno.html



--
Sent from: http://sqlite.1065341.n5.nabble.com/
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Disk I/O errors

2019-02-23 Thread Tim Streater
On 23 Feb 2019, at 19:30, Simon Slavin  wrote:

> On 23 Feb 2019, at 6:41pm, Tim Streater  wrote:
>
>>  The PHP interface to SQLite doesn't appear to give me access to the extended
>> codes, unfortunately.
>
> I used to do SQLite from PHP myself.  Hold on ...
>
> Bah.  I agree with you.  There doesn't seem to be any way to do it.  You can't
> even extend the library yourself to add the facility, short of compiling your
> own SQLite3 library.
>
> Everything else in your post suggests you're doing it right.  I have nothing
> to suggest.  I hope someone else does.

Well it's all mysteriously OK now. I'm asking for SSH access to the site so I 
can run the sqlite3 shell there, perhaps compiled here in my Linux VM to show 
extended error codes (if the shell doesn't already do that, I haven't checked 
yet.).

The hosting support people did say I was running with an old version of PHP so 
I've selected to run 5.6 now, and will probably crank that up to 7.2 to get a 
much more recent version of the sqlite library. I think what happened is they 
just removed my ability to *select* to run that older version, while leaving 
PHP 5.3 actually in place (the hosting console allows selection of PHP 
version). The errors I was seeing persisted with PHP 5.6 but as I say, seem to 
gone now.

I may be back if I have problems exposing extended error codes in the shell. 
I'd fogotten those existed, so that's something learnt today at any rate :-)

Thanks.


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


Re: [sqlite] Disk I/O errors

2019-02-23 Thread Dan Kennedy


On 24/2/62 00:55, Tim Streater wrote:

(sorry for the duplicate - vibrating finger).

I have a hosted web site using the SQLite functions from PHP. The page where 
PHP is used was failing, and on investigation this is because an SQLite 
function called from within PHP is now returning:

Code: 10 (SQLITE_IOERR)
Msg:  disk I/O error

I will be working with my hosting provider but, is there a way to get more 
specific information about this?


sqlite3_extended_errcode() will tell you a little more:

  https://www.sqlite.org/c3ref/errcode.html




SQLite version:  3.7.7.1
PHP version: 5.3.28

Thanks.



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


Re: [sqlite] Disk I/O errors

2019-02-23 Thread Simon Slavin
On 23 Feb 2019, at 6:41pm, Tim Streater  wrote:

> The PHP interface to SQLite doesn't appear to give me access to the extended 
> codes, unfortunately.

I used to do SQLite from PHP myself.  Hold on ...

Bah.  I agree with you.  There doesn't seem to be any way to do it.  You can't 
even extend the library yourself to add the facility, short of compiling your 
own SQLite3 library.

Everything else in your post suggests you're doing it right.  I have nothing to 
suggest.  I hope someone else does.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Disk I/O errors

2019-02-23 Thread Tim Streater
On 23 Feb 2019, at 18:10, Simon Slavin  wrote:

> On 23 Feb 2019, at 5:55pm, Tim Streater  wrote:
>
>>  I have a hosted web site using the SQLite functions from PHP. The page where
>> PHP is used was failing, and on investigation this is because an SQLite
>> function called from within PHP is now returning:
>> 
>> Code: 10 (SQLITE_IOERR)
>> Msg:  disk I/O error
>> 
>>  I will be working with my hosting provider but, is there a way to get more
>> specific information about this?
>
> Run this:
>
> 

Both (tiny) db's return 'ok'. This doesn't surprise me too much as I can FTP 
them to my local machine and run, without error, the same select that the 
webpage runs on them.

> Is the disk with the database on inside the computer running PHP ?  If not,
> how are you accessing it ?

Yes, both db that the webpage accesses are on the host machine.

> You can find more detail than just "_IOERROR" using this:
>
> 

The PHP interface to SQLite doesn't appear to give me access to the extended 
codes, unfortunately.



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


Re: [sqlite] Disk I/O errors

2019-02-23 Thread Simon Slavin
On 23 Feb 2019, at 5:55pm, Tim Streater  wrote:

> I have a hosted web site using the SQLite functions from PHP. The page where 
> PHP is used was failing, and on investigation this is because an SQLite 
> function called from within PHP is now returning:
> 
> Code: 10 (SQLITE_IOERR)
> Msg:  disk I/O error
> 
> I will be working with my hosting provider but, is there a way to get more 
> specific information about this?

Run this:



Just in case.

Is the disk with the database on inside the computer running PHP ?  If not, how 
are you accessing it ?

You can find more detail than just "_IOERROR" using this:



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