Re: [sqlite] sqlite_blob

2006-09-17 Thread Roger Binns
sandhya wrote:
>Is there any way of reading Blob data for the given no.of bytes?
>  I mean is there any lseek kind of  function call in sqlite to handle
> reading BLOB data.

This topic is covered fairly frequently - check the group archives.  In
general the advice is that if you have concerns like that then you
should store the data in a file and store the filename in the database.

Roger

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



Re: [sqlite] Multiuser on LAN, how good/bad is it ?

2006-09-17 Thread thomas . l
Hi Martin

Martin Alfredsson wrote:
> Though I can interpret the the second statement as "on a single machine"
> I'd like to hear about what  your experience is with using it as multiuser
> on a lan.
> Does it crash due to network problem, does it work better with WinXP
> than Win9x/2k/linux  etc.

I have performed some tests some time ago. At first I start 4 jobs
competitively, each job insert 200 Records with a Single-Insert-
Sql-Statement. Thats a little time-consuming. I got no problems.
I could not forecast who becomes the topical one job, with the rights to
write, but all Jobs finishd without errors. It changed even during
running.

At second I started 4 concurrency Transactions, each Job inserts 1
Records. Same Result! No Problems! Any Job finished without errors.

Now I think, there is no Problems to use SQLIte as a Multiuser-DB, if it
is a Dialog-Processing-Application.

Note: From SQLite's viewpoint it is imho the same, if you store the DB on
your local PC or on a public Fileserver. It stay as a Flatfile.

Best Regards
Thomas

-- 
www.thlu.de


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



Re: [sqlite] sqlite_blob

2006-09-17 Thread sandhya
Hi,
   Is there any way of reading Blob data for the given no.of bytes?
 I mean is there any lseek kind of  function call in sqlite to handle
reading BLOB data.

Thank you all,
Sandhya R



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



Re: [sqlite] blocking on insert

2006-09-17 Thread Bill KING
Thankyou, spot on the mark :) Now we've got it blazing fast, time to
move backwards towards a reasonable mix of safety and speed.

[EMAIL PROTECTED] wrote:
> Bill KING <[EMAIL PROTECTED]> wrote:
>   
>> Okay, i've got PRAGMA synchronous = OFF and PRAGMA temp_store = memory
>> but i'm still seeing the system locking up and waiting for write when
>> writing to sd-cards 
>> 
>
> PRAGMA synchronous=OFF prevents SQLite from calling fsync()
> and fdatasync().  On most filesystems, that means all write()
> requests are queued by the OS and the data is not actually
> written out to the device until some time after the write()
> call returns - sometimes much later.  But on some filesystems,
> calls to write() are synchronous.  That is to say, write()
> does not return until the information has reached hard media.
>
> On Linux, whether or not a write() is synchronous is controled
> (in at least one way) by the "sync" option to the mount command
> when the filesystem is mounted.
>
> It is not uncommon for write() to be synchronous on removable
> media.  I know that on my SuSE Linux laptop (on which I am typing
> this message) if I plug in a USB thumb drive, it automounts
> synchronous and write performance is abysmal.  I have to go
> root, unmount the thumb drive, then remount it for asynchronous
> writes.  Then it is blazing fast.  You just have to be careful
> to unmount it before pulling it out of the USB slot
> --
> D. Richard Hipp   <[EMAIL PROTECTED]>
>
>
> -
> To unsubscribe, send email to [EMAIL PROTECTED]
> -
>
>
>   


-- 
Bill King, Software Engineer
Trolltech, Brisbane Technology Park
26 Brandl St, Eight Mile Plains, 
QLD, Australia, 4113
Tel + 61 7 3219 9906 (x137)
Fax + 61 7 3219 9938
mobile: 0423 532 733


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



Re: [sqlite] blocking on insert

2006-09-17 Thread Joe Wilson
Which OS are you using to write to this SD-card database?
And if Linux, which kernel and thread library are you using 
(LinuxThreads or NPTL)?

