[sqlite] Performance Difference on Linux Kernel 2.4 and Kernel 2.6

2006-03-31 Thread Phuah Yee Keat

Hi,

I would like to take a shot at asking this question here instead of
Linux kernel mailing list just in case anyone here have encountered this
issue before.

I am running sqlite 3.3.4.

On a desktop slackware 10.2 machine, I have installed two stock kernels
2.4.31 and 2.6.13. The box is using reiserfs.

I have attached a script that I use to generate a sql script to test.

The 2.4 kernel took 5 seconds to finish the sql script but the 2.6
kernel took 50 seconds. Here are the GNU time output:

Kernel 2.4===>
0.31user 1.54system 0:06.27elapsed 29%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (686major+184minor)pagefaults 0swaps

Kernel 2.6===>
0.48user 1.40system 0:52.24elapsed 3%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+1040minor)pagefaults 0swaps

Any help will be greatly appreciated. I could provide more information
on the system as required.

Thanks in advance,
Phuah Yee Keat

#!/usr/bin/perl

printf "DROP TABLE IF EXISTS t1;\n";
printf "CREATE TABLE t1(a INTEGER, b INTEGER);\n";
for ($i=0;$i<1000;$i++) {
$r = int(rand())*10;
printf("INSERT INTO t1 VALUES(%d,%d);\n", $i, $r);
}


Re: [sqlite] Performance Difference on Linux Kernel 2.4 and Kernel 2.6

2006-03-31 Thread drh
Phuah Yee Keat <[EMAIL PROTECTED]> wrote:
> Hi,
> 
> I would like to take a shot at asking this question here instead of
> Linux kernel mailing list just in case anyone here have encountered this
> issue before.
> 
> I am running sqlite 3.3.4.
> 
> On a desktop slackware 10.2 machine, I have installed two stock kernels
> 2.4.31 and 2.6.13. The box is using reiserfs.
> 
> I have attached a script that I use to generate a sql script to test.
> 
> The 2.4 kernel took 5 seconds to finish the sql script but the 2.6
> kernel took 50 seconds. Here are the GNU time output:
> 
> Kernel 2.4===>
> 0.31user 1.54system 0:06.27elapsed 29%CPU (0avgtext+0avgdata 0maxresident)k
> 0inputs+0outputs (686major+184minor)pagefaults 0swaps
> 
> Kernel 2.6===>
> 0.48user 1.40system 0:52.24elapsed 3%CPU (0avgtext+0avgdata 0maxresident)k
> 0inputs+0outputs (0major+1040minor)pagefaults 0swaps
> 
> Any help will be greatly appreciated. I could provide more information
> on the system as required.
> 

Your script requires 1002 separate ACID transactions.  Each such
transaction should require at least 2 complete revolutions of your
disk drive platter - meaning that the minimum time to complete your
script should be 16 seconds.

The 2.4 kernel finished faster than this, which tells me that the
2.4 kernel probably does not implement the fsync() system call
correctly.  I have heard reports of this but could not verify
it.  What this means is that if you loose power unexpectedly,
the 2.4 kernel might corrupt your database.  Probably since the
ReiserFS does a good job of journalling itself, you won't corrupt
the database, but your transactions will certainly not be Durable.

The 2.6 kernel is much slower because reiserFS is inefficient in
its implementation of fsync().

You script does not measure how fast SQLite processes inserts.  It
measure how fast it does transacxtions.  If you put a BEGIN and
a COMMIT at the beginning and end of your script, I think you will
find that the whole thing will run in a fraction of a second under
either kernel.

--
D. Richard Hipp   <[EMAIL PROTECTED]>



[sqlite] Creating tables with open statements

2006-03-31 Thread Matthew Gertner

Hi,

I'm trying to detect changes in our application schema and update the 
corresponding database schema automatically, but only when the table in 
question is actually needed (i.e. a sort of on-demand schema update). 
The problem I'm having is when other statements are open when this 
occurs, in which case I seem to be getting a "SQL logic error or missing 
database" error when I try to run CREATE TABLE.


For example, imagine I have a statement that I'm iterating. One of the 
results requires that I retrieve additional info from another table 
(e.g. for a dependent or child object). Before I do that, I determine 
that the schema for the application object stored in that second table 
has changed. So I call:


ALTER TABLE foo RENAME TO _foo;
CREATE TABLE foo;
INSERT INTO foo SELECT [automatic generated column list for conversion] 
FROM _foo;

DROP TABLE _foo;

