Re: [sqlite] Max limits on the following

2008-06-23 Thread Shailesh Birari
Thanks for the input but the link you sent does not cover the following 

1) Max number of tables in the sqlite database?
3) Max column name size?
4) Max table name size?
5) Max database name size?
6) Max constraint name size?
7) Max table constraints in the table?

Pardon me if I have missed out on reading these points.

Thanks 
Shailesh



> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Marco Bambini
> Sent: Monday, June 23, 2008 1:06 PM
> To: General Discussion of SQLite Database
> Subject: Re: [sqlite] Max limits on the following
> 
> http://www.sqlite.org/limits.html
> ---
> Marco Bambini
> http://www.sqlabs.net
> http://www.sqlabs.net/blog/
> http://www.sqlabs.net/realsqlserver/
> 
> 
> 
> On Jun 23, 2008, at 8:55 AM, Shailesh Birari wrote:
> 
> > Hello all,
> > I wanted to know if there are any upper limits on the following: I 
> > have seen sqlite_ext.h but did not any so just wanted to 
> confirm the 
> > same.
> >
> > 1) Max number of tables in the sqlite database?
> > 2) Max number of fields/columns in the table : 2000??
> > 3) Max column name size?
> > 4) Max table name size?
> > 5) Max database name size?
> > 6) Max constraint name size?
> > 7) Max table constraints in the table:?
> >
> > Kindly let me know,
> > Regards
> > Shailesh
> > ___
> > sqlite-users mailing list
> > sqlite-users@sqlite.org
> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Max limits on the following

2008-06-23 Thread Shailesh Birari
Hello all, 
I wanted to know if there are any upper limits on the following: I have
seen sqlite_ext.h but did not any so just wanted to confirm the same.
 
1) Max number of tables in the sqlite database?
2) Max number of fields/columns in the table : 2000??
3) Max column name size?
4) Max table name size?
5) Max database name size?
6) Max constraint name size?
7) Max table constraints in the table:?

Kindly let me know, 
Regards
Shailesh
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Database locked error, while deleting

2008-06-10 Thread Shailesh Birari
Richard, 
Just to go one step ahead, If there are independent connections, do you
mean that there can exist multiple transactions at the same time? I
think not since the first transaction (write) will exclusively lock the
database and the second transaction will get a busy error. Correct me if
I am wrong. Will the behaviour differ in case of shared cache enabled
and disabled?

-Shailesh. 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of D. Richard Hipp
> Sent: Tuesday, June 10, 2008 5:28 PM
> To: General Discussion of SQLite Database
> Subject: Re: [sqlite] Database locked error, while deleting
> 
> 
> On Jun 10, 2008, at 7:36 AM, Sabyasachi Ruj wrote:
> 
> > Hi,
> >
> > I have a very big table with around 40,00, 000 rows. 4 columns. 220 
> > MB.
> >
> > Now, I have two threads:-
> > Thread1: Is deleting 7,00, 000 rows from the table.
> > Thread2: Is doing SELECT on the same table.
> >
> > Now the problem is sometimes the sqlite3_prepare for the 
> SELECT query 
> > is failing with SQLITE_BUSY error.
> >
> > My questions: -
> > 1. What is the best way to handle this error, and continue working 
> > normally?
> > 2. Is there any documentation in sqlite3.org, which discuses the 
> > locking mechanism for DELETEs? Exacly in what phase of 
> DELETE sqlite 
> > creates the exclusive lock, so, the SELECT is failing?
> >
> 
> 
> Are the two threads using the same database connection, or 
> are they making separate and independent calls to sqlite3_open()?
> 
> 
> D. Richard Hipp
> [EMAIL PROTECTED]
> 
> 
> 
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Forming a query with BLOB with null characters

