You can't SELECT from your database while an INSERT has not finished.
SQLite will return the SQLITE_BUSY error if you try.  You can't fix that.
It is not broken.  In fact, it's necessary.

You can have your application simply loop with a delay, trying the SELECT
and waiting for the SQLITE_BUSY to go away, if you want.  Or you can use
sqlite3_busy_timeout() to insert a delay between your SELECT and the
SQLITE_BUSY response.  Or you can use sqlite3_busy_handler() to set a
callback function that SQLite will (usually) call instead of returning
SQLITE_BUSY.

You could also make a copy of your database before you start the INSERTs.
INSERT into the copy and SELECT from the original.  When the INSERTs are
done, copy the copy back to the original.  That idea has its own problems:
be careful not to change the original while a SELECT is running, or to start
a new SELECT while the copy is running.  If you try this, you are disabling
some of the robustness of SQLite, and you will have to replace its
safeguards with your own.

- Pam

On 4/3/06, Cesar David Rodas Maldonado <[EMAIL PROTECTED]> wrote:
>
> please i need some help
> On 4/3/06, Cesar David Rodas Maldonado <[EMAIL PROTECTED]> wrote:
> >
> > i insert numbers and  select numbers, so what could be the solutions,
> > couse i have to do that
> >
> >
> > On 4/3/06, Pam Greene < [EMAIL PROTECTED]> wrote:
> > >
> > > An INSERT can change the results of your SELECT, so the database has
> to
> > > be
> > > locked during INSERT.  Otherwise, the result of your SELECT would
> depend
> > > on
> > > whether the INSERT had finished yet.  (The INSERT might even have only
> > > partly finished, which would mean the SELECT was looking at a database
> > > in an
> > > inconsistent state.)  It's not good to have unpredictable results like
> > > that.
> > >
> > > For more explanation of why what you want isn't a good idea, see any
> > > discussion of an "ACID" database, for example
> > > http://en.wikipedia.org/wiki/ACID .
> > >
> > > - Pam
> > >
> > > On 4/3/06, Cesar David Rodas Maldonado <[EMAIL PROTECTED]> wrote:
> > > >
> > > > HElp me, couse i just need to do insert and select, i dont use
> delete
> > > or
> > > > replate or update
> > > >
> > > > On 4/3/06, Cesar David Rodas Maldonado <[EMAIL PROTECTED]> wrote:
> > > > >
> > > > > thanx man
> > > > >
> > > > >
> > > > > but is posible open several DATABASE with a programm and do
> > > transaccion
> > > > > without locked the table???
> > > > >
> > > > > On 4/3/06, Jay Sprenkle < [EMAIL PROTECTED]> wrote:
> > > > >
> > > > > > On 4/3/06, Cesar David Rodas Maldonado < [EMAIL PROTECTED]>
> wrote:
> > > > > > > I have a database.... ok... i do a lot of insert and select,
> but
> > >
> > > > there
> > > > > > is
> > > > > > > sometime that i cant do the select couse the database is
> > > locked...
> > > > > > >
> > > > > > > i have to do a lot of insert every time, so how can i do for
> > > dont
> > > > lock
> > > > > > the
> > > > > > > database...
> > > > > > >
> > > > > > > understand guy?
> > > > > >
> > > > > > Try this:
> > > > > > http://sqlite.org/lang_transaction.html
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
>
>

Reply via email to