--- Bill KING <[EMAIL PROTECTED]> wrote:
> Okay, i've got PRAGMA synchronous = OFF and PRAGMA temp_store = memory
> but i'm still seeing the system locking up and waiting for write when
> writing to sd-cards (insert statement in the middle of a batched
> transaction of them) (for reference, the standard linux filesystem
> doesn't have this blocking issue on doing cp/dd etc). Does anyone have
> any insight as to how to go about rectifying this? I'm seeing it
> blocking on writing to the database on every single insert. seeing as
> sd-cards are slow as hell, it's having a definate impact across the
> system (drawing, processing, etc even tho it's threaded off into a low
> priority thread).


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



Re: [sqlite] blocking on insert

2006-09-17 Thread drh
Bill KING <[EMAIL PROTECTED]> wrote:
> Okay, i've got PRAGMA synchronous = OFF and PRAGMA temp_store = memory
> but i'm still seeing the system locking up and waiting for write when
> writing to sd-cards 

PRAGMA synchronous=OFF prevents SQLite from calling fsync()
and fdatasync().  On most filesystems, that means all write()
requests are queued by the OS and the data is not actually
written out to the device until some time after the write()
call returns - sometimes much later.  But on some filesystems,
calls to write() are synchronous.  That is to say, write()
does not return until the information has reached hard media.

On Linux, whether or not a write() is synchronous is controled
(in at least one way) by the "sync" option to the mount command
when the filesystem is mounted.

It is not uncommon for write() to be synchronous on removable
media.  I know that on my SuSE Linux laptop (on which I am typing
this message) if I plug in a USB thumb drive, it automounts
synchronous and write performance is abysmal.  I have to go
root, unmount the thumb drive, then remount it for asynchronous
writes.  Then it is blazing fast.  You just have to be careful
to unmount it before pulling it out of the USB slot
--
D. Richard Hipp   <[EMAIL PROTECTED]>


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



Re: [sqlite] sqlite_exec query string maximum length?

2006-09-17 Thread drh
"Kervin L. Pierre" <[EMAIL PROTECTED]> wrote:
> what is the maximumm number
> of characters there can be in a query
> string sent to sqlite_exec()? 

2147483647 bytes

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


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



Re: [sqlite] Writing to views supported ?

2006-09-17 Thread drh
Martin Alfredsson <[EMAIL PROTECTED]> wrote:
> Snipped this from http://www.sqlite.org/cvstrac/wiki?p=DatabaseIsLocked
> 
>  >Trying to write to a table while a SELECT is active on that same table.
>  >As of check-in [3355]  
> (2006-08-16 after version 3.3.7) this is now allowed.
> 
> Is this true, will it be included in 3.3.8 ?
> Any time estimate when release with this is released ?
> 

Hold on there!  Check-in [3355] does *not* permit writing to views.
Check-in [3355] has to do with what operations you are allowed to
do on the database while a SELECT is pending.  In other words, it
has to do with using an sqlite3_exec() that is issued from within the
callback of another sqlite3_exec().  Or what changes you can make
using one prepared statement while a second prepared statement
still has not returned SQLITE_DONE or been finalized.

It has always been the case that while reading one table in SQLite,
you could simulatenously write to a separate table using the same
database connection.  But you could not, formerly, write to the
same table you were reading.

You could not, for example, do this (in TCL):

   db eval {SELECT rowid, * FROM table1} {
 db eval {UPDATE table1 SET x=y+2 WHERE rowid=$rowid}
   }

Check-in [3355] relaxes this restriction.  After check-in [3355],
you are allowed to modify a table that is being used in a SELECT
statement using a parallel statement or within the callback from
sqlite3_exec().
--
D. Richard Hipp   <[EMAIL PROTECTED]>


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



[sqlite] blocking on insert

2006-09-17 Thread Bill KING
Okay, i've got PRAGMA synchronous = OFF and PRAGMA temp_store = memory
but i'm still seeing the system locking up and waiting for write when
writing to sd-cards (insert statement in the middle of a batched
transaction of them) (for reference, the standard linux filesystem
doesn't have this blocking issue on doing cp/dd etc). Does anyone have
any insight as to how to go about rectifying this? I'm seeing it
blocking on writing to the database on every single insert. seeing as
sd-cards are slow as hell, it's having a definate impact across the
system (drawing, processing, etc even tho it's threaded off into a low
priority thread).


Thanks in advance,
Bill

-- 
Bill King, Software Engineer
Trolltech, Brisbane Technology Park
26 Brandl St, Eight Mile Plains, 
QLD, Australia, 4113
Tel + 61 7 3219 9906 (x137)
Fax + 61 7 3219 9938
mobile: 0423 532 733


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



[sqlite] sqlite_exec query string maximum length?

2006-09-17 Thread Kervin L. Pierre
Hello,

My application is building a query string
with multiple queries.  The number of
queries depends on the user and for
performance, I would like to execute as
few sqlite_exec() calls as possible.

So my question what is the maximumm number
of characters there can be in a query
string sent to sqlite_exec()? ( if there
is a maximum defined ).

I estimate that the query string would get
to 65K characters on occasion, and there
is no gaurantee that it won't get to larger
once in a while.

Best regards,
Kervin


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



[sqlite] Multiuser on LAN, how good/bad is it ?

2006-09-17 Thread Martin Alfredsson

Reading the documentation is a bit contradicting:

>A good rule of thumb is that you should avoid using SQLite in 
situations where
>the same database will be accessed simultaneously from many computers 
over a network filesystem.


>Most SQL database engines are client/server based. Of those that are 
serverless, SQLite is the only
>one that this author knows of that allows multiple applications to 
access the same database at the same time.


Though I can interpret the the second statement as "on a single machine" 
I'd like to hear about what

your experience is with using it as multiuser on a lan.

Does it crash due to network problem, does it work better with WinXP 
than Win9x/2k/linux  etc.



John Martin Alfredsson
ma1999ATjmaDOTse







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



[sqlite] Writing to views supported ?

2006-09-17 Thread Martin Alfredsson

Snipped this from http://www.sqlite.org/cvstrac/wiki?p=DatabaseIsLocked

>Trying to write to a table while a SELECT is active on that same table.
>As of check-in [3355]  
(2006-08-16 after version 3.3.7) this is now allowed.


Is this true, will it be included in 3.3.8 ?
Any time estimate when release with this is released ?


John Martin Alfredsson
ma1999ATjmaDOTse








[sqlite] Re: sqlite3_bind_text

2006-09-17 Thread Igor Tandetnik

sandhya <[EMAIL PROTECTED]> wrote:

In the following API,
sqlite3_bind_text(pStmt, 1, "sample", -1, SQLITE_STATIC);
What does the second argument referes to?


A query may have multiple parameters. Each is given an index, starting 
from 1. The second argument to sqlite3_bind_* is the index of the 
parameter you are binding. You must issue one sqlite3_bind_* call for 
each parameter in a query before you can step through it.


Igor Tandetnik 



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



[sqlite] sqlite_blob

2006-09-17 Thread sandhya
Hi,
Is there any way of reading Blob data for the given no.of bytes?
I mean is there any lseek kind of  function call here to handle BLOB data.
Thank you all,
Sandhya R



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



Re: [sqlite] Re: Re: Re: Which API to use to get resultant of query

2006-09-17 Thread Thomas . L
On Sun, 17 Sep 2006 13:03:23 +0530, you wrote:

>Thank you very much for your suggestion.
>I found very few samples in the siteBut hardly only one example is there
>which explains abt handling BLOB data.
>There is no documentation which explains about these samples ..
>So for me all your support is very much required.please bear with me
>
>Thank you
>Regards
>Sandhya


Hi Sandhya

You can find a Sample-Testprogramm at
http://www.thlu.de/db/rssqlitetest_vc.html, where you can see how to
read and write Blobs in an easy way. It is a C++-Sample compiled with 
VC++ Net 2003. 
I solved this problem by using COleVariant. That is a MS-Type for
interchange various types of Data to a Database, always going a
similar way, with lowest possible expenditure.

Best Regards
Thomas

www.thlu.de

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



[sqlite] sqlite3_bind_text

2006-09-17 Thread sandhya
Hi,
In the following API,
sqlite3_bind_text(pStmt, 1, "sample", -1, SQLITE_STATIC);
What does the second argument referes to?If the no.of binding arguments are
more than one
whether we have to mention two.
Can you please explain the usage of second argument.I didn't get properly
from the documentation.

Thank you
Regards
Sandhya R



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



Re: [sqlite] Which API to use to get resultant of query

2006-09-17 Thread sandhya
Thank you,
I solved getting oid from a table
-sandhya

- Original Message - 
From: "sandhya" <[EMAIL PROTECTED]>
To: 
Sent: Sunday, September 17, 2006 1:21 PM
Subject: [sqlite] Which API to use to get resultant of query


>
> Just i modified the query and tested With the steps i used it is
working
> fine.
> Like the otherway round i went,
> select filename from sample where oid = '455';
> Now it is working fine and showing the corresponding file name.
> Where as when i am giving like select oid from sample where filename =
> "sample.txt";(Nothing i am getting)
> Onemorething i want to say here is,
> I have created a table(sample) with only two cloumns...
> filename text,data blob;
>
> But i want to get the oid which is internally there in the
database.Whether
> i can able to get the oid through the same API's or i need to do in some
> other way.
> The following are the API's i used,
> sprintf(szQuery,"select oid from sample where filename = "sample.txt" ");
> sqlite3_prepare(db,szQuery, -1 , , 0);
> errcode = sqlite3_step(pStmt);   //As i got error i included this to
> check the error code ie 101(SQLITE_DONE)
> if( errcode==SQLITE_ERROR ){
> errcode = sqlite3_reset(pStmt);
> }
> if( errcode == SQLITE_ROW ){
> oid = (int)sqlite3_column_int(pStmt, 0);
> }
>
> Why it is showing the filename when i gave OID and the same when i am
giving
> filename and asking for OID it is throwing error.
> Is it bcoz it is not present in the table or something else?
> Please tell me how can i do this?
> I need you help very much as i have very short time to complete this..
>
> Thanks a lot
> Sandhya
>
>
>
> - Original Message - 
> From: "Igor Tandetnik" <[EMAIL PROTECTED]>
> To: "SQLite" 
> Sent: Friday, September 15, 2006 8:56 PM
> Subject: [sqlite] Re: Re: Re: Which API to use to get resultant of query
>
>
> > sandhya <[EMAIL PROTECTED]> wrote:
> > > But where as when i am executing the same from command prompt it is
> > > showing
> > > the OID alone.
> > > Why it is showing DONE when i am doing it through program?Anything
> > > wrong?
> >
> > Check your condition. Make sure it's the same as the one you use in
> > console. Most likely, you've simply misspelled the string in the sprintf
> > call and it cannot be found in the table.
> >
> > As a sanity check, drop the condition and see if you can get anything at
> > all with a simple query like "select oid from tablename;"
> >
> > Igor Tandetnik
> >
> >
>
> --
> ---
> > To unsubscribe, send email to [EMAIL PROTECTED]
>
> --
> ---
> >
>
>
>
> --
---
> To unsubscribe, send email to [EMAIL PROTECTED]
> --
---
>



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



[sqlite] Which API to use to get resultant of query

2006-09-17 Thread sandhya

Just i modified the query and tested With the steps i used it is working
fine.
Like the otherway round i went,
select filename from sample where oid = '455';
Now it is working fine and showing the corresponding file name.
Where as when i am giving like select oid from sample where filename =
"sample.txt";(Nothing i am getting)
Onemorething i want to say here is,
I have created a table(sample) with only two cloumns...
filename text,data blob;

But i want to get the oid which is internally there in the database.Whether
i can able to get the oid through the same API's or i need to do in some
other way.
The following are the API's i used,
sprintf(szQuery,"select oid from sample where filename = "sample.txt" ");
sqlite3_prepare(db,szQuery, -1 , , 0);
errcode = sqlite3_step(pStmt);   //As i got error i included this to
check the error code ie 101(SQLITE_DONE)
if( errcode==SQLITE_ERROR ){
errcode = sqlite3_reset(pStmt);
}
if( errcode == SQLITE_ROW ){
oid = (int)sqlite3_column_int(pStmt, 0);
}

Why it is showing the filename when i gave OID and the same when i am giving
filename and asking for OID it is throwing error.
Is it bcoz it is not present in the table or something else?
Please tell me how can i do this?
I need you help very much as i have very short time to complete this..

Thanks a lot
Sandhya



- Original Message - 
From: "Igor Tandetnik" <[EMAIL PROTECTED]>
To: "SQLite" 
Sent: Friday, September 15, 2006 8:56 PM
Subject: [sqlite] Re: Re: Re: Which API to use to get resultant of query


> sandhya <[EMAIL PROTECTED]> wrote:
> > But where as when i am executing the same from command prompt it is
> > showing
> > the OID alone.
> > Why it is showing DONE when i am doing it through program?Anything
> > wrong?
>
> Check your condition. Make sure it's the same as the one you use in
> console. Most likely, you've simply misspelled the string in the sprintf
> call and it cannot be found in the table.
>
> As a sanity check, drop the condition and see if you can get anything at
> all with a simple query like "select oid from tablename;"
>
> Igor Tandetnik
>
>
> --
---
> To unsubscribe, send email to [EMAIL PROTECTED]
> --
---
>



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



Re: [sqlite] Re: Re: Re: Which API to use to get resultant of query

2006-09-17 Thread sandhya
Thank you very much for your suggestion.
I found very few samples in the siteBut hardly only one example is there
which explains abt handling BLOB data.
There is no documentation which explains about these samples ..
So for me all your support is very much required.please bear with me

Thank you
Regards
Sandhya



- Original Message - 
From: "Fred Williams" <[EMAIL PROTECTED]>
To: 
Sent: Friday, September 15, 2006 9:19 PM
Subject: RE: [sqlite] Re: Re: Re: Which API to use to get resultant of query


>
>
> > -Original Message-
> > From: Igor Tandetnik [mailto:[EMAIL PROTECTED]
> > Sent: Friday, September 15, 2006 10:27 AM
> > To: SQLite
> > Subject: [sqlite] Re: Re: Re: Which API to use to get
> > resultant of query
> >
> >
> > sandhya <[EMAIL PROTECTED]> wrote:
> > > But where as when i am executing the same from command prompt it is
> > > showing
> > > the OID alone.
> > > Why it is showing DONE when i am doing it through program?Anything
> > > wrong?
> >
> > Check your condition. Make sure it's the same as the one you use in
> > console. Most likely, you've simply misspelled the string in
> > the sprintf
> > call and it cannot be found in the table.
> >
> > As a sanity check, drop the condition and see if you can get
> > anything at
> > all with a simple query like "select oid from tablename;"
> >
> > Igor Tandetnik
> >
>
> Just a suggestion.  When I am learning a new language, database, etc.  I
> sometimes find working with and even stepping through supplied samples
> prove to be the quickest way to gain insight into how the new entity
> works.  Saves both me and a lot of other people a lot of time and
> effort.
>
> Fred
>
>
> --
---
> To unsubscribe, send email to [EMAIL PROTECTED]
> --
---
>



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