2008-06-03 Thread Shailesh Birari
Thank you for the input. THis is what I tried, 
char*data = "THIS \\\"IS 'BLAH"
This is a blob data of 40 bytes that I wanted to store, so all bytes
after BLAH are all '\0'. 
So I created a insert query like this, by converting the blob in
hexadecimal format,

Insert into table values
(X'54484953205c2249532027424c41480');  -> 0 are 40 times.

in the sqlite shell, select * from table, shows me the data as it is in
X'hex' format. 

X'54484953205c2249532027424c4148
00'

And when I try to retrieve it using sqlite3_column_blob, and try to
print that blob I see the same X'hex' string instead of "THIS \\\"IS
'BLAH". 
Why is this behaviour? We give input in hex format for sqlite to
understand that this is a blob and not a text and it shoudl make the
appropriate conversion to store it internally. I know sqlite treats blob
and text the same, but is there no way that I can get the binary data as
I have? Do I again need to convert the hex string into my binary blob
buffer?

I hope people understood what I am trying to ask out here.

-Shailesh


> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Shailesh Birari
> Sent: Tuesday, June 03, 2008 5:02 PM
> To: General Discussion of SQLite Database
> Subject: Re: [sqlite] Forming a query with BLOB with null characters
> 
> Thanks I found that later. 
> sprintf would rather be a costly operation. 
> 
> -Shailesh 
> 
> > -Original Message-
> > From: [EMAIL PROTECTED] 
> > [mailto:[EMAIL PROTECTED] On Behalf Of Dan
> > Sent: Tuesday, June 03, 2008 3:47 PM
> > To: General Discussion of SQLite Database
> > Subject: Re: [sqlite] Forming a query with BLOB with null characters
> > 
> > 
> > On Jun 3, 2008, at 4:20 PM, Shailesh Birari wrote:
> > 
> > > Hello,
> > > I have a simple question here. I want to generate a insert query
> > > (char*)
> > > which will insert a blob in a table. This blob is nothing but a C 
> > > structure in my program.
> > >
> > > So the query would be something like this
> > >
> > > INSERT INTO table1 VALUES
> > > ('12323232\0\0\0\023232323\0\0\023232323\0\03445\0')
> > >
> > > where the blob field is having some null characters in it. I know 
> > > there is a way to use bind blob but I want to create this
> > query. Are
> > > there any APIs that sqlite provides so that given a blob of
> > x bytes,
> > > it will generate corresponding string to be appended in the query?
> > >
> > > I looked at sqlite3_snprintf, but it will print only till 
> first \0 
> > > character in the string. I want to escape all the \0s till
> > my x bytes
> > > of buffer?
> > >
> > > Can someone please give me any pointers for this ?
> > 
> > Use the blob literal syntax described here:
> > 
> >http://www.sqlite.org/lang_expr.html
> > 
> > Dan.
> > 
> > ___
> > sqlite-users mailing list
> > sqlite-users@sqlite.org
> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> > 
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Forming a query with BLOB with null characters

2008-06-03 Thread Shailesh Birari
Hello, 
I have a simple question here. I want to generate a insert query (char*)
which will insert a blob in a table. This blob is nothing but a C
structure in my program. 
 
So the query would be something like this
 
INSERT INTO table1 VALUES
('12323232\0\0\0\023232323\0\0\023232323\0\03445\0')
 
where the blob field is having some null characters in it. I know there
is a way to use bind blob but I want to create this query. Are there any
APIs that sqlite provides so that given a blob of x bytes, it will
generate corresponding string to be appended in the query?
 
I looked at sqlite3_snprintf, but it will print only till first \0
character in the string. I want to escape all the \0s till my x bytes of
buffer? 
 
Can someone please give me any pointers for this ?
 
Thanks ,
Shailesh
 
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Transaction across threads

2008-04-17 Thread Shailesh Birari
any clarifications on the below statements?

-Shailesh 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Shailesh Birari
> Sent: Wednesday, April 16, 2008 11:30 AM
> To: General Discussion of SQLite Database
> Subject: Re: [sqlite] Transaction across threads
> 
> Thank you Ken, Hipp and Shawn. 
> Below I am trying to summarize sqlite in the three dimensions 
> of shared cache, transactions and threads. Please let me know 
> which of the following are correct. Ideally I would like to 
> put this list on the sqlite website for others.
> 
> 1) With shared cache mode, multiple connections is same as a 
> single connection. So all facts to single connection in 
> following points apply to multiple connections with shared cache mode.
> 2) With non shared cache mode, multiple connections are independent.
> They are always multiple connections contending with each 
> other whether across threads or across processes.
> 3) Sharing connection in non shared cache mode across threads 
> is same as each thread having independent connection in 
> shared cache mode.
> 
> Transaction
> ---
> Following points are when connection is shared across threads 
> or multiple connections are opened with shared cache mode enabled.
> 1) If a connection in one thread does a BEGIN TRANSACTION and 
> another thread does a insert (using shared connection or 
> different connection with shared cache mode) then this insert 
> is strictly a part of the transaction. there is no way an 
> application can tell that this insert is not a part of the 
> transaction started by the first thread. So if the 
> application does not want this insert to be a part of the 
> transaction, it is upto the application to not do a insert if 
> a transaction is in progress.
> 2) On the same lines, BEGIN TRANSACTION on the thread 
> followed by BEGIN TRANSACTION on another thread is as good as 
> nested transaction and will error. Similarly BEGIN 
> TRANSACTION on one thread can be committed by COMMIT 
> transaction on another thread.
> 
> Following points apply when there are multiple independent 
> connections to the database which is essentially in 
> non-shared cache mode:
> 1) one can begin multiple transaction across connections, but 
> they have to be "read" transactions. If it becomes a write 
> transaction, only one write transaction can be active. So 
> multiple "select" statements can be active but only one 
> "insert" statement will be active at any given point of time.
> 
> 
> Processes Vs thread:
> 
> 1) There is no way that one can share a connection across 
> processes using a non-shared cache mode. So each process will 
> have its own connection.
> 2) With shared cache mode, multiple connections across 
> processes is as good a one connection and the all above rules 
> apply as they are.
> 
> Please let me know what all statements are correct. If they 
> are not correct try to rewrite them so that we can add them 
> to the wiki for version '3.5.?'
> 
> Regards
> Shailesh
> 
> 
> > -Original Message-
> > From: [EMAIL PROTECTED] 
> > [mailto:[EMAIL PROTECTED] On Behalf Of D. 
> Richard Hipp
> > Sent: Tuesday, April 15, 2008 9:24 PM
> > To: General Discussion of SQLite Database
> > Subject: Re: [sqlite] Transaction across threads
> > 
> > 
> > On Apr 15, 2008, at 11:31 AM, Shawn Wilsher wrote:
> > >> 1) If shared, then the second threads insert is part of the 
> > >> transaction and should succeed.
> > >> 2) No.
> > >> 3) If the connection is shared between threads, there can
> > only be 1
> > >> txn at a time. The second threads attempt to begin a txn
> > will result
> > >> in an error that indicates a txn is already active.
> > > To be clear, when using a shared cache and more than one sqlite3 
> > > connection object, only one transaction will exist at a
> > time, correct?
> > 
> > Correct.
> > 
> > >
> > > However, if it is not using the shared cache, you can have a 
> > > transaction opened up for each thread?
> > >
> > 
> > Well, sort of.  Certainly true if each connection has a different 
> > database open.  But there can only be one write transaction 
> at a time 
> > to a single database.  If you have multiple connections to the same 
> > database file, one can have a write transaction open and 
> one or more 
> > others can have a read transaction open, but you cannot have two or 
> > more write transactions active at once and all of the read 
> > tra