But I get the above-mentioned error when CREATE TABLE is executed. Note 
that I call BEGIN IMMEDIATE before preparing the original statement that 
I'm iterating, so all of this is happening inside a transaction.


Is there a hard restriction on creating tables while statements are 
open? If not, can anyone shed any light on the specific circumstances 
which might be causing this error?


Thanks in advance,
Matt



Re: [sqlite] Creating tables with open statements

2006-03-31 Thread Jay Sprenkle
On 3/31/06, Matthew Gertner <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm trying to detect changes in our application schema and update the
> corresponding database schema automatically, but only when the table in
> question is actually needed (i.e. a sort of on-demand schema update).
> The problem I'm having is when other statements are open when this
> occurs, in which case I seem to be getting a "SQL logic error or missing
> database" error when I try to run CREATE TABLE.
>

Your statements must be prepared again after the schema changes.
It's a limitation of the sqlite package.


Re: [sqlite] Creating tables with open statements

2006-03-31 Thread Matthew Gertner

Jay Sprenkle wrote:


On 3/31/06, Matthew Gertner <[EMAIL PROTECTED]> wrote:
 


Hi,

I'm trying to detect changes in our application schema and update the
corresponding database schema automatically, but only when the table in
question is actually needed (i.e. a sort of on-demand schema update).
The problem I'm having is when other statements are open when this
occurs, in which case I seem to be getting a "SQL logic error or missing
database" error when I try to run CREATE TABLE.

   



Your statements must be prepared again after the schema changes.
It's a limitation of the sqlite package.
 

The SQLITE_SCHEMA case is handled in our code. But in this case, we are 
in the middle of iterating a statement. Can we prepare it again without 
"losing our place"? Is this the right action considering that we are 
getting a SQLITE_ERROR when executing the statement, not SQLITE_SCHEMA?


Matt



Re: [sqlite] quote() and constraints

2006-03-31 Thread jt
On 3/29/06, Pam Greene <[EMAIL PROTECTED]> wrote:
> On 3/29/06, jt <[EMAIL PROTECTED]> wrote:
> >
> > Hi,
> >
> > I'm implementing a log procedure with triggers on my tables (following
> > some ideas found in http://www.sqlite.org/cvstrac/wiki?p=UndoRedo).
> > As I have more than one table, I'm generating the relevant SQL to do the
> > job.
> > I use the quote() function to quote each value of each row.
> >
> > The problem is that " SELECT quote('foo')!='foo' ": when I tried to
> > load the log table in another database, I get "SQL error; constraint
> > failed" on every row that has a CHECK constraint.
> > The quick solution is to add quote() around each value in the CHECK
> > statement.
> >
> > Is there another way to do it?
> > Why is " SELECT quote('foo')!='foo' "?
>
>
> quote('foo') returns 'foo', including the ' '.  The 'foo' on your right-hand
> side doesn't include the quotes.
>
> - Pam
>
>

thanks.
I was using it in the wrong way. I should have rtfm.

--
jt


Re: [sqlite] Creating tables with open statements

2006-03-31 Thread Jay Sprenkle
> The SQLITE_SCHEMA case is handled in our code. But in this case, we are
> in the middle of iterating a statement. Can we prepare it again without
> "losing our place"? Is this the right action considering that we are
> getting a SQLITE_ERROR when executing the statement, not SQLITE_SCHEMA?

I'm sorry, I'd just be guessing at an answer.
My guess is you cannot keep your place if you re-prepare a statement.


[sqlite] SQLITE_BUSY [5] database is locked

2006-03-31 Thread Paul Pigott
Greetings all,

I imagine this has been covered before, but I've been through the archives and 
couldn't find what I needed.  So I'm appealing to a larger authority.

I am writing some C++ objects to handle access to a database.  Two of them are 
virtually identical: C_DAOService and C_DAOPerformer.  To test these classes, 
I've written some scaffolding that simply reads, writes and deletes from the 
tables using these classes.

The C_DAOService class works fine.  It gives me no problems.  But when I try to 
insert a row with the C_DAOPerformer class, I'm getting an "SQLITE_BUSY [5] 
database is locked" error.  And I don't know why.

I'm using SQLITE 3.0.7, and the CppSQLite3 wrapper code on a Windows XP home 
edition box.  I've never had any problems before this.  The C_DAOPerformer code 
in question is...


