[sqlite] how to force a database to be corrupted

2005-07-08 Thread Olivier Singla
Hi,

I was wondering, is there is way to force a database to be corrupted ?
(obviously I need this for testing purposes). Basically I'd like to patch
the database so the next sql command will return SQLITE_CORRUPT.

Thanks,

Olivier Singla
Integrian, Inc.
Raleigh, NC



[sqlite] sqlite with FORTRAN

2005-07-08 Thread Cornel Gazdaru

Hi
I am trying to figure out a wrapper to access sqlite from FORTRAN (g77 
and gcc)

I try  using "cfrotran.h" but it seems I have problems passing arguments.
Not sure I get the sqlite3 handle correctly
Has anybody tried that before?
Thanks
Cornel



Re: [sqlite] Mozilla + SQLite?

2005-07-08 Thread Jay Sprenkle
Thanks for sharing! I'm looking forward to the calendar program.


Re: [sqlite] INTEGER data type

2005-07-08 Thread Kiel W.
> That's correct for version 2.8.  Version 3.0 expands the INTEGER PRIMARY
> KEY out to 64 bits so you have a range of -18446744073709551616 to
> +18446744073709551615.  Seems unlikely to overflow...
> --
> D. Richard Hipp <[EMAIL PROTECTED]>

Thanks for the correction.  Definately plenty of space now.

-- 
Kiel W.
[EMAIL PROTECTED]
--
>> time is swift <<


Re: [sqlite] Error 21, "library routine called out of sequence"

2005-07-08 Thread Ben Clewett

Derrell,

Thanks for the idea and the excellent coding example.

This works perfectly, thank!

Regards,

Ben.


[EMAIL PROTECTED] wrote:

Ben Clewett <[EMAIL PROTECTED]> writes:



Dear SQLite,

I am running a sequence of inserts:

BEGIN
INSERT INTO table ...
INSERT INTO table ...
INSERT INTO table ...
INSERT INTO table ...
INSERT INTO table ...

I am catching the 'kill -1' signal (aka CTRL-C) and executing a final query:

COMMIT

When I execute the 'COMMIT' I get:

"library routine called out of sequence"

Every other query command after this returns the same.

My guess is the interrupt is kicking in during SQLite completion of the 
previous query.  Therefore SQLite is half way through something when 
this occurs.


Can any person suggest a possible solution as I am out of options.  For 
instance, some command to tidy up SQLite so that the next statement does 
not fail.  Otherwise I loose all my inserted data :)



Instead of issuing the COMMIT from the signal handler, set a global flag in
the signal handler which you check in your main code.  If the flag has been
set, then COMMIT and exit.

You can do something akin to this (untested code):

--

static int  bKilled = 0;

static void
sigHandler(int signum)
{
if (signum == SIGTERM)
{
bKilled = 1;
}
}

static void
doInserts()
{
char ** ppQueries;
char *  queries[] =
{
"INSERT INTO table ...",
"INSERT INTO table ...",
"INSERT INTO table ...",
NULL
};

/* Start a transaction */
issueQuery("BEGIN;");

/* For each query... */
for (ppQueries = queries; ppQueries != NULL; ppQueries++)
{
/* Issue the query */
issueQuery(*ppQueries);

/* If we've been signaled, exit loop */
if (bKilled)
{
break;
}
}

/*
 * Commit the transaction.
 *
 * Note that signal could have occurred *before* the BEGIN.  You'll need
 * to handle that case as well (or ignore the error from COMMIT)
 */
issueQuery("COMMIT;");
}





Re: [sqlite] Error 21, "library routine called out of sequence"

2005-07-08 Thread Derrell . Lipman
Ben Clewett <[EMAIL PROTECTED]> writes:

> Dear SQLite,
>
> I am running a sequence of inserts:
>
> BEGIN
> INSERT INTO table ...
> INSERT INTO table ...
> INSERT INTO table ...
> INSERT INTO table ...
> INSERT INTO table ...
>
> I am catching the 'kill -1' signal (aka CTRL-C) and executing a final query:
>
> COMMIT
>
> When I execute the 'COMMIT' I get:
>
> "library routine called out of sequence"
>
> Every other query command after this returns the same.
>
> My guess is the interrupt is kicking in during SQLite completion of the 
> previous query.  Therefore SQLite is half way through something when 
> this occurs.
>
> Can any person suggest a possible solution as I am out of options.  For 
> instance, some command to tidy up SQLite so that the next statement does 
> not fail.  Otherwise I loose all my inserted data :)

Instead of issuing the COMMIT from the signal handler, set a global flag in
the signal handler which you check in your main code.  If the flag has been
set, then COMMIT and exit.

You can do something akin to this (untested code):

--

static int  bKilled = 0;

static void
sigHandler(int signum)
{
if (signum == SIGTERM)
{
bKilled = 1;
}
}

static void
doInserts()
{
char ** ppQueries;
char *  queries[] =
{
"INSERT INTO table ...",
"INSERT INTO table ...",
"INSERT INTO table ...",
NULL
};

/* Start a transaction */
issueQuery("BEGIN;");

/* For each query... */
for (ppQueries = queries; ppQueries != NULL; ppQueries++)
{
/* Issue the query */
issueQuery(*ppQueries);

/* If we've been signaled, exit loop */
if (bKilled)
{
break;
}
}

/*
 * Commit the transaction.
 *
 * Note that signal could have occurred *before* the BEGIN.  You'll need
 * to handle that case as well (or ignore the error from COMMIT)
 */
issueQuery("COMMIT;");
}


[sqlite] Error 21, "library routine called out of sequence"

2005-07-08 Thread Ben Clewett

Dear SQLite,

I am running a sequence of inserts:

BEGIN
INSERT INTO table ...
INSERT INTO table ...
INSERT INTO table ...
INSERT INTO table ...
INSERT INTO table ...

I am catching the 'kill -1' signal (aka CTRL-C) and executing a final query:

COMMIT

When I execute the 'COMMIT' I get:

"library routine called out of sequence"

Every other query command after this returns the same.

My guess is the interrupt is kicking in during SQLite completion of the 
previous query.  Therefore SQLite is half way through something when 
this occurs.


Can any person suggest a possible solution as I am out of options.  For 
instance, some command to tidy up SQLite so that the next statement does 
not fail.  Otherwise I loose all my inserted data :)


Regards,

Ben Clewett.
Version 3.1.6