Re: [sqlite] Transaction across threads

2008-04-15 Thread Shailesh Birari
Thank you Ken, Hipp and Shawn. 
Below I am trying to summarize sqlite in the three dimensions of shared
cache, transactions and threads. Please let me know which of the
following are correct. Ideally I would like to put this list on the
sqlite website for others.

1) With shared cache mode, multiple connections is same as a single
connection. So all facts to single connection in following points apply
to multiple connections with shared cache mode.
2) With non shared cache mode, multiple connections are independent.
They are always multiple connections contending with each other whether
across threads or across processes.
3) Sharing connection in non shared cache mode across threads is same as
each thread having independent connection in shared cache mode.

Transaction
---
Following points are when connection is shared across threads or
multiple connections are opened with shared cache mode enabled.
1) If a connection in one thread does a BEGIN TRANSACTION and another
thread does a insert (using shared connection or different connection
with shared cache mode) then this insert is strictly a part of the
transaction. there is no way an application can tell that this insert is
not a part of the transaction started by the first thread. So if the
application does not want this insert to be a part of the transaction,
it is upto the application to not do a insert if a transaction is in
progress.
2) On the same lines, BEGIN TRANSACTION on the thread followed by BEGIN
TRANSACTION on another thread is as good as nested transaction and will
error. Similarly BEGIN TRANSACTION on one thread can be committed by
COMMIT transaction on another thread.