bool C_DAOPerformer::PerformerModify( performerinfoStruct pi, bool exists )
{
   bool retVal = true;
   bool commitOn = false;
   char tempsrvc[30];
   char *sqlinsert = "insert into performers ( active, useforfill, solosperqtr, 
ofersperqtr, preperqtr, postperqtr, performerid, fname, lname ) values ( ?, ?, 
?, ?, ?, ?, ?, ?, ? )";
   char *sqlupdate = "update performers set active = ?, useforfill = ?, 
solosperqtr = ?, ofersperqtr = ?, preperqtr = ?, postperqtr = ? where 
performerid = ?";
   char *sqlnewsrvc = "insert into performswhen( srvcid, performerid ) values ( 
?, ? )";
   char *sqldelsrvc = "delete from performswhen where srvcid = ? and 
performerid = ?";

  CppSQLite3DB db;

  try {
  CppSQLite3Statement stmt;

  cout << "C_DAOPerformer\tOpening Database\n";
  db.open(MMHDB);

  /*
  cout << "C_DAOPerformer\tBeginning Transaction\n";
  db.execDML("begin transaction");
  commitOn = true;
  */

  // ==
  // Modify or insert a performer
  // ==
  if ( exists ) {
   cout << "C_DAOPerformer\tCompiling Update Statement\n";
   stmt = db.compileStatement(sqlupdate);
  } else {
   cout << "C_DAOPerformer\tCompiling Insert Statement\n";
   stmt = db.compileStatement(sqlinsert);
  }

  cout << "C_DAOPerformer\tBinding values\n";
  stmt.bind(1, pi.iStatus);
  stmt.bind(2, pi.iUseForFill);
  stmt.bind(3, pi.iSolosPer);
  stmt.bind(4, pi.iOffertoriesPer);
  stmt.bind(5, pi.iPreludesPer);
  stmt.bind(6, pi.iPostludesPer);
  stmt.bind(7, pi.szIdCurr);

  if ( !exists ) {
   stmt.bind(8, pi.szFirstName);
   stmt.bind(9, pi.szLastName);
  }


  cout << "C_DAOPerformer\tExecuting DML\n";
  int rows = stmt.execDML();
  if ( rows == 0 )
   retVal = false;
  

  /*
  // ==
  // Delete any services that are being removed
  // ==
  cout << "C_DAOPerformer\tRemoving Services from performer\n";
  stmt = db.compileStatement(sqldelsrvc);
  for( UINT i = 0, j = pi.vSrvcDel.size(); i < j; i++ ) {
 strcpy( tempsrvc, pi.vSrvcDel[i].c_str() );
 stmt.bind(1, tempsrvc);
 stmt.bind(2, pi.szIdCurr);
 stmt.execDML();
 stmt.reset();
  }

  // 
  // Add any new services
  // 
  cout << "C_DAOPerformer\tAdding Services to performer\n";
  stmt = db.compileStatement(sqlnewsrvc);
  for( UINT i = 0, j = pi.vSrvcAdd.size(); i < j; i++ ) {
 strcpy( tempsrvc, pi.vSrvcAdd[i].c_str() );
 stmt.bind(1, tempsrvc);
 stmt.bind(2, pi.szIdCurr);
 stmt.execDML();
 stmt.reset();
  }
  */

  // ==
  // Commit changes
  // ==
  /*
  cout << "C_DAOPerformer\tCommitting transaction\n";
  db.execDML("commit transaction");
  commitOn = false;
  */

  cout << "C_DAOPerformer\tClosing database\n";
  db.close();

   } catch (CppSQLite3Exception& e) {
if ( commitOn )
 db.execDML("rollback");

  char msg[300];
  sprintf( msg, "SQLite Error: (%i) %s", e.errorCode(), e.errorMessage() );
  MessageBox( GetActiveWindow(), msg, "Database Error", MB_OK | 
MB_ICONERROR );
  retVal = false;
   }

   return retVal;
}



When I execute this from the Command line, this is what I get.



T14.  Inserting record...
C_DTOPerformer::insertInfo()
C_DTOPerformer::insertInfo()DAO Instance gotten
C_DAOPerformer  Opening Database
C_DAOPerformer  Compiling Insert Statement
C_DAOPerformer  Binding values
C_DAOPerformer  Executing DML
C_DTOPerformer::insertInfo()DAO executed



The function gets as far as the Executing DML line, then it stops.  After some 
seconds, a message box appears with the error message in it.

Any ideas from anyone would be greatly appreciated.

TIA,

Paul



Re: [sqlite] improving query performance

