Re: [sqlite] two process problem

2007-02-05 Thread Dennis Cote

Joe Wilson wrote:

--- Dennis Cote <[EMAIL PROTECTED]> wrote:
  

On 2/3/07, Tom Shaw <[EMAIL PROTECTED]> wrote:


SQLSTATE[HY000]: General error: 1 SQL logic error or missing database
and
SQLSTATE[HY000]: General error: 8 attempt to write a readonly database
  

Tom what wrapper are you using to access sqlite?  These messages are not
from sqlite itself, but your wrapper. It may have restrictions that sqlite
does not.




He got this from sqlite3_errmsg() which in turn calls sqlite3ErrStr():

  

Joe,

I was asking about the other end of the messages. These parts are not 
produced by sqlite.


SQLSTATE[HY000]: General error: 1

SQLSTATE[HY000]: General error: 8


I suspect some wrapper added these prefixes to the standard sqlite error 
strings.

Dennis Cote


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] two process problem

2007-02-04 Thread Joe Wilson
--- Dennis Cote <[EMAIL PROTECTED]> wrote:
> On 2/3/07, Tom Shaw <[EMAIL PROTECTED]> wrote:
> > SQLSTATE[HY000]: General error: 1 SQL logic error or missing database
> > and
> > SQLSTATE[HY000]: General error: 8 attempt to write a readonly database
> 
> Tom what wrapper are you using to access sqlite?  These messages are not
> from sqlite itself, but your wrapper. It may have restrictions that sqlite
> does not.

$ grep 'SQL logic error or missing database' */*.c
src/main.c:case SQLITE_ERROR:  z = "SQL logic error or missing 
database";   break;
$ grep 'attempt to write a readonly database' */*.c
src/main.c:case SQLITE_READONLY:   z = "attempt to write a readonly 
database";  break;

He got this from sqlite3_errmsg() which in turn calls sqlite3ErrStr():

/*
** Return UTF-8 encoded English language explanation of the most recent
** error.
*/
const char *sqlite3_errmsg(sqlite3 *db){
  const char *z;
  if( !db || sqlite3MallocFailed() ){
return sqlite3ErrStr(SQLITE_NOMEM);
  }
  if( sqlite3SafetyCheck(db) || db->errCode==SQLITE_MISUSE ){
return sqlite3ErrStr(SQLITE_MISUSE);
  }
  z = (char*)sqlite3_value_text(db->pErr);
  if( z==0 ){
z = sqlite3ErrStr(db->errCode);
  }
  return z;
}

...

/*
** Return a static string that describes the kind of error specified in the
** argument.
*/
const char *sqlite3ErrStr(int rc){
  const char *z;
  switch( rc & 0xff ){
case SQLITE_ROW:
case SQLITE_DONE:
case SQLITE_OK: z = "not an error";  break;
case SQLITE_ERROR:  z = "SQL logic error or missing database";   break;
case SQLITE_PERM:   z = "access permission denied";  break;
case SQLITE_ABORT:  z = "callback requested query abort";break;
case SQLITE_BUSY:   z = "database is locked";break;
case SQLITE_LOCKED: z = "database table is locked";  break;
case SQLITE_NOMEM:  z = "out of memory"; break;
case SQLITE_READONLY:   z = "attempt to write a readonly database";  break;
case SQLITE_INTERRUPT:  z = "interrupted";   break;
case SQLITE_IOERR:  z = "disk I/O error";break;
case SQLITE_CORRUPT:z = "database disk image is malformed";  break;
case SQLITE_FULL:   z = "database or disk is full";  break;
case SQLITE_CANTOPEN:   z = "unable to open database file";  break;
case SQLITE_PROTOCOL:   z = "database locking protocol failure"; break;
case SQLITE_EMPTY:  z = "table contains no data";break;
case SQLITE_SCHEMA: z = "database schema has changed";   break;
case SQLITE_CONSTRAINT: z = "constraint failed"; break;
case SQLITE_MISMATCH:   z = "datatype mismatch"; break;
case SQLITE_MISUSE: z = "library routine called out of sequence";break;
case SQLITE_NOLFS:  z = "kernel lacks large file support";   break;
case SQLITE_AUTH:   z = "authorization denied";  break;
case SQLITE_FORMAT: z = "auxiliary database format error";   break;
case SQLITE_RANGE:  z = "bind or column index out of range"; break;
case SQLITE_NOTADB: z = "file is encrypted or is not a database";break;
default:z = "unknown error"; break;
  }
  return z;
}



 

Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] two process problem

2007-02-04 Thread Dennis Cote

On 2/3/07, Tom Shaw <[EMAIL PROTECTED]> wrote:



SQLSTATE[HY000]: General error: 1 SQL logic error or missing database
and
SQLSTATE[HY000]: General error: 8 attempt to write a readonly database



Tom what wrapper are you using to access sqlite?  These messages are not
from sqlite itself, but your wrapper. It may have restrictions that sqlite
does not.

Dennis Cote


Re: [sqlite] PS Re: [sqlite] two process problem

2007-02-03 Thread Jay Sprenkle

I have 2 processes running one is updating portions of a table and

>>one is inserting.
>
>
>Are you using threads? There are some issues using the same database
handle
>with multiple threads.

Each process is single threaded.



Your error messages don't look familiar. What language are you programming
in, and do you use a wrapper or call sqlite directly? Some details/code
might help debug it.


[sqlite] PS Re: [sqlite] two process problem

2007-02-03 Thread Tom Shaw

At 4:59 PM -0600 2/3/07, Jay Sprenkle wrote:

On 2/3/07, Tom Shaw <[EMAIL PROTECTED]> wrote:


I have 2 processes running one is updating portions of a table and
one is inserting.



Are you using threads? There are some issues using the same database handle
with multiple threads.


Each process is single threaded.

Tom

-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] two process problem

2007-02-03 Thread Tom Shaw

At 4:59 PM -0600 2/3/07, Jay Sprenkle wrote:

On 2/3/07, Tom Shaw <[EMAIL PROTECTED]> wrote:


I have 2 processes running one is updating portions of a table and
one is inserting.



Are you using threads? There are some issues using the same database handle
with multiple threads.


No, two separate processes

Tom


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



Re: [sqlite] two process problem

2007-02-03 Thread Jay Sprenkle

On 2/3/07, Tom Shaw <[EMAIL PROTECTED]> wrote:


I have 2 processes running one is updating portions of a table and
one is inserting.



Are you using threads? There are some issues using the same database handle
with multiple threads.
--
--
The PixAddixImage Collector suite:
http://groups-beta.google.com/group/pixaddix

SqliteImporter and SqliteReplicator: Command line utilities for Sqlite
http://www.reddawn.net/~jsprenkl/Sqlite

Cthulhu Bucks!
http://www.cthulhubucks.com


[sqlite] two process problem

2007-02-03 Thread Tom Shaw
I have 2 processes running one is updating portions of a table and 
one is inserting.


I don't accumulate updates but rather update a record at a time to 
keep the time of locking down. (eg begin update commit)  Likewise, I 
only insert one at a time for the same reason.


Each process works fine when running on its own yet when running them 
together I get errors such as:


SQLSTATE[HY000]: General error: 1 SQL logic error or missing database
and
SQLSTATE[HY000]: General error: 8 attempt to write a readonly database

I thought sqlite handled locks. What am I doing wrong?

TIA,

Tom


-
To unsubscribe, send email to [EMAIL PROTECTED]
-