Following points apply when there are multiple independent connections
to the database which is essentially in non-shared cache mode:
1) one can begin multiple transaction across connections, but they have
to be "read" transactions. If it becomes a write transaction, only one
write transaction can be active. So multiple "select" statements can be
active but only one "insert" statement will be active at any given point
of time.


Processes Vs thread:

1) There is no way that one can share a connection across processes
using a non-shared cache mode. So each process will have its own
connection.
2) With shared cache mode, multiple connections across processes is as
good a one connection and the all above rules apply as they are.

Please let me know what all statements are correct. If they are not
correct try to rewrite them so that we can add them to the wiki for
version '3.5.?'

Regards
Shailesh


> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of D. Richard Hipp
> Sent: Tuesday, April 15, 2008 9:24 PM
> To: General Discussion of SQLite Database
> Subject: Re: [sqlite] Transaction across threads
> 
> 
> On Apr 15, 2008, at 11:31 AM, Shawn Wilsher wrote:
> >> 1) If shared, then the second threads insert is part of the 
> >> transaction and should succeed.
> >> 2) No.
> >> 3) If the connection is shared between threads, there can 
> only be 1 
> >> txn at a time. The second threads attempt to begin a txn 
> will result 
> >> in an error that indicates a txn is already active.
> > To be clear, when using a shared cache and more than one sqlite3 
> > connection object, only one transaction will exist at a 
> time, correct?
> 
> Correct.
> 
> >
> > However, if it is not using the shared cache, you can have a 
> > transaction opened up for each thread?
> >
> 
> Well, sort of.  Certainly true if each connection has a 
> different database open.  But there can only be one write 
> transaction at a time to a single database.  If you have 
> multiple connections to the same database file, one can have 
> a write transaction open and one or more others can have a 
> read transaction open, but you cannot have two or more write 
> transactions active at once and all of the read transactions 
> will need to close prior to the write transaction committing 
> (otherwise the writer gets an
> SQLITE_BUSY.)
> 
> D. Richard Hipp
> [EMAIL PROTECTED]
> 
> 
> 
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Connection Sharing across threads

2008-04-15 Thread Shailesh Birari
Can some one tell me if the sharing of connection  is possible even when
the shared cache mode is disabled?