2006-03-31 Thread Dennis Cote
On 3/30/06, Dennis Cote <[EMAIL PROTECTED]> wrote:
>
>
> Another approach is to remove your primary key. If you don't need it to
> enforce uniqueness constraints on your data then you could eliminate the
> primary key, and change the EntryId column into an integer primary key
> column. This primary key is not stored as a separate index table, it is
> stored in the key fields of the Btree used to hold the data table.
>
> create table Data (
> EntryId INTEGER PRIMARY KEY,
> PropertyId INTEGER,
> Value NUMERIC
> );
>
> Now you truly won't have any indexes, and your inserts and updates will
> run as quickly as possible. Also when you search for an EntryId and
> PropertyId pair, SQLite will use the index on EntryId to locate the
> correct section in the data table quickly, and then it will scan through
> the rows with that EntryId sequentially looking for a matching
> PropertyId. You didn't say how many properties each entry has, but for
> reasonable values this may be faster than fully indexed lookup because
> it eliminates half of the disk reads and should reduce the cache
> thrashing. This will also reduce the size of your database file to about
> half of its current size by eliminating the index and storing the
> EntryId in the rowid of the Data table.


Soory about the self reply, but I got to thinking about my suggestion later
and realized that this part was complete crap! Integer primary key fields
must be unique, so this could only store one property for each entry. Please
ignore this blather.

Dennis Cote


Re: [sqlite] SQLITE_BUSY [5] database is locked

2006-03-31 Thread Jay Sprenkle
On 3/31/06, Paul Pigott <[EMAIL PROTECTED]> wrote:
> Greetings all,

Greetings :)

> The C_DAOService class works fine.  It gives me no problems.  But when I try 
> to insert a row with the C_DAOPerformer class, I'm getting an "SQLITE_BUSY 
> [5] database is locked" error.  And I don't know why.

do you need
stmt.reset();
after this exec()?

>   cout << "C_DAOPerformer\tExecuting DML\n";
>   int rows = stmt.execDML();
>   if ( rows == 0 )
>retVal = false;

---
SqliteImporter: Command line fixed and delimited text import.
http://www.reddawn.net/~jsprenkl/Sqlite


[sqlite] Question regarding schema change error

2006-03-31 Thread Andrew Shakinovsky
I am having a minor issue with schema changes and am looking for the
best solution/workaround. I am using the latest released version of
Sqlite, by the way.
 
I have a database which needs to be accessed by multiple
users/processes. During it's lifetime it will have tables added to it
periodically through a CREATE TABLE statement. The problem I am running
into is that
when the sqlite3_step function is called, I receive a SQLITE_SCHEMA
error notifying me that the schema
has changed. According to the docs, I am asked to finalize the
statement, and re-prepare it. Unfortunately
this doesn't fit nicely into my architecture. The thing is, in 99.9% of
the time, the error would be received on the first call to sqlite3_step.
It looks like the call to sqlite3_prepare is not checking for schema
changes, whereas the call to sqlite3_step is. Example with two processes
connected to the db:
 
Process 1 issues CREATE TABLE XYZ
Process 2 issues a sqlite3_prepare to run a SELECT STATEMENT (no error
returned even though the schema has changed since process 2 opened the
database).
Process 2 then issues a sqlite3_step which comes into the code handled
by the "case OP_VerifyCookie". At this point it sees that the schema has
changed and I get the error. 
 
Obviously it would be more helpful if the prepare function would do the
schema check. I am also aware that between the time the prepare is run,
and the first step is called, process 1 may have issued a CREATE TABLE
(as opposed to before prepare is called). To mitigate that, I was
thinking to have process 1 start an exclusive transaction thereby
causing process 2 to wait before running the select. The problem is, as
I mentioned, the schema check is not done during a prepare. My other
problem is that if I start an exclusive transaction on process 1,
process 2 still allows the prepare to go through, but fails (or waits)
on the first call to step.
 
Has anyone else encountered this? 
My workaround would be to use pragma schema_version to get the initial
schema, and then call it again before the prepare. If it has changed,
since I can find no clean way of getting the schema reloaded, I would
either close and reopen the database, or I would issue a SELECT against
a bogus table which apparently causes it to flag the schema to be
updated. This would solve most of my issue. To solve the other part of
my issue, I might try to start an exclusive transaction in process 2
before it does the prepare, and end it after the data has been read.
However this would make the database less responsive to multiple users.
Any other ideas?
 


Re: [sqlite] SQLITE_BUSY [5] database is locked

2006-03-31 Thread Paul Pigott
I tried it.  Apparently the error gets thrown by the stmt.execDML()
statement. It never makes it to any code past the execDML.

