Re: [sqlite] SQlite database corrupt , PHP and multithread C program accessing same database

2016-06-28 Thread Simon Slavin
On 28 Jun 2016, at 4:24pm, mon siong wrote: > Yes , I always do this check before i proceed next step . if(rc != > SQLITE_OK){ } Very good. > I just crash my database with 1 thread keep reading , another thread keep > inserting . Here is how i open the DB connection .

Re: [sqlite] SQlite database corrupt , PHP and multithread C program accessing same database

2016-06-28 Thread mon siong
Yes , I always do this check before i proceed next step .  if(rc != SQLITE_OK){ } I just crash my database with 1 thread keep reading , another thread keep inserting . Here is how i open the DB connection . rc = sqlite3_open_v2(DEFAULT_FAILTS_DB,

Re: [sqlite] SQlite database corrupt , PHP and multithread C program accessing same database

2016-06-27 Thread Simon Slavin
Sorry, that should read > All API calls should return SQLITE_OK except for sqlite_step() which can > return SQLITE_ROW or SQLITE_DONE too. Any other code indicates a fault and > your program ... should crash ... > when it sees them, before more harm is done. Simon.

Re: [sqlite] SQlite database corrupt , PHP and multithread C program accessing same database

2016-06-27 Thread Simon Slavin
On 27 Jun 2016, at 3:53pm, mon siong wrote: > I intend to do error log callback . I want to terminate my program when an > operation could potentially cause my DB to corrupt to identify which code > actually cause this . > > Which Result code that i need to capture All

Re: [sqlite] SQlite database corrupt , PHP and multithread C program accessing same database

2016-06-27 Thread mon siong
Thanks Simon . I intend to do error log callback .  I want to terminate my program when an operation could potentially cause my DB to corrupt to identify which code actually cause this . Which Result code that i need to capture which could potentially cause my DB to corrupt ? SQLite Result

Re: [sqlite] SQlite database corrupt , PHP and multithread C program accessing same database

2016-06-26 Thread Simon Slavin
On 26 Jun 2016, at 4:11pm, mon siong wrote: > Open the database without close can cause DB corrupt ? Not if the software and hardware is working correctly. The next time you open the database SQLite will work out that it wasn't closed correctly and will

Re: [sqlite] SQlite database corrupt , PHP and multithread C program accessing same database

2016-06-26 Thread mon siong
Hi Scott     Open the database without close can cause DB corrupt ? On Friday, June 24, 2016 12:24 PM, Scott Robison wrote: On Thu, Jun 23, 2016 at 7:47 PM, mon siong wrote: > Thanks I will try internal hard drive. This is not

Re: [sqlite] SQlite database corrupt , PHP and multithread C program accessing same database

2016-06-23 Thread Scott Robison
On Thu, Jun 23, 2016 at 7:47 PM, mon siong wrote: > Thanks I will try internal hard drive. This is not virtual machine , my > application is running on linux ARM . > > 1) Make sure I need to check SQLITE_OK before i proceed to perform next > task 2) Move the sqlite file to

Re: [sqlite] SQlite database corrupt , PHP and multithread C program accessing same database

2016-06-23 Thread mon siong
Thanks I will try internal hard drive. This is not virtual machine , my application is running on linux ARM . 1) Make sure I need to check SQLITE_OK before i proceed to perform next task 2) Move the sqlite file to Internal hard drive 2) Add sqlite_3_config error log callback to find out which

Re: [sqlite] SQlite database corrupt , PHP and multithread C program accessing same database

2016-06-23 Thread Scott Robison
On Thu, Jun 23, 2016 at 11:08 AM, mon siong wrote: > > You have idea why the journal and shm file is corrupt ? > My first thought was a remote file system. My next instinct is to suspect the USB device or interface is suspect. Can you try it on an internal hard drive? Is

Re: [sqlite] SQlite database corrupt , PHP and multithread C program accessing same database

2016-06-23 Thread mon siong
You have idea why the journal and shm file is corrupt  ? From the previous Thread (http://mailinglists.sqlite.org/cgi-bin/mailman/private/sqlite-users/2016-January/063830.html),   you mention to use showdb to check the DB corrupt . Where to download the showdb program ? On Thursday,

Re: [sqlite] SQlite database corrupt , PHP and multithread C program accessing same database

2016-06-22 Thread mon siong
Both processes on a single computer accessing a local file system. The sqlite file is store in USB drive , and I notice if the database corrupt , the journal or shm file is also corrupt .  On Thursday, June 23, 2016 12:48 PM, Scott Robison wrote: On Jun

Re: [sqlite] SQlite database corrupt , PHP and multithread C program accessing same database

2016-06-22 Thread Scott Robison
On Jun 22, 2016 9:25 PM, "mon siong" wrote: > > > PHP use 3.7.7.1 and my c program use 3.8.4.3 . Different version of sqlite is fine ? > I tried WAL and Delete Journal Mode , both type cause the db to corrupt . > > Under which scenario, two different global variables will be

Re: [sqlite] SQlite database corrupt , PHP and multithread C program accessing same database

2016-06-22 Thread Scott Hess
On Wed, Jun 22, 2016 at 8:13 PM, Simon Slavin wrote: > On 23 Jun 2016, at 3:52am, mon siong wrote: >> PHP is using sqlite3 library (http://php.net/manual/en/book.sqlite3.php) >> and C program is handle the sqlite using Serialized. >> >> Both of them are

Re: [sqlite] SQlite database corrupt , PHP and multithread C program accessing same database

2016-06-22 Thread mon siong
PHP use 3.7.7.1 and my c program use 3.8.4.3 . Different version of sqlite is fine ? I tried WAL and Delete Journal Mode , both type cause the db to corrupt . Under which scenario, two different global variables will be used ? On Thursday, June 23, 2016 11:13 AM, Simon Slavin

Re: [sqlite] SQlite database corrupt , PHP and multithread C program accessing same database

2016-06-22 Thread Simon Slavin
On 23 Jun 2016, at 3:52am, mon siong wrote: > PHP is using sqlite3 library (http://php.net/manual/en/book.sqlite3.php) > and C program is handle the sqlite using Serialized. > > Both of them are accessing the same DB at the same time . This can cause DB > corrupt ? No.

[sqlite] SQlite database corrupt , PHP and multithread C program accessing same database

2016-06-22 Thread mon siong
 Hello My sqlite database corrupt recently, I suspecting this is due to the two different instances of SQLIte running on unix . And two different global variables is used . (By refering to the thread: http://mailinglists.sqlite.org/cgi-bin/mailman/private/sqlite-users/2016-May/066648.html) We