-Shailersh 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Shailesh Birari
> Sent: Monday, April 14, 2008 11:24 PM
> To: sqlite-users@sqlite.org
> Subject: [sqlite] Connection Sharing across threads
> 
> In one of the wiki entries,
> http://www.sqlite.org/cvstrac/wiki?p=MultiThreading
> <http://www.sqlite.org/cvstrac/wiki?p=MultiThreading> , I 
> read that application cannot share the sqlite connection 
> across threads. However in another posting at 
> http://www.sqlite.org/sharedcache.html
> <http://www.sqlite.org/sharedcache.html>  I read that with 
> 3.5.0 update, the connection can be shared. 
> 
> >>>>>>>
> 
> In version 3.5.0, shared-cache mode was modified so that the 
> same cache can be shared across an entire process rather than 
> just within a single thread. Prior to this change, there were 
> restrictions on passing database connections between threads. 
> Those restrictions were dropped in 3.5.0 update. This 
> document describes shared-cache mode as of version 3.5.0.
> 
> >>>>>>>
> 
> Is the sharing of connection possible even when the shared 
> cache mode is disabled? or is it possible only when shared 
> cache is enablesd?
> 
>  
> 
> Kindly let me know 
> 
>  
> 
> regards
> 
> Shailesh
> 
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Transaction across threads

2008-04-15 Thread Shailesh Birari
Does anyone have any answers for the queries below?

-Shailesh 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Shailesh Birari
> Sent: Monday, April 14, 2008 9:55 PM
> To: sqlite-users@sqlite.org
> Subject: [sqlite] Transaction across threads
> 
> Hello,
> I had a doubt of sqlite transactions across threads. 
> I have a multithreaded application which shares the same 
> sqlite connection across threads. I had a few doubts
> 1) If I do a begin transaction and insert on one thread. Then 
> do a insert on the second thread and finally a commit on the 
> first thread will the insert from the second thread succeed 
> or will it fail saying SQLITE_BUSY? if it succeeds, will the 
> insert on the second thread be a part of the transaction on 
> the first thread?
> 2) When I do a Begin transaction will I get a transactionId? 
> 3) If one thread is in the middle of a transaction and 
> another thread does a begin transaction, will it be able to 
> start its own transaction or will it fail with SQLITE_BUSY.?
>  
> Kindly let me know, 
>  
> Regards,
> Shailesh.
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Connection Sharing across threads

2008-04-14 Thread Shailesh Birari
In one of the wiki entries,
http://www.sqlite.org/cvstrac/wiki?p=MultiThreading
 , I read that
application cannot share the sqlite connection across threads. However
in another posting at http://www.sqlite.org/sharedcache.html
  I read that with 3.5.0 update,
the connection can be shared. 

>>>

In version 3.5.0, shared-cache mode was modified so that the same cache
can be shared across an entire process rather than just within a single
thread. Prior to this change, there were restrictions on passing
database connections between threads. Those restrictions were dropped in
3.5.0 update. This document describes shared-cache mode as of version
3.5.0.

>>>

Is the sharing of connection possible even when the shared cache mode is
disabled? or is it possible only when shared cache is enablesd?

 

Kindly let me know 

 

regards

Shailesh

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Transaction across threads

2008-04-14 Thread Shailesh Birari
Hello, 
I had a doubt of sqlite transactions across threads. 
I have a multithreaded application which shares the same sqlite
connection across threads. I had a few doubts
1) If I do a begin transaction and insert on one thread. Then do a
insert on the second thread and finally a commit on the first thread
will the insert from the second thread succeed or will it fail saying
SQLITE_BUSY? if it succeeds, will the insert on the second thread be a
part of the transaction on the first thread?
2) When I do a Begin transaction will I get a transactionId? 
3) If one thread is in the middle of a transaction and another thread
does a begin transaction, will it be able to start its own transaction
or will it fail with SQLITE_BUSY.?
 
Kindly let me know, 
 
Regards,
Shailesh.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Open issues on latest build and last stable build

2008-03-30 Thread Shailesh Birari
Can Some one give me pointers to the blog where all the open and
reported issues on different releases is listed. 
So that If I have to use sqlite in my product I can choose the most
suitable build after referring to this list.?
 
Thanks, 
Shailesh.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users