Paul

- Original Message - 
From: "Jay Sprenkle" <[EMAIL PROTECTED]>
To: 
Sent: Friday, March 31, 2006 10:49 AM
Subject: Re: [sqlite] SQLITE_BUSY [5] database is locked


On 3/31/06, Paul Pigott <[EMAIL PROTECTED]> wrote:
> Greetings all,

Greetings :)

> The C_DAOService class works fine.  It gives me no problems.  But when I
try to insert a row with the C_DAOPerformer class, I'm getting an
"SQLITE_BUSY [5] database is locked" error.  And I don't know why.

do you need
stmt.reset();
after this exec()?

>   cout << "C_DAOPerformer\tExecuting DML\n";
>   int rows = stmt.execDML();
>   if ( rows == 0 )
>retVal = false;

---
SqliteImporter: Command line fixed and delimited text import.
http://www.reddawn.net/~jsprenkl/Sqlite



[sqlite] Re: Question regarding schema change error

2006-03-31 Thread Igor Tandetnik

Andrew Shakinovsky
 wrote:

I have a database which needs to be accessed by multiple
users/processes. During it's lifetime it will have tables added to it
periodically through a CREATE TABLE statement. The problem I am
running into is that
when the sqlite3_step function is called, I receive a SQLITE_SCHEMA
error notifying me that the schema
has changed. According to the docs, I am asked to finalize the
statement, and re-prepare it. Unfortunately
this doesn't fit nicely into my architecture.


Nevertheless, this appears to be the best solution to the problem at 
this time. Why is it difficult for you?



The thing is, in 99.9%
of the time, the error would be received on the first call to
sqlite3_step.


100% of the time, actually. Once step succeeds, and until reset or 
finalize, there is a read transaction (a SHARED lock) against the 
database. Any schema change is a write operation and cannot proceed in 
the presence of active readers.



It looks like the call to sqlite3_prepare is not
checking for schema changes, whereas the call to sqlite3_step is.


Prepare cannot check for schema changes. It is not unusual to prepare a 
statement once at the beginning of the program, and keep a prepared 
statement around for a long time, executing it multiple times as 
necessary. The existence of a prepared statement does not by itself lock 
the database, so schema could easily change between prepare and step.


Also, database schema is cached in memory when the database is opened, 
and prepare works against this cached schema. Checking for schema change 
at this point would require a disk read, which would be a rather 
poinless waste of time in view of the previous issue. Schema change is 
detected as a side effect of any database read - normally when you call 
step - at which point in-memory snapshot is updated.


Igor Tandetnik 



[sqlite] sqlite3 dll symbols

2006-03-31 Thread Essien Essien
hiya,

I have a code snippet that looks like:

typedef int (*SQLITE3_CLOSE)(sqlite3*);
typedef const char* (*SQLITE3_ERRMSG)(sqlite3*);
typedef int (*SQLITE3_OPEN)(const char*, sqlite3**);
typedef int (*SQLITE3_EXEC) (sqlite3*, const char*, sqlite3_callback, void*,
char**);

HINSTANCE sqlite3_dll;

SQLITE3_CLOSE _sqlite3_close;
SQLITE3_ERRMSG _sqlite3_errmsg;
SQLITE3_OPEN _sqlite3_open;
SQLITE3_EXEC _sqlite3_exec;

int DB_Init()
{
sqlite3_dll = LoadLibrary("sqlite3.dll");
if (sqlite3_dll == NULL) {
 printf("Cannot find sqlite3.dll. Make sure its in the same
directory as the program\n");
 return 0;
}

_sqlite3_open = (SQLITE3_OPEN)GetProcAddress(sqlite3_dll,
"sqlite3_open");
if (_sqlite3_open == NULL) {
printf("Cannot load function sqlite3_open");
return 0;
}
}

problem is, when ever i call DB_Init(), it always fails with 'Cannot load
function sqlite3_open'. But it successfully passes the LoadLibrary portion.
I'm not a win32 guru, so i'm willing to admit i've made a mistake somewhere.

Any ideas on what i'm doing wrong?

I'm using Turbo C++ 4.5 IDE and related tools. (yeah... i know turbo
C++ 4.5is realy aged, but could this be the problem?)

Essien


[sqlite] Re: sqlite3 dll symbols

2006-03-31 Thread Igor Tandetnik

Essien Essien <[EMAIL PROTECTED]> wrote:

