Re: [sqlite] Concurrence in DB - again

2004-03-07 Thread Thiago Mello
Yes, in my callback() functions I have some sqlite_exec() functions.

How I can avoid this?

Thanks,

Thiago

Em Dom, 2004-03-07 às 15:10, Peter escreveu:
> Thiago Mello wrote:
> > about the sqlite_compile(), Im using simple call back function. 
> 
> Are you calling any other sqlite_* function within the callback? Doing 
> that will probably get you the "call out of sequence" error.
> 
> Regards
> P.
> 

-- 
Thiago Mello <[EMAIL PROTECTED]>


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [sqlite] Concurrence in DB - again

2004-03-07 Thread Thiago Mello
Hi Arnaud,

Now I in all sqlite_exec functions my nanosleep() funcion, and already
was using -DTHREADSAFE=1. 

I still getting a few of  "sqliteOsEnterMutex: Assertion `!inMutex'
failed" and getting much more "library routine called out of sequence"


about the sqlite_compile(), Im using simple call back function. 

Tnks!

> First, you have to use the nanosleep() thing everywhere. And also when
> doing sqlite_compile().
> Using nanosleep() only (I quote) "in every SQL exec function of my
> program that may be use by two process/thread" is not enough.
> 
> 
> > 
> > But Im still not geting it right, Im geting this msg and a "Abort" in my
> > program:
> > 
> > SQLITE_BUSY: sleeping fow a while...
> > SQLITE_BUSY:  database is locked
> > nariz: ./src/os.c:1540: sqliteOsEnterMutex: Assertion `!inMutex' failed.
> > 
> 
> I had exactly the same problem when I failed to compile sqlite correctly
> with -DTHREADSAFE=1. Make sure you used -DTHREADSAFE=1 by checking the
> output of make. All gcc lines should contains the -DTHREADSAFE=1.

-- 
Thiago Mello <[EMAIL PROTECTED]>


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [sqlite] Concurrence in DB - again

2004-03-07 Thread Thiago Mello
Hi Sqlite list, Tito and Arnaud,

thanks for your help, I use the example of the link above, and I use the
nanosleep() in every SQL exec function of my program that may be use by
two process/thread.

But Im still not geting it right, Im geting this msg and a "Abort" in my
program:

SQLITE_BUSY: sleeping fow a while...
SQLITE_BUSY:  database is locked
nariz: ./src/os.c:1540: sqliteOsEnterMutex: Assertion `!inMutex' failed.

And sometimes I execute my program and a get:
"library routine called out of sequence", and gdb tells "Program exited
with code 01".

Has anybody got those errors? 

Thanks for your help in advance.

Thiago Mello



Em Ter, 2004-02-24 às 13:32, Tito Ciuro escreveu:
> Hello Thiago,
> 
> http://www.sqlite.org/cvstrac/wiki?p=MultiThreading
> 
> Regards,
> 
> -- Tito
> 
> On 24 feb 2004, at 10:31, Thiago Mello wrote:
> 
> > Hi,
> >
> > Im using Sqlite in my application, and I want to two process bem able 
> > to
> > insert records in a table, SQLite support process concurrence, or I 
> > have
> > to do this in my program?
> >
> > If I have to do this in my program some one have a idea how can I do
> > this I tried to use some things already.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[sqlite] Concurrence in DB

2004-02-24 Thread Thiago Mello
Hi,

Im using Sqlite in my application, and I want to two process bem able to
insert records in a table, SQLite support process concurrence, or I have
to do this in my program?

If I have to do this in my program some one have a idea how can I do
this I tried to use some things already.


Thanks,
-- 
Thiago Mello <[EMAIL PROTECTED]>


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[sqlite] database in memory

2003-11-26 Thread Thiago Mello
Hi all,

I want to use in my application a DB in memory, I know that to use this,
when I open my DB I have to do:

sqlite_open(":memory", 0, &z);


To open a DB that is not in memory, in the shell I do: SQLite/bin/sqlite
BD

But if I whant to this in a ":memory" DB, how can I proceed?

Thanks in advance,

Thiago M

Re: [sqlite] database table is locked

2003-11-07 Thread Thiago Mello
Hi D. Richard,

Thanks for your help, it seems that it worked fine.

Regards,

Thiago Mello