_sqlite3_open = (SQLITE3_OPEN)GetProcAddress(sqlite3_dll,
"sqlite3_open");
if (_sqlite3_open == NULL) {
printf("Cannot load function sqlite3_open");
return 0;
}
}

I'm using Turbo C++ 4.5 IDE and related tools. (yeah... i know turbo
C++ 4.5is realy aged, but could this be the problem?)


I believe Turbo C++ can only produce Win16 executables. A Win16 
executable can load a Win32 DLL but cannot call functions in it without 
jumping through extremely complicated hoops:


http://msdn.microsoft.com/library/en-us/winprog/winprog/generic_thunks.asp
http://msdn.microsoft.com/archive/en-us/win9x/tc_0cz6.asp

I would not recommend this route except when somebody is holding a gun 
to your head. You'll make your life a lot easier by using a modern 
compiler capable of producing Win32 executables. Visual C++ Express 
Edition is one such compiler, available from your friendly operating 
system vendor at no charge:


http://msdn.microsoft.com/vstudio/express/visualc/

Igor Tandetnik 



Re: [sqlite] Re: sqlite3 dll symbols

2006-03-31 Thread Essien Essien
On 3/31/06, Igor Tandetnik <[EMAIL PROTECTED]> wrote:
>
> Essien Essien <[EMAIL PROTECTED]> wrote:
> > _sqlite3_open = (SQLITE3_OPEN)GetProcAddress(sqlite3_dll,
> > "sqlite3_open");
> > if (_sqlite3_open == NULL) {
> > printf("Cannot load function sqlite3_open");
> > return 0;
> > }
> > }
> >
> > I'm using Turbo C++ 4.5 IDE and related tools. (yeah... i know turbo
> > C++ 4.5is realy aged, but could this be the problem?)
>
> I believe Turbo C++ can only produce Win16 executables. A Win16
> executable can load a Win32 DLL but cannot call functions in it without
> jumping through extremely complicated hoops:
>
> http://msdn.microsoft.com/library/en-us/winprog/winprog/generic_thunks.asp
> http://msdn.microsoft.com/archive/en-us/win9x/tc_0cz6.asp
>
> I would not recommend this route except when somebody is holding a gun
> to your head. You'll make your life a lot easier by using a modern
> compiler capable of producing Win32 executables. Visual C++ Express
> Edition is one such compiler, available from your friendly operating
> system vendor at no charge:
>
> http://msdn.microsoft.com/vstudio/express/visualc/
>
> Igor Tandetnik
>
>
wow!

Thanks for the quick reply.

To put it more succinctly... i think i'm fscked, since i _have_ to do this
with Turbo C++/Borland C++. It's not a life-threatening project anyways, its
a little assignment/project for a friend. I guess i'm just going to have to
build a poor man's sruct-to-binary-file-database then.

Once again thnx. At least... it wasn't my flat out fault ;)

Essien


RE: [sqlite] Re: Question regarding schema change error

2006-03-31 Thread Andrew Shakinovsky
 

> -Original Message-
> From: Igor Tandetnik [mailto:[EMAIL PROTECTED] 
> Sent: Friday, March 31, 2006 12:14 PM
> To: SQLite
> Subject: [sqlite] Re: Question regarding schema change error
> 
...
> 
> > The thing is, in 99.9%
> > of the time, the error would be received on the first call to 
> > sqlite3_step.
> 
> 100% of the time, actually. Once step succeeds, and until 
> reset or finalize, there is a read transaction (a SHARED 
> lock) against the database. Any schema change is a write 
> operation and cannot proceed in the presence of active readers.

Ok, I was under the assumption that a schema change after one or more
calls
to step could cause the SQLITE_SCHEMA error. Thanks for pointing that
out.


[sqlite] Question

2006-03-31 Thread Bill Giannotti
I have never installed the sqlite database, do not know  how it got
initiated on my computer or how it got invoked by my computer or programs,
but I am getting lots of files filling up my temp directory of the form
"sqlite_gibberish" with no extension, as well as files of the form
"ver1a.tmp, ver1b.tmp, ver2a.tmp", etc.  Plus my virus update notifier is
getting very active, telling me every couple of minutes that my software has
been updated.

When this first started last week, I decided to reformat the disk and
reinstall the O/S, especially since it just came back from a repair shop.
But it started again, and so there must be something I am using to invoke
this, probably from the web.  I am running Win XP SP2, have AOL and AOL
Security Center with McAfee

Can anyone give me any clue on how this started and how to make it stop?

Thanks!

Bill


Re: [sqlite] Question

2006-03-31 Thread Dennis Cote

Bill Giannotti wrote:


I have never installed the sqlite database, do not know  how it got
initiated on my computer or how it got invoked by my computer or programs,
but I am getting lots of files filling up my temp directory of the form
"sqlite_gibberish" with no extension, as well as files of the form
"ver1a.tmp, ver1b.tmp, ver2a.tmp", etc.  Plus my virus update notifier is
getting very active, telling me every couple of minutes that my software has
been updated.

When this first started last week, I decided to reformat the disk and
reinstall the O/S, especially since it just came back from a repair shop.
But it started again, and so there must be something I am using to invoke
this, probably from the web.  I am running Win XP SP2, have AOL and AOL
Security Center with McAfee

Can anyone give me any clue on how this started and how to make it stop?

Thanks!

Bill

 


Bill,

This has been discussed here before. See

http://thread.gmane.org/gmane.comp.db.sqlite.general/17429

and this ticket

http://www.sqlite.org/cvstrac/tktview?tn=1698

If you can't find out what program is creating the files by using 
ProcessExplorer or FileMon from SysInternals (both good programs that 
are easy to install and simple to use), could you try zipping up one of 
those sqlite_gibberish files and attaching it to ticket #1698 (use the 
link above and then click on "Attach" near the upper right corner of the 
page).


Please let us know what you find.

Dennis Cote




Re: [sqlite] Question

2006-03-31 Thread Dennis Cote

Bill Giannotti wrote:


I have never installed the sqlite database, do not know  how it got
initiated on my computer or how it got invoked by my computer or programs,
but I am getting lots of files filling up my temp directory of the form
"sqlite_gibberish" with no extension, as well as files of the form
"ver1a.tmp, ver1b.tmp, ver2a.tmp", etc.  Plus my virus update notifier is
getting very active, telling me every couple of minutes that my software has
been updated.

When this first started last week, I decided to reformat the disk and
reinstall the O/S, especially since it just came back from a repair shop.
But it started again, and so there must be something I am using to invoke
this, probably from the web.  I am running Win XP SP2, have AOL and AOL
Security Center with McAfee

Can anyone give me any clue on how this started and how to make it stop?

Thanks!

Bill

 


Bill,

I found another thread with similar problems being discussed.

http://thread.gmane.org/gmane.comp.db.sqlite.general/17466

I think you have a DOS program that is using temporary files that are 
not being deleted properly. The question is, which program?


Also there is no sense attaching one of the sqlite_gibberish files if 
its size is zero bytes.


Dennis Cote


Re: [sqlite] sqlite3 dll symbols

2006-03-31 Thread Dennis Jenkins
Essien Essien wrote:
> hiya,
>
> I have a code snippet that looks like:
>
> typedef int (*SQLITE3_CLOSE)(sqlite3*);
> typedef const char* (*SQLITE3_ERRMSG)(sqlite3*);
> typedef int (*SQLITE3_OPEN)(const char*, sqlite3**);
> typedef int (*SQLITE3_EXEC) (sqlite3*, const char*, sqlite3_callback, void*,
> char**);
>
> HINSTANCE sqlite3_dll;
>
> SQLITE3_CLOSE _sqlite3_close;
> SQLITE3_ERRMSG _sqlite3_errmsg;
> SQLITE3_OPEN _sqlite3_open;
> SQLITE3_EXEC _sqlite3_exec;
>
> int DB_Init()
> {
> sqlite3_dll = LoadLibrary("sqlite3.dll");
> if (sqlite3_dll == NULL) {
>  printf("Cannot find sqlite3.dll. Make sure its in the same
> directory as the program\n");
>  return 0;
> }
>
> _sqlite3_open = (SQLITE3_OPEN)GetProcAddress(sqlite3_dll,
> "sqlite3_open");
> if (_sqlite3_open == NULL) {
> printf("Cannot load function sqlite3_open");
> return 0;
> }
> }
>
> problem is, when ever i call DB_Init(), it always fails with 'Cannot load
> function sqlite3_open'. But it successfully passes the LoadLibrary portion.
> I'm not a win32 guru, so i'm willing to admit i've made a mistake somewhere.
>
> Any ideas on what i'm doing wrong?
>
> I'm using Turbo C++ 4.5 IDE and related tools. (yeah... i know turbo
> C++ 4.5is realy aged, but could this be the problem?)
>
> Essien
>
>   