Em Sex, 2003-11-07 às 11:46, D. Richard Hipp escreveu:
> Thiago Mello wrote:
> > 
> > BEGIN TRANSACTION; 
> > SELECT id,name FROM TABLE1;
> > 
> > /* now in the callback function */
> > IF argv[1] = "JOHN";
> > UPDATE  TABLE1 SET number=n+1 WHERE id=X
> > /* return from the Callback function */
> > 
> > END TRANSACTION;
> > 
> > But I still get a error: "database table is locked".
> > Is still something wrong that Im doing?
> > 
> 
> SQLite does not allow you to read and write the
> same table at the same time.  You need to finish the
> read of TABLE1 before you start changing it.  Perhaps
> like this:
> 
>BEGIN;
>CREATE TEMP TABLE t1 AS SELECT id,name FROM table1;
>SELECT id,name FROM t1;
> 
>/* Now in the callback function */
>UPDATE table1 SET number=n+1 WHERE id=X;
>/* Return from callback function
> 
>DROP TABLE t1;
>COMMIT;


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [sqlite] database table is locked

2003-11-07 Thread Thiago Mello
Hello,

Will that decrease the performance of my application?

Thanks,

Thiago Mello

Em Sex, 2003-11-07 às 11:46, D. Richard Hipp escreveu:
> SQLite does not allow you to read and write the
> same table at the same time.  You need to finish the
> read of TABLE1 before you start changing it.  Perhaps
> like this:
> 
>BEGIN;
>CREATE TEMP TABLE t1 AS SELECT id,name FROM table1;
>SELECT id,name FROM t1;
> 
>/* Now in the callback function */
>UPDATE table1 SET number=n+1 WHERE id=X;
>/* Return from callback function
> 
>DROP TABLE t1;
>COMMIT;


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [sqlite] database table is locked

2003-11-07 Thread Thiago Mello
Hi,

Im sorry, I was not putting the hole explanation, but here it is.

In my main I have this select:

SELECT * FROM TABLE WHERE classe LIKE '%OHN%' ;

/* inside the callback */
  bipOrigem = argv[2];
  bipDestino  = argv[3];


UPDATE TABLE SET limiar=limiar+1 WHERE id="argv[0]";

if(bipDestino == objAlerta.ipDestino )  ipD =  true;
if(bipOrigem == objAlerta.ipOrigem ) ipO = true

if(!ipD)
UPDATE TABLE SET classe= "+bipOrigem+" ,"+objAlerta.ipOrigem+ " WHERE
id= " +argv[0]+ " ;
.
.
.
/* end callback */

So Im have to do some UPDATEs, depending the result of the SELECT.

That is what Im trying to do, sorry for not putting the hole
information. And thanks for the patients.

Thiago Mello

Em Sex, 2003-11-07 às 11:37, Mrs. Brisby escreveu:
> On Sat, 2003-11-08 at 07:20, Thiago Mello wrote:
> > Hi Ben Carlyle, 
> > 
> > First of all, thanks for your help!
> > 
> > I can't brig these two operation togethe causa I need the result of the
> > SELECT in a if condition.
> 
> You cannot do the UPDATE inside of a SELECT callback. You do not need
> the results of a SELECT for an UPDATE. Not for this one.
> 
> I think you mean:
> 
> UPDATE TABLE1 SET number=number+1 WHERE id="JOHN";
> 
> Or maybe you meant:
> 
> UPDATE TABLE1 SET number=number+1 WHERE name="JOHN";
> 
> Either way, it seems an awful like you have a "bigger goal" that you're
> trying to solve that you're not explaining here for whatever reason--
> instead you assumed you needed to UPDATE inside the SELECT. You can't
> and if you show us what you're really trying to do, I'll bet that you
> don't either...



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [sqlite] database table is locked

2003-11-07 Thread Thiago Mello
Hi Ben Carlyle, 

First of all, thanks for your help!

I can't brig these two operation togethe causa I need the result of the
SELECT in a if condition.

So, what I did was separate with transaction, soh I did something like
this:

BEGIN TRANSACTION; 
SELECT id,name FROM TABLE1;

/* now in the callback function */
IF argv[1] = "JOHN";
UPDATE  TABLE1 SET number=n+1 WHERE id=X
/* return from the Callback function */

END TRANSACTION;

But I still get a error: "database table is locked".
Is still something wrong that Im doing?

Thanks again,

Thiago Mello





Em Qui, 2003-11-06 às 22:03, [EMAIL PROTECTED] escreveu:

> > Im doing a SELECT sql query, and in the callback function of this sql
> > query I do a UPDATE, so when I do this update I get 
> > database table is locked.
> 
> > How I cant do the UPDATE in the second sqlite_exec() function?!
> 
> Either separate the two operations or bring them closer together. To 
> separate them do something like:
> 
> BEGIN TRANSACTION;
> SELECT ...; -- Collate results
> -- Action results:
> UPDATE ...;
> UPDATE ...;
> ...
> UPDATE ...;
> END TRANSACTION;



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[sqlite] database table is locked

2003-11-06 Thread Thiago Mello
Hi,

Im doing a SELECT sql query, and in the callback function of this sql
query I do a UPDATE, so when I do this update I get 
database table is locked.

How I cant do the UPDATE in the second sqlite_exec() function?!

Thanks,

Thiago Mello


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[sqlite] SIGSEGV

2003-11-04 Thread Thiago Mello
Hi everyone.

Im developing my program in C++ and using i386 linux as OS. 
Im having some problem with SQLite 2.8.6.

In my program I have a method wich is a void and its call a Callback
function to do a query of DB in SQLite. I whant to do another
sqlite_exec() inside a callback funcion of a previous sqlite_exec().

But when it arrives in the second sqlite_exec():

src = sqlite_exec(sbd,  qUpdateLimiar.c_str(), NULL, 0, NULL);

I get a segmentation fault. In GDB I get the following menssage:

Program received signal SIGSEGV, Segmentation fault.
sqliteSafetyOn (db=0x0) at ./src/util.c:1123
1123./src/util.c: Arquivo ou diretório não encontrado.
in ./src/util.c
Current language:  auto; currently c


I dont know whats is that Im doing wrong, the variables in the callback
function is all static, can I do a sqlite_exec() inside a callback
function?!

Thanks in advance for any help.

Thiago Mello


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]