Since you have the borland compiler product, use the "TDUMP.EXE" tool to
view the PE header of the sqlite3.dll file.  Sometimes the functions
will be exported with a leading underscore.  If your compiler is
producing 32 bit binaries, and the DLL is also 32 bit, then you might
try adding a leading underscore to the symbol name when you call
'GetProcAddress'.



[sqlite] SQLite & Palm!

2006-03-31 Thread Clay Dowling
Just got news about SQLite being available on the next generation of
PalmOS systems (which is Linux based).  This is fantastic news from the
perspective of somebody looking to start Palm development.  The concept of
a Palm device that I can ssh to is also somewhat amusing.

So has ACCESS or PalmSource been good enough to purchase a support contract?

Clay Dowling
-- 
Simple Content Management
http://www.ceamus.com



RE: [sqlite] Question

2006-03-31 Thread Bill Giannotti
Thank you very much.  I will check this out and let you know or attach the
file(s).

Bill

-Original Message-
From: Dennis Cote [mailto:[EMAIL PROTECTED]
Sent: Friday, March 31, 2006 12:03 PM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] Question


Bill Giannotti wrote:

>I have never installed the sqlite database, do not know  how it got
>initiated on my computer or how it got invoked by my computer or programs,
>but I am getting lots of files filling up my temp directory of the form
>"sqlite_gibberish" with no extension, as well as files of the form
>"ver1a.tmp, ver1b.tmp, ver2a.tmp", etc.  Plus my virus update notifier is
>getting very active, telling me every couple of minutes that my software
has
>been updated.
>
>When this first started last week, I decided to reformat the disk and
>reinstall the O/S, especially since it just came back from a repair shop.
>But it started again, and so there must be something I am using to invoke
>this, probably from the web.  I am running Win XP SP2, have AOL and AOL
>Security Center with McAfee
>
>Can anyone give me any clue on how this started and how to make it stop?
>
>Thanks!
>
>Bill
>
>
>
Bill,

This has been discussed here before. See

http://thread.gmane.org/gmane.comp.db.sqlite.general/17429

and this ticket

http://www.sqlite.org/cvstrac/tktview?tn=1698

If you can't find out what program is creating the files by using
ProcessExplorer or FileMon from SysInternals (both good programs that
are easy to install and simple to use), could you try zipping up one of
those sqlite_gibberish files and attaching it to ticket #1698 (use the
link above and then click on "Attach" near the upper right corner of the
page).

Please let us know what you find.

Dennis Cote





Re: [sqlite] sqlite3 dll symbols

2006-03-31 Thread John Stanton

Dennis Jenkins wrote:

Essien Essien wrote:


hiya,

I have a code snippet that looks like:

typedef int (*SQLITE3_CLOSE)(sqlite3*);
typedef const char* (*SQLITE3_ERRMSG)(sqlite3*);
typedef int (*SQLITE3_OPEN)(const char*, sqlite3**);
typedef int (*SQLITE3_EXEC) (sqlite3*, const char*, sqlite3_callback, void*,
char**);

HINSTANCE sqlite3_dll;

SQLITE3_CLOSE _sqlite3_close;
SQLITE3_ERRMSG _sqlite3_errmsg;
SQLITE3_OPEN _sqlite3_open;
SQLITE3_EXEC _sqlite3_exec;

int DB_Init()
{
   sqlite3_dll = LoadLibrary("sqlite3.dll");
   if (sqlite3_dll == NULL) {
printf("Cannot find sqlite3.dll. Make sure its in the same
directory as the program\n");
return 0;
   }

   _sqlite3_open = (SQLITE3_OPEN)GetProcAddress(sqlite3_dll,
"sqlite3_open");
   if (_sqlite3_open == NULL) {
   printf("Cannot load function sqlite3_open");
   return 0;
   }
}

problem is, when ever i call DB_Init(), it always fails with 'Cannot load
function sqlite3_open'. But it successfully passes the LoadLibrary portion.
I'm not a win32 guru, so i'm willing to admit i've made a mistake somewhere.

Any ideas on what i'm doing wrong?

I'm using Turbo C++ 4.5 IDE and related tools. (yeah... i know turbo
C++ 4.5is realy aged, but could this be the problem?)

Essien

 



Since you have the borland compiler product, use the "TDUMP.EXE" tool to
view the PE header of the sqlite3.dll file.  Sometimes the functions
will be exported with a leading underscore.  If your compiler is
producing 32 bit binaries, and the DLL is also 32 bit, then you might
try adding a leading underscore to the symbol name when you call
'GetProcAddress'.


You could also try statically linking Sqlite and bypassing the DLL.