Re: [sqlite] Using "attach database" to work around DB locking

2012-04-11 Thread Ian Katz
OK.  I think you guys have answered my question: I'm not asking the
right question.  I need to get better data on my performance
requirements if I'm going to start asking the right sort of questions.

For now, I'll see what I can learn about using WAL mode and go from
there.  Thanks for the insightful responses!

-Ian

On Wed, Apr 11, 2012 at 3:30 PM, Marcus Grimm  wrote:
>> Converting variable name to variable ID (with separate lookup table)
>> was one of my first ideas, but turns out that the lookup itself was a
>> bigger hit in performance than the indexing.  I'll revisit that and
>> see if I failed to tweak something properly.
>
> To me it sounds that it will just move the performance
> problem from the indexed column to another separated table
> which might as well need an index on "variable name".
> I also don't see why a lookup will be faster via
> attached databases: Doesn't this just move the lookup
> to sqlite's attach command ?
> The locking issue of a SELECT might be improved by using
> wal mode.
>
> Anyway, you didn't specify how these names look like - in case
> they are chars with, say, more than 8 bytes you might
> trying to add a CRC integer hash on the variable name
> and index that value. Your selects might then look
> like SELECT * FROM table WHERE VarName = 'abc' AND VarCRC=N;
> This approach avoids to do string comparisons on table
> lookup and indexing. It also reduces the size of the index.
>
> Marcus
>
>>
>> -Ian
>>
>> On Wed, Apr 11, 2012 at 1:22 PM, Pavel Ivanov  wrote:
 Am I missing any features of SQLite that would solve this problem in a
 different/better way?
>>>
>>> If you didn't try it I would suggest to try a single table (timestamp,
>>> variable id, value). Index on integer variable id will work faster
>>> than text variable name.
>>> Other than that I'd say your design of one table per database is well
>>> justified. Especially if you won't attach all databases together while
>>> inserting data, but will connect to necessary database directly.
>>>
>>>
>>> Pavel
>>>
>>>
>>> On Wed, Apr 11, 2012 at 1:11 PM, Ian Katz  wrote:
 These are all good points, and introduce some features of sqlite that
 I didn't know existed!

 The database system that I'm designing is for an autonomous vehicle;
 it collects a lot of (data which is currently getting stored as a flat
 text file).  So, it's going to write a LOT of data into many tables
 independently, occasionally do single-table reads, and at the end of
 the day create a report that joins all the tables together.  So, my
 main goal is to give maximum speed to writes by compartmentalizing the
 locks that the incoming reads will cause.  It sounds like this use
 case won't hit any of the disadvantages mentioned above.

 In the past, I've tried to do this in SQLite and MySQL by putting all
 the data in a single table (timestamp, variable name, value).  But, if
 you index the variable name then writes become too slow (by the end of
 a day's worth of data collection, the next round of data comes in
 before the previous round is written); if you don't index then the
 table is impossible to select from in any reasonable amount of time.
 So, the solution seems to be splitting every variable into its own
 table -- not very good normalization, but retaining good read
 performance without having write performance degrade over time.  The
 join-all-tables-together query would be used for generating a logfile
 in the old format, just in case we need it.

 Am I missing any features of SQLite that would solve this problem in a
 different/better way?

 -Ian

 On Wed, Apr 11, 2012 at 12:20 PM, Pavel Ivanov 
 wrote:
> On Wed, Apr 11, 2012 at 12:01 PM, Ian Katz 
> wrote:
>> The Sqlite3 manual says that any locking operations affect the entire
>> database, not individual tables.
>> http://www.sqlite.org/lockingv3.html
>>
>> I was wondering if this effect could be compensated for by splitting
>> tables into separate databases and using the "attach database" option
>> outlined here:
>> http://stackoverflow.com/questions/6671678/objective-c-sqlite-join-tables-from-multiple-database
>>
>> I would assume that the databases will not become locked until the
>> statement is executed (i.e., preparing the statement won't lock it).
>> Is that correct?
>
> Yes, that's correct, although I don't see a link between this
> statement and "attache database" discussion above.
>
>> If so, is there a significant disadvantage or
>> performance hit to using this workaround?
>
> The first performance hit that comes to mind is either you won't be
> able to use WAL mode (which is a significant performance hit) or you
> lose overall atomicity of transactions (see disadvantage point 3 here
> http://www.sqlite.org/wal.html).
>
> So I wouldn't do t

Re: [sqlite] Using "attach database" to work around DB locking

2012-04-11 Thread Marcus Grimm
> Converting variable name to variable ID (with separate lookup table)
> was one of my first ideas, but turns out that the lookup itself was a
> bigger hit in performance than the indexing.  I'll revisit that and
> see if I failed to tweak something properly.

To me it sounds that it will just move the performance
problem from the indexed column to another separated table
which might as well need an index on "variable name".
I also don't see why a lookup will be faster via
attached databases: Doesn't this just move the lookup
to sqlite's attach command ?
The locking issue of a SELECT might be improved by using
wal mode.

Anyway, you didn't specify how these names look like - in case
they are chars with, say, more than 8 bytes you might
trying to add a CRC integer hash on the variable name
and index that value. Your selects might then look
like SELECT * FROM table WHERE VarName = 'abc' AND VarCRC=N;
This approach avoids to do string comparisons on table
lookup and indexing. It also reduces the size of the index.

Marcus

>
> -Ian
>
> On Wed, Apr 11, 2012 at 1:22 PM, Pavel Ivanov  wrote:
>>> Am I missing any features of SQLite that would solve this problem in a
>>> different/better way?
>>
>> If you didn't try it I would suggest to try a single table (timestamp,
>> variable id, value). Index on integer variable id will work faster
>> than text variable name.
>> Other than that I'd say your design of one table per database is well
>> justified. Especially if you won't attach all databases together while
>> inserting data, but will connect to necessary database directly.
>>
>>
>> Pavel
>>
>>
>> On Wed, Apr 11, 2012 at 1:11 PM, Ian Katz  wrote:
>>> These are all good points, and introduce some features of sqlite that
>>> I didn't know existed!
>>>
>>> The database system that I'm designing is for an autonomous vehicle;
>>> it collects a lot of (data which is currently getting stored as a flat
>>> text file).  So, it's going to write a LOT of data into many tables
>>> independently, occasionally do single-table reads, and at the end of
>>> the day create a report that joins all the tables together.  So, my
>>> main goal is to give maximum speed to writes by compartmentalizing the
>>> locks that the incoming reads will cause.  It sounds like this use
>>> case won't hit any of the disadvantages mentioned above.
>>>
>>> In the past, I've tried to do this in SQLite and MySQL by putting all
>>> the data in a single table (timestamp, variable name, value).  But, if
>>> you index the variable name then writes become too slow (by the end of
>>> a day's worth of data collection, the next round of data comes in
>>> before the previous round is written); if you don't index then the
>>> table is impossible to select from in any reasonable amount of time.
>>> So, the solution seems to be splitting every variable into its own
>>> table -- not very good normalization, but retaining good read
>>> performance without having write performance degrade over time.  The
>>> join-all-tables-together query would be used for generating a logfile
>>> in the old format, just in case we need it.
>>>
>>> Am I missing any features of SQLite that would solve this problem in a
>>> different/better way?
>>>
>>> -Ian
>>>
>>> On Wed, Apr 11, 2012 at 12:20 PM, Pavel Ivanov 
>>> wrote:
 On Wed, Apr 11, 2012 at 12:01 PM, Ian Katz 
 wrote:
> The Sqlite3 manual says that any locking operations affect the entire
> database, not individual tables.
> http://www.sqlite.org/lockingv3.html
>
> I was wondering if this effect could be compensated for by splitting
> tables into separate databases and using the "attach database" option
> outlined here:
> http://stackoverflow.com/questions/6671678/objective-c-sqlite-join-tables-from-multiple-database
>
> I would assume that the databases will not become locked until the
> statement is executed (i.e., preparing the statement won't lock it).
> Is that correct?

 Yes, that's correct, although I don't see a link between this
 statement and "attache database" discussion above.

> If so, is there a significant disadvantage or
> performance hit to using this workaround?

 The first performance hit that comes to mind is either you won't be
 able to use WAL mode (which is a significant performance hit) or you
 lose overall atomicity of transactions (see disadvantage point 3 here
 http://www.sqlite.org/wal.html).

 So I wouldn't do that if I were you.


 Pavel
 ___
 sqlite-users mailing list
 sqlite-users@sqlite.org
 http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>>
>>>
>>>
>>> --
>>> Ian Katz
>>> Research Software Engineer, MIT LAMSS
>>> i...@mit.edu
>>> ___
>>> sqlite-users mailing list
>>> sqlite-users@sqlite.org
>>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>> 

Re: [sqlite] Using "attach database" to work around DB locking

2012-04-11 Thread Simon Slavin

On 11 Apr 2012, at 6:11pm, Ian Katz  wrote:

> The database system that I'm designing is for an autonomous vehicle;
> it collects a lot of (data which is currently getting stored as a flat
> text file).  So, it's going to write a LOT of data into many tables
> independently, occasionally do single-table reads, and at the end of
> the day create a report that joins all the tables together.  So, my
> main goal is to give maximum speed to writes by compartmentalizing the
> locks that the incoming reads will cause.  It sounds like this use
> case won't hit any of the disadvantages mentioned above.

Had you left the 'occasionally do single-table reads' out a solution might be 
to DROP your INDEXes while putting the data in, then CREATE them when you're 
about to do your reading.

> In the past, I've tried to do this in SQLite and MySQL by putting all
> the data in a single table (timestamp, variable name, value).  But, if
> you index the variable name then writes become too slow (by the end of
> a day's worth of data collection, the next round of data comes in
> before the previous round is written); if you don't index then the
> table is impossible to select from in any reasonable amount of time.
> So, the solution seems to be splitting every variable into its own
> table -- not very good normalization, but retaining good read
> performance without having write performance degrade over time.  The
> join-all-tables-together query would be used for generating a logfile
> in the old format, just in case we need it.

Design guideline: If your batches of data all have the same columns, put them 
in the same table.  If two batches of data have different columns, they belong 
in different tables.  There are exceptions to this, of course, but it's a 
guideline.  It would seem that your vehicle delivers a bunch of values at once, 
so they should probably be different columns of a table, and the primary key of 
the row should be the time they were delivered, using whatever coding for the 
time you find convenient.

> Am I missing any features of SQLite that would solve this problem in a
> different/better way?

You haven't really identified a problem.  A problem would be "I need X to work 
in 200ms and it takes 260ms.".  We might be able to answer that one.  On the 
other hand "I need it to work in 5ms and it takes 260ms." also lets us give you 
an answer: not gonna happen, don't waste your time trying.  Telling us 
'maximise speed' doesn't give us enough idea about what to suggest.

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


Re: [sqlite] Using "attach database" to work around DB locking

2012-04-11 Thread Black, Michael (IS)
I assume you are batching your inserts?

How many inserts/sec do you need to do to keep up?



Michael D. Black

Senior Scientist

Advanced Analytics Directorate

Advanced GEOINT Solutions Operating Unit

Northrop Grumman Information Systems


From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on 
behalf of Ian Katz [ifreeca...@gmail.com]
Sent: Wednesday, April 11, 2012 12:11 PM
To: General Discussion of SQLite Database
Subject: EXT :Re: [sqlite] Using "attach database" to work around DB locking

These are all good points, and introduce some features of sqlite that
I didn't know existed!

The database system that I'm designing is for an autonomous vehicle;
it collects a lot of (data which is currently getting stored as a flat
text file).  So, it's going to write a LOT of data into many tables
independently, occasionally do single-table reads, and at the end of
the day create a report that joins all the tables together.  So, my
main goal is to give maximum speed to writes by compartmentalizing the
locks that the incoming reads will cause.  It sounds like this use
case won't hit any of the disadvantages mentioned above.

In the past, I've tried to do this in SQLite and MySQL by putting all
the data in a single table (timestamp, variable name, value).  But, if
you index the variable name then writes become too slow (by the end of
a day's worth of data collection, the next round of data comes in
before the previous round is written); if you don't index then the
table is impossible to select from in any reasonable amount of time.
So, the solution seems to be splitting every variable into its own
table -- not very good normalization, but retaining good read
performance without having write performance degrade over time.  The
join-all-tables-together query would be used for generating a logfile
in the old format, just in case we need it.

Am I missing any features of SQLite that would solve this problem in a
different/better way?

-Ian

On Wed, Apr 11, 2012 at 12:20 PM, Pavel Ivanov  wrote:
> On Wed, Apr 11, 2012 at 12:01 PM, Ian Katz  wrote:
>> The Sqlite3 manual says that any locking operations affect the entire
>> database, not individual tables.
>> http://www.sqlite.org/lockingv3.html
>>
>> I was wondering if this effect could be compensated for by splitting
>> tables into separate databases and using the "attach database" option
>> outlined here:
>> http://stackoverflow.com/questions/6671678/objective-c-sqlite-join-tables-from-multiple-database
>>
>> I would assume that the databases will not become locked until the
>> statement is executed (i.e., preparing the statement won't lock it).
>> Is that correct?
>
> Yes, that's correct, although I don't see a link between this
> statement and "attache database" discussion above.
>
>> If so, is there a significant disadvantage or
>> performance hit to using this workaround?
>
> The first performance hit that comes to mind is either you won't be
> able to use WAL mode (which is a significant performance hit) or you
> lose overall atomicity of transactions (see disadvantage point 3 here
> http://www.sqlite.org/wal.html).
>
> So I wouldn't do that if I were you.
>
>
> Pavel
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users



--
Ian Katz
Research Software Engineer, MIT LAMSS
i...@mit.edu
___
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] Using "attach database" to work around DB locking

2012-04-11 Thread Ian Katz
Converting variable name to variable ID (with separate lookup table)
was one of my first ideas, but turns out that the lookup itself was a
bigger hit in performance than the indexing.  I'll revisit that and
see if I failed to tweak something properly.

-Ian

On Wed, Apr 11, 2012 at 1:22 PM, Pavel Ivanov  wrote:
>> Am I missing any features of SQLite that would solve this problem in a
>> different/better way?
>
> If you didn't try it I would suggest to try a single table (timestamp,
> variable id, value). Index on integer variable id will work faster
> than text variable name.
> Other than that I'd say your design of one table per database is well
> justified. Especially if you won't attach all databases together while
> inserting data, but will connect to necessary database directly.
>
>
> Pavel
>
>
> On Wed, Apr 11, 2012 at 1:11 PM, Ian Katz  wrote:
>> These are all good points, and introduce some features of sqlite that
>> I didn't know existed!
>>
>> The database system that I'm designing is for an autonomous vehicle;
>> it collects a lot of (data which is currently getting stored as a flat
>> text file).  So, it's going to write a LOT of data into many tables
>> independently, occasionally do single-table reads, and at the end of
>> the day create a report that joins all the tables together.  So, my
>> main goal is to give maximum speed to writes by compartmentalizing the
>> locks that the incoming reads will cause.  It sounds like this use
>> case won't hit any of the disadvantages mentioned above.
>>
>> In the past, I've tried to do this in SQLite and MySQL by putting all
>> the data in a single table (timestamp, variable name, value).  But, if
>> you index the variable name then writes become too slow (by the end of
>> a day's worth of data collection, the next round of data comes in
>> before the previous round is written); if you don't index then the
>> table is impossible to select from in any reasonable amount of time.
>> So, the solution seems to be splitting every variable into its own
>> table -- not very good normalization, but retaining good read
>> performance without having write performance degrade over time.  The
>> join-all-tables-together query would be used for generating a logfile
>> in the old format, just in case we need it.
>>
>> Am I missing any features of SQLite that would solve this problem in a
>> different/better way?
>>
>> -Ian
>>
>> On Wed, Apr 11, 2012 at 12:20 PM, Pavel Ivanov  wrote:
>>> On Wed, Apr 11, 2012 at 12:01 PM, Ian Katz  wrote:
 The Sqlite3 manual says that any locking operations affect the entire
 database, not individual tables.
 http://www.sqlite.org/lockingv3.html

 I was wondering if this effect could be compensated for by splitting
 tables into separate databases and using the "attach database" option
 outlined here:
 http://stackoverflow.com/questions/6671678/objective-c-sqlite-join-tables-from-multiple-database

 I would assume that the databases will not become locked until the
 statement is executed (i.e., preparing the statement won't lock it).
 Is that correct?
>>>
>>> Yes, that's correct, although I don't see a link between this
>>> statement and "attache database" discussion above.
>>>
 If so, is there a significant disadvantage or
 performance hit to using this workaround?
>>>
>>> The first performance hit that comes to mind is either you won't be
>>> able to use WAL mode (which is a significant performance hit) or you
>>> lose overall atomicity of transactions (see disadvantage point 3 here
>>> http://www.sqlite.org/wal.html).
>>>
>>> So I wouldn't do that if I were you.
>>>
>>>
>>> Pavel
>>> ___
>>> sqlite-users mailing list
>>> sqlite-users@sqlite.org
>>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
>>
>>
>> --
>> Ian Katz
>> Research Software Engineer, MIT LAMSS
>> i...@mit.edu
>> ___
>> 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



-- 
Ian Katz
Research Software Engineer, MIT LAMSS
i...@mit.edu
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Using "attach database" to work around DB locking

2012-04-11 Thread Pavel Ivanov
> Am I missing any features of SQLite that would solve this problem in a
> different/better way?

If you didn't try it I would suggest to try a single table (timestamp,
variable id, value). Index on integer variable id will work faster
than text variable name.
Other than that I'd say your design of one table per database is well
justified. Especially if you won't attach all databases together while
inserting data, but will connect to necessary database directly.


Pavel


On Wed, Apr 11, 2012 at 1:11 PM, Ian Katz  wrote:
> These are all good points, and introduce some features of sqlite that
> I didn't know existed!
>
> The database system that I'm designing is for an autonomous vehicle;
> it collects a lot of (data which is currently getting stored as a flat
> text file).  So, it's going to write a LOT of data into many tables
> independently, occasionally do single-table reads, and at the end of
> the day create a report that joins all the tables together.  So, my
> main goal is to give maximum speed to writes by compartmentalizing the
> locks that the incoming reads will cause.  It sounds like this use
> case won't hit any of the disadvantages mentioned above.
>
> In the past, I've tried to do this in SQLite and MySQL by putting all
> the data in a single table (timestamp, variable name, value).  But, if
> you index the variable name then writes become too slow (by the end of
> a day's worth of data collection, the next round of data comes in
> before the previous round is written); if you don't index then the
> table is impossible to select from in any reasonable amount of time.
> So, the solution seems to be splitting every variable into its own
> table -- not very good normalization, but retaining good read
> performance without having write performance degrade over time.  The
> join-all-tables-together query would be used for generating a logfile
> in the old format, just in case we need it.
>
> Am I missing any features of SQLite that would solve this problem in a
> different/better way?
>
> -Ian
>
> On Wed, Apr 11, 2012 at 12:20 PM, Pavel Ivanov  wrote:
>> On Wed, Apr 11, 2012 at 12:01 PM, Ian Katz  wrote:
>>> The Sqlite3 manual says that any locking operations affect the entire
>>> database, not individual tables.
>>> http://www.sqlite.org/lockingv3.html
>>>
>>> I was wondering if this effect could be compensated for by splitting
>>> tables into separate databases and using the "attach database" option
>>> outlined here:
>>> http://stackoverflow.com/questions/6671678/objective-c-sqlite-join-tables-from-multiple-database
>>>
>>> I would assume that the databases will not become locked until the
>>> statement is executed (i.e., preparing the statement won't lock it).
>>> Is that correct?
>>
>> Yes, that's correct, although I don't see a link between this
>> statement and "attache database" discussion above.
>>
>>> If so, is there a significant disadvantage or
>>> performance hit to using this workaround?
>>
>> The first performance hit that comes to mind is either you won't be
>> able to use WAL mode (which is a significant performance hit) or you
>> lose overall atomicity of transactions (see disadvantage point 3 here
>> http://www.sqlite.org/wal.html).
>>
>> So I wouldn't do that if I were you.
>>
>>
>> Pavel
>> ___
>> sqlite-users mailing list
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>
>
> --
> Ian Katz
> Research Software Engineer, MIT LAMSS
> i...@mit.edu
> ___
> 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] Using "attach database" to work around DB locking

2012-04-11 Thread Ian Katz
These are all good points, and introduce some features of sqlite that
I didn't know existed!

The database system that I'm designing is for an autonomous vehicle;
it collects a lot of (data which is currently getting stored as a flat
text file).  So, it's going to write a LOT of data into many tables
independently, occasionally do single-table reads, and at the end of
the day create a report that joins all the tables together.  So, my
main goal is to give maximum speed to writes by compartmentalizing the
locks that the incoming reads will cause.  It sounds like this use
case won't hit any of the disadvantages mentioned above.

In the past, I've tried to do this in SQLite and MySQL by putting all
the data in a single table (timestamp, variable name, value).  But, if
you index the variable name then writes become too slow (by the end of
a day's worth of data collection, the next round of data comes in
before the previous round is written); if you don't index then the
table is impossible to select from in any reasonable amount of time.
So, the solution seems to be splitting every variable into its own
table -- not very good normalization, but retaining good read
performance without having write performance degrade over time.  The
join-all-tables-together query would be used for generating a logfile
in the old format, just in case we need it.

Am I missing any features of SQLite that would solve this problem in a
different/better way?

-Ian

On Wed, Apr 11, 2012 at 12:20 PM, Pavel Ivanov  wrote:
> On Wed, Apr 11, 2012 at 12:01 PM, Ian Katz  wrote:
>> The Sqlite3 manual says that any locking operations affect the entire
>> database, not individual tables.
>> http://www.sqlite.org/lockingv3.html
>>
>> I was wondering if this effect could be compensated for by splitting
>> tables into separate databases and using the "attach database" option
>> outlined here:
>> http://stackoverflow.com/questions/6671678/objective-c-sqlite-join-tables-from-multiple-database
>>
>> I would assume that the databases will not become locked until the
>> statement is executed (i.e., preparing the statement won't lock it).
>> Is that correct?
>
> Yes, that's correct, although I don't see a link between this
> statement and "attache database" discussion above.
>
>> If so, is there a significant disadvantage or
>> performance hit to using this workaround?
>
> The first performance hit that comes to mind is either you won't be
> able to use WAL mode (which is a significant performance hit) or you
> lose overall atomicity of transactions (see disadvantage point 3 here
> http://www.sqlite.org/wal.html).
>
> So I wouldn't do that if I were you.
>
>
> Pavel
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users



-- 
Ian Katz
Research Software Engineer, MIT LAMSS
i...@mit.edu
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Is it possible to use substrings of Windows DOS batch fiile parameters in sqlite3.exe -line db ?

2012-04-11 Thread Frank Chang

Message: 19
>Date: Wed, 11 Apr 2012 08:31:49 -0400
>From: Gabor Grothendieck 
>To: General Discussion of SQLite Database 
>Subject: Re: [sqlite] Is it possible to use substrings of Windows DOS
>batch fiile parameters in sqlite3.exe -line db ?
>Message-ID:

  Gabor Gronthendieck, Thank you for your reply. An excerpt of the most recent 
version of our Windows CMD file is:
 
set var=%1
@echo %var:~0,-4% 
set abc= %var:~0,-4% 
cameron.cmd  %abc%
 
  
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Is it possible to use substrings of Windows DOS batch fiile parameters in sqlite3.exe -line db ?

2012-04-11 Thread Frank Chang

inq1ltd, Thank you for your reply. Here is an excerpt of the most recent 
Windows CMD file:
 
 
set var=%1
@echo %var:~0,-4% 
set abc= %var:~0,-4% 
cameron.cmd  %abc%

 
 

> From: inq1...@inqvista.com
> To: sqlite-users@sqlite.org
> CC: frank_chan...@hotmail.com
> Subject: Re: [sqlite] Is it possible to use substrings of Windows DOS batch 
> fiile parameters in sqlite3.exe -line db ?
> Date: Wed, 11 Apr 2012 11:09:44 -0400
> 
> On Tuesday, April 10, 2012 07:14:59 PM Frank Chang wrote:
> > Good evening, We are trying to generate automated SQLITE SQL scripts based
> > on the names of SQLite tables derived by substring manipulation of Windows
> > DOS batch file and/or Windows environment variables. For example:
> > 
> > /* mary.bat */
> > FOR /f %%a IN ('dir /b *.zip') DO CALL sub %%a
> > 
> > 
> > /* sub.bat */
> > set str=%1
> > set camster=%str:~0.17%
> > echo %str:~0,17%
> > E:\users\marc\NJM\spatialite_tool.exe -i -shp %str:~0,17% -d
> > e:\users\marc\NJM\mdMatchup.dat -t %str:~0,17% -g Geometry -c CP1252 -s
> > 4269 E:\users\marc\NJM\sqlite.exe -line e:\users\marc\NJM\mdMatchup.dat
> > "drop table %camster%;"
> > 
> > 
> 
> 
> 
> 
> I think you are asking if you can use a variable 
> to represent your table name.
> 
> I use this in python and have used something 
> similar in DOS to create, delete, update tables on the fly.
> 
> 
> vsqldb = 'SomeDB' ## DB named and related to a variable some place 
> else
> 
> vtablename = 'someTtablename' ## table named some place else
> 
> 
> 
> con = sqlite3.connect (vsqldb) # open DB
> cursor = con.cursor()
> 
> cursor.execute("""DROP TABLE IF EXISTS """ + vtablename ) 
> 
> cursor.execute("""VACUUM""") #clean the DB
> con.commit()
> con.close()
> 
> Dropping the table is possible without hard coding the 
> table name into the Drop Table command. 
> 
> jd
> 
> 
> 
> > Invoking mary.bat at the command line generates the following command
> > script:
> > 
> > E:\TIGER2011\COUSUB>CALL sub tl_2011_78_cousub.zip
> > E:\TIGER2011\COUSUB>set str=tl_2011_78_cousub.zip
> > E:\TIGER2011\COUSUB>set camster=str:~0.17
> > E:\TIGER2011\COUSUB>echo tl_2011_78_cousub
> > tl_2011_78_cousub
> > E:\TIGER2011\COUSUB>E:\users\marc\NJM\spatialite_tool.exe -i -shp
> > tl_2011_78_cou sub -d e:\users\marc\NJM\mdMatchup.dat -t tl_2011_78_cousub
> > -g Geometry -c CP125 2 -s 4269
> > SQLite version: 3.6.16
> > SpatiaLite version: 2.3.1
> > load shapefile error: table 'tl_2011_78_cousub' already exists
> > 
> > E:\TIGER2011\COUSUB>E:\users\marc\NJM\sqlite.exe
> > -line e:\users\marc\NJM\mdMatchup.dat "drop table str:~0.17;"
> > SQL error: unrecognized token: ":"
> > 
> > rather than drop table t1_2011_78_cousub.
> 
> 
> > 
> > Is it possible that we using the wrong SQLite syntax in the sqlite3.exe
> > -line database "sql_statement;"? If so, what might be the correct sqlite
> > command string to drop the table t1_2011_78_cousub? Thank you very much.
> > 
> > ___
> > 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] Using "attach database" to work around DB locking

2012-04-11 Thread Pavel Ivanov
On Wed, Apr 11, 2012 at 12:01 PM, Ian Katz  wrote:
> The Sqlite3 manual says that any locking operations affect the entire
> database, not individual tables.
> http://www.sqlite.org/lockingv3.html
>
> I was wondering if this effect could be compensated for by splitting
> tables into separate databases and using the "attach database" option
> outlined here:
> http://stackoverflow.com/questions/6671678/objective-c-sqlite-join-tables-from-multiple-database
>
> I would assume that the databases will not become locked until the
> statement is executed (i.e., preparing the statement won't lock it).
> Is that correct?

Yes, that's correct, although I don't see a link between this
statement and "attache database" discussion above.

> If so, is there a significant disadvantage or
> performance hit to using this workaround?

The first performance hit that comes to mind is either you won't be
able to use WAL mode (which is a significant performance hit) or you
lose overall atomicity of transactions (see disadvantage point 3 here
http://www.sqlite.org/wal.html).

So I wouldn't do that if I were you.


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


Re: [sqlite] Using "attach database" to work around DB locking

2012-04-11 Thread Simon Slavin

On 11 Apr 2012, at 5:01pm, Ian Katz  wrote:

> The Sqlite3 manual says that any locking operations affect the entire
> database, not individual tables.
> http://www.sqlite.org/lockingv3.html
> 
> I was wondering if this effect could be compensated for by splitting
> tables into separate databases and using the "attach database" option
> outlined here:
> http://stackoverflow.com/questions/6671678/objective-c-sqlite-join-tables-from-multiple-database

The technique will do what you want: lock only one table at a time.  However, 
you may not have thought through what's really happening.  Almost all the time 
taken by SQLite routines is time spent waiting for your hard disk to do 
something: either produce some data because of a read, or acknowledge a write 
command.  Your two database files will be on the same hard disk.  And a hard 
disk drive is not multi-threading: it takes one command at a time, processes 
that command, and returns the result.  So even if you allow SQLite to access 
two tables at once, your commands will still delay one-another because they're 
waiting for the same hard disk to respond to their commands.

For client/server data engines like MySQL, running on a server computer, with a 
persistent data cache in memory, locking at the table and/or row level can lead 
to great increases in speed: everything is just looking at RAM, and the hard 
disk is updated in the background.  But SQLite does everything directly to the 
disk, and the disk is a bottleneck no matter how much you speed up your 
internal processing.

I have not done speed tests on recent hardware (either rotating media or SSD) 
so I can't tell you how much the increase in speed actually is, but I will 
guess it's not much.  Perhaps someone out there has done such testing and can 
tell us what they found.

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


[sqlite] Using "attach database" to work around DB locking

2012-04-11 Thread Ian Katz
Hello,

The Sqlite3 manual says that any locking operations affect the entire
database, not individual tables.
http://www.sqlite.org/lockingv3.html

I was wondering if this effect could be compensated for by splitting
tables into separate databases and using the "attach database" option
outlined here:
http://stackoverflow.com/questions/6671678/objective-c-sqlite-join-tables-from-multiple-database

I would assume that the databases will not become locked until the
statement is executed (i.e., preparing the statement won't lock it).
Is that correct?  If so, is there a significant disadvantage or
performance hit to using this workaround?

Thanks,
-Ian

-- 
Ian Katz
Research Software Engineer, MIT LAMSS
i...@mit.edu
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Unicode problem when setting PRAGMA journal_mode

2012-04-11 Thread Nick Shaw

-Original Message-
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of Nick Shaw
Sent: 11 April 2012 16:29
To: General Discussion of SQLite Database
Subject: Re: [sqlite] Unicode problem when setting PRAGMA journal_mode

-Original Message-
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of Dan Kennedy
Sent: 11 April 2012 16:07
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] Unicode problem when setting PRAGMA journal_mode

> After sqlite3_close() returns SQLITE_BUSY, you can use
> sqlite3_next_stmt() to loop through those statements that SQLite thinks are 
> unfinalized. Then use sqlite3_sql() to identify each.
> 
> The results might reveal something.

Found the problem.  Was indeed in my code, deep inside my own wrapper function. 
 There's no Unicode equivalent of sqlite3_exec(), so in unicode, it has to go 
through the prepare/step/finalize steps.  It wasn't finalizing the stmt (as 
that bit of code in my wrapper is usually only called if the caller wants data 
back, so assumes the caller will finalize the stmt at a later time).  Whoops!

Thanks for the help anyway guys!
Nick.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Unicode problem when setting PRAGMA journal_mode

2012-04-11 Thread Nick Shaw
-Original Message-
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of Dan Kennedy
Sent: 11 April 2012 16:07
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] Unicode problem when setting PRAGMA journal_mode

> After sqlite3_close() returns SQLITE_BUSY, you can use
> sqlite3_next_stmt() to loop through those statements that SQLite thinks are 
> unfinalized. Then use sqlite3_sql() to identify each.
> 
> The results might reveal something.

Ok, did this.  It tells me the SQL command that is unfinalized is: "PRAGMA 
journal_mode = DELETE".

I also did Simon's suggestion of setting the PRAGMA to what it already was set 
to (confirmed it was set to DELETE) - made no difference.

Something seems amiss.  I'll do some more debugging and get back to you all.  
Could be an error in my code which only occurs in Unicode build...

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


Re: [sqlite] Unicode problem when setting PRAGMA journal_mode

2012-04-11 Thread Nick Shaw
-Original Message-
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of Dan Kennedy
Sent: 11 April 2012 16:07
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] Unicode problem when setting PRAGMA journal_mode

> > I'll try your suggestion of setting it to what it currently is (it *should* 
> > be DELETE) and see what it does.
> 
> After sqlite3_close() returns SQLITE_BUSY, you can use
> sqlite3_next_stmt() to loop through those statements that SQLite thinks are 
> unfinalized. Then use sqlite3_sql() to identify each.
> 
> The results might reveal something.

Oooh, good plan, thanks Dan, I'll try that.

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


Re: [sqlite] Is it possible to use substrings of Windows DOS batch fiile parameters in sqlite3.exe -line db ?

2012-04-11 Thread inq1ltd
On Tuesday, April 10, 2012 07:14:59 PM Frank Chang wrote:
> Good evening, We are trying to generate automated SQLITE  SQL scripts based
> on the names of SQLite tables derived by substring manipulation of Windows
> DOS batch file and/or Windows environment variables. For example:
> 
> /*   mary.bat */
> FOR /f %%a IN ('dir /b *.zip') DO CALL sub %%a
> 
> 
> /* sub.bat */
> set str=%1
> set camster=%str:~0.17%
> echo %str:~0,17%
> E:\users\marc\NJM\spatialite_tool.exe -i -shp %str:~0,17% -d
> e:\users\marc\NJM\mdMatchup.dat -t %str:~0,17% -g Geometry -c CP1252 -s
> 4269 E:\users\marc\NJM\sqlite.exe -line e:\users\marc\NJM\mdMatchup.dat
> "drop table %camster%;"
> 
> 




I think you are asking if you can use a variable 
to represent your table name.

I use this in python and have used something 
similar in DOS to create, delete, update  tables on the fly.
   

vsqldb = 'SomeDB'   ##  DB named and related to a variable some place 
else

vtablename = 'someTtablename'   ##  table named some place else



con = sqlite3.connect (vsqldb)   # open DB
cursor = con.cursor()

cursor.execute("""DROP TABLE IF EXISTS """ + vtablename ) 

cursor.execute("""VACUUM""")  #clean the DB
con.commit()
con.close()

 Dropping the table is possible without hard coding the 
 table name into the Drop Table command. 

jd



> Invoking mary.bat at the command line generates the following command
> script:
> 
> E:\TIGER2011\COUSUB>CALL sub tl_2011_78_cousub.zip
> E:\TIGER2011\COUSUB>set str=tl_2011_78_cousub.zip
> E:\TIGER2011\COUSUB>set camster=str:~0.17
> E:\TIGER2011\COUSUB>echo tl_2011_78_cousub
> tl_2011_78_cousub
> E:\TIGER2011\COUSUB>E:\users\marc\NJM\spatialite_tool.exe -i -shp
> tl_2011_78_cou sub -d e:\users\marc\NJM\mdMatchup.dat -t tl_2011_78_cousub
> -g Geometry -c CP125 2 -s 4269
> SQLite version: 3.6.16
> SpatiaLite version: 2.3.1
> load shapefile error: table 'tl_2011_78_cousub' already exists
> 
> E:\TIGER2011\COUSUB>E:\users\marc\NJM\sqlite.exe
> -line e:\users\marc\NJM\mdMatchup.dat "drop table str:~0.17;"
> SQL error: unrecognized token: ":"
> 
> rather than drop table t1_2011_78_cousub.


> 
> Is it possible that we using the wrong SQLite syntax in the sqlite3.exe
> -line database "sql_statement;"? If so, what might be the correct sqlite
> command string to drop the table t1_2011_78_cousub? Thank you very much.
> 
> ___
> 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] Unicode problem when setting PRAGMA journal_mode

2012-04-11 Thread Dan Kennedy

On 04/11/2012 09:50 PM, Nick Shaw wrote:

-Original Message-
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of Simon Slavin
Sent: 10 April 2012 19:04
To: General Discussion of SQLite Database
Subject: Re: [sqlite] Unicode problem when setting PRAGMA journal_mode


Realised I made a typo below: should have said "PRAGMA journal_mode = DELETE" 
(though setting it to WAL or OFF causes the same problem).


Are you by any chance having a technical problem with the PRAGMA command itself ?  For 
instance, suppose the command was encoded in UTF-16 and SQLite was expecting ASCII.  Figure 
out what the default>  value should be (e.g. use the shell tool to do a "PRAGMA 
journal_mode;") then change your normal app to set the mode to that value.  See if it 
gives you the same problem.


I'm not getting the same problem with other PRAGMA commands (quick_check(1) and 
synchronous=NORMAL), so I don't know why journal_mode would be any different.  
If I leave this one PRAGMA out, everything is fine.  If I include it, the DB 
always fails to close.  But only in Unicode.

I'll try your suggestion of setting it to what it currently is (it *should* be 
DELETE) and see what it does.


After sqlite3_close() returns SQLITE_BUSY, you can use
sqlite3_next_stmt() to loop through those statements that
SQLite thinks are unfinalized. Then use sqlite3_sql() to
identify each.

The results might reveal something.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Unicode problem when setting PRAGMA journal_mode

2012-04-11 Thread Nick Shaw
-Original Message-
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of Simon Slavin
Sent: 10 April 2012 19:04
To: General Discussion of SQLite Database
Subject: Re: [sqlite] Unicode problem when setting PRAGMA journal_mode

>> Realised I made a typo below: should have said "PRAGMA journal_mode = 
>> DELETE" (though setting it to WAL or OFF causes the same problem).
>
> Are you by any chance having a technical problem with the PRAGMA command 
> itself ?  For instance, suppose the command was encoded in UTF-16 and SQLite 
> was expecting ASCII.  Figure out what the default > value should be (e.g. use 
> the shell tool to do a "PRAGMA journal_mode;") then change your normal app to 
> set the mode to that value.  See if it gives you the same problem.

I'm not getting the same problem with other PRAGMA commands (quick_check(1) and 
synchronous=NORMAL), so I don't know why journal_mode would be any different.  
If I leave this one PRAGMA out, everything is fine.  If I include it, the DB 
always fails to close.  But only in Unicode.

I'll try your suggestion of setting it to what it currently is (it *should* be 
DELETE) and see what it does.

Thanks,
Nick.

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


Re: [sqlite] Two potential memory leaks in sqlite-3.7.11

2012-04-11 Thread Pavel Ivanov
FYI: both leaks are fixed in trunk: http://www.sqlite.org/src/info/93a0f452a7.


Pavel


2012/4/11 Zhenbo Xu :
> What about the second one?
> The heap object allocated at
> 7547 home_dir =
> find_home_dir()
> ; and is not released when exiting this function via
> 7558 return 1;
> 在 2012年4月11日 下午8:06,Andrew Suffield 写道:
>
>> On Wed, Apr 11, 2012 at 02:01:29PM +0200, Eduardo Morras wrote:
>> > At 12:09 11/04/2012, you wrote:
>> > >Hi, all
>> > >I have applied a memory leak detection tool
>> > >Melton to
>> > >find memory leaks in sqlite-3.7.11.
>> > >Two bugs were found, and I check them manually as the real ones.
>> > >Here is the url of the bugs:
>> > >
>> http://lcs.ios.ac.cn/~xuzb/bugsfound/memleak/sqlite-3.7.11/realbugs/index.html
>> >
>> > For the first one, check line 6307. It does a trick to call free
>> > only if the pointer is not null.
>>
>> That's zSelect. The leaked object is zTmp, which has been sneakily
>> allocated by the appendText function on 6276. Looks like it's actually
>> leaked on every call.
>> ___
>> sqlite-users mailing list
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
>
>
>
> --
> Zhenbo Xu
> ___
> 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] Two potential memory leaks in sqlite-3.7.11

2012-04-11 Thread Zhenbo Xu
Hi, all
I have applied a memory leak detection tool
Melton to
find memory leaks in sqlite-3.7.11.
Two bugs were found, and I check them manually as the real ones.
Here is the url of the bugs:
http://lcs.ios.ac.cn/~xuzb/bugsfound/memleak/sqlite-3.7.11/realbugs/index.html

Or you can download it at:
http://lcs.ios.ac.cn/~xuzb/bugsfound/memleak/sqlite-3.7.11/realbugs_sqlite_3.7.11.tar.gz


Hope for your replies if these bugs are the real ones. Thank you!
-- 
Zhenbo Xu
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] error compilation with sqlite amalgamation

2012-04-11 Thread Black, Michael (IS)
Oops...typo on my part.  Missed a "p'.





-lpthread



Michael D. Black

Senior Scientist

Advanced Analytics Directorate

Advanced GEOINT Solutions Operating Unit

Northrop Grumman Information Systems


From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on 
behalf of Sako Youssouf [youssouf.s...@renault-trucks.com]
Sent: Wednesday, April 11, 2012 7:42 AM
To: General Discussion of SQLite Database
Subject: EXT :Re: [sqlite] error compilation with sqlite amalgamation

Thank you Michael,

I compiled without including the library.
When I include the dl library the "dl..." error disappear but I can't find the 
thread library.
I find the "thread_db" library but the "thread..." error doesn't disappear when 
I use it.
 Do you know where can I find that thread library?

-Message d'origine-
De : sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
De la part de Black, Michael (IS)
Envoyé : mercredi 11 avril 2012 14:01
À : General Discussion of SQLite Database
Objet : Re: [sqlite] error compilation with sqlite amalgamation

You don't show how you're compiling...but this is what you need to do.



gcc -o myprog myprog.c sqlite3.c -lthread -ldl



Your undefined reference are to the two libraries you need to link in to 
resolve them.





Michael D. Black

Senior Scientist

Advanced Analytics Directorate

Advanced GEOINT Solutions Operating Unit

Northrop Grumman Information Systems


From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on 
behalf of Sako Youssouf [youssouf.s...@renault-trucks.com]
Sent: Wednesday, April 11, 2012 6:20 AM
To: sqlite-users@sqlite.org
Subject: EXT :[sqlite] error compilation with sqlite amalgamation

Hi,

I want to use sqlite with an arm processor, and when I compiled the source 
files from the amalgamation, I got  these errors:

sqlite3.o: In function `pthreadMutexAlloc':

sqlite3.c:(.text+0x3a93): undefined reference to `pthread_mutexattr_init'

sqlite3.c:(.text+0x3aa6): undefined reference to `pthread_mutexattr_settype'

sqlite3.c:(.text+0x3ac3): undefined reference to `pthread_mutexattr_destroy'

sqlite3.o: In function `pthreadMutexTry':

sqlite3.c:(.text+0x3b64): undefined reference to `pthread_mutex_trylock'

sqlite3.o: In function `unixDlOpen':

sqlite3.c:(.text+0xccf6): undefined reference to `dlopen'

sqlite3.o: In function `unixDlError':

sqlite3.c:(.text+0xcd08): undefined reference to `dlerror'

sqlite3.o: In function `unixDlSym':

sqlite3.c:(.text+0xcd46): undefined reference to `dlsym'

sqlite3.o: In function `unixDlClose':

sqlite3.c:(.text+0xcd6b): undefined reference to `dlclose'

collect2: ld a retourné 1 code d'état d'exécution

can someone explain me what can be the problem ?
thank you!
Youssouf
___
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-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] error compilation with sqlite amalgamation

2012-04-11 Thread Sako Youssouf
Problem resolved, it was pthread library instead of thread.

Thank you again 

-Message d'origine-
De : sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
De la part de Sako Youssouf
Envoyé : mercredi 11 avril 2012 14:43
À : General Discussion of SQLite Database
Objet : Re: [sqlite] error compilation with sqlite amalgamation

Thank you Michael,

I compiled without including the library.
When I include the dl library the "dl..." error disappear but I can't find the 
thread library.
I find the "thread_db" library but the "thread..." error doesn't disappear when 
I use it.
 Do you know where can I find that thread library? 

-Message d'origine-
De : sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
De la part de Black, Michael (IS)
Envoyé : mercredi 11 avril 2012 14:01
À : General Discussion of SQLite Database
Objet : Re: [sqlite] error compilation with sqlite amalgamation

You don't show how you're compiling...but this is what you need to do.



gcc -o myprog myprog.c sqlite3.c -lthread -ldl



Your undefined reference are to the two libraries you need to link in to 
resolve them.





Michael D. Black

Senior Scientist

Advanced Analytics Directorate

Advanced GEOINT Solutions Operating Unit

Northrop Grumman Information Systems


From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on 
behalf of Sako Youssouf [youssouf.s...@renault-trucks.com]
Sent: Wednesday, April 11, 2012 6:20 AM
To: sqlite-users@sqlite.org
Subject: EXT :[sqlite] error compilation with sqlite amalgamation

Hi,

I want to use sqlite with an arm processor, and when I compiled the source 
files from the amalgamation, I got  these errors:

sqlite3.o: In function `pthreadMutexAlloc':

sqlite3.c:(.text+0x3a93): undefined reference to `pthread_mutexattr_init'

sqlite3.c:(.text+0x3aa6): undefined reference to `pthread_mutexattr_settype'

sqlite3.c:(.text+0x3ac3): undefined reference to `pthread_mutexattr_destroy'

sqlite3.o: In function `pthreadMutexTry':

sqlite3.c:(.text+0x3b64): undefined reference to `pthread_mutex_trylock'

sqlite3.o: In function `unixDlOpen':

sqlite3.c:(.text+0xccf6): undefined reference to `dlopen'

sqlite3.o: In function `unixDlError':

sqlite3.c:(.text+0xcd08): undefined reference to `dlerror'

sqlite3.o: In function `unixDlSym':

sqlite3.c:(.text+0xcd46): undefined reference to `dlsym'

sqlite3.o: In function `unixDlClose':

sqlite3.c:(.text+0xcd6b): undefined reference to `dlclose'

collect2: ld a retourné 1 code d'état d'exécution

can someone explain me what can be the problem ?
thank you!
Youssouf
___
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-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] error compilation with sqlite amalgamation

2012-04-11 Thread Sako Youssouf
Thank you Michael,

I compiled without including the library.
When I include the dl library the "dl..." error disappear but I can't find the 
thread library.
I find the "thread_db" library but the "thread..." error doesn't disappear when 
I use it.
 Do you know where can I find that thread library? 

-Message d'origine-
De : sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
De la part de Black, Michael (IS)
Envoyé : mercredi 11 avril 2012 14:01
À : General Discussion of SQLite Database
Objet : Re: [sqlite] error compilation with sqlite amalgamation

You don't show how you're compiling...but this is what you need to do.



gcc -o myprog myprog.c sqlite3.c -lthread -ldl



Your undefined reference are to the two libraries you need to link in to 
resolve them.





Michael D. Black

Senior Scientist

Advanced Analytics Directorate

Advanced GEOINT Solutions Operating Unit

Northrop Grumman Information Systems


From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on 
behalf of Sako Youssouf [youssouf.s...@renault-trucks.com]
Sent: Wednesday, April 11, 2012 6:20 AM
To: sqlite-users@sqlite.org
Subject: EXT :[sqlite] error compilation with sqlite amalgamation

Hi,

I want to use sqlite with an arm processor, and when I compiled the source 
files from the amalgamation, I got  these errors:

sqlite3.o: In function `pthreadMutexAlloc':

sqlite3.c:(.text+0x3a93): undefined reference to `pthread_mutexattr_init'

sqlite3.c:(.text+0x3aa6): undefined reference to `pthread_mutexattr_settype'

sqlite3.c:(.text+0x3ac3): undefined reference to `pthread_mutexattr_destroy'

sqlite3.o: In function `pthreadMutexTry':

sqlite3.c:(.text+0x3b64): undefined reference to `pthread_mutex_trylock'

sqlite3.o: In function `unixDlOpen':

sqlite3.c:(.text+0xccf6): undefined reference to `dlopen'

sqlite3.o: In function `unixDlError':

sqlite3.c:(.text+0xcd08): undefined reference to `dlerror'

sqlite3.o: In function `unixDlSym':

sqlite3.c:(.text+0xcd46): undefined reference to `dlsym'

sqlite3.o: In function `unixDlClose':

sqlite3.c:(.text+0xcd6b): undefined reference to `dlclose'

collect2: ld a retourné 1 code d'état d'exécution

can someone explain me what can be the problem ?
thank you!
Youssouf
___
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


Re: [sqlite] Is it possible to use substrings of Windows DOS batch fiile parameters in sqlite3.exe -line db ?

2012-04-11 Thread Gabor Grothendieck
On Tue, Apr 10, 2012 at 7:14 PM, Frank Chang  wrote:
>
> Good evening, We are trying to generate automated SQLITE  SQL scripts based 
> on the names of SQLite tables derived by substring manipulation of Windows 
> DOS batch file and/or Windows environment variables. For example:
>
> /*   mary.bat */
> FOR /f %%a IN ('dir /b *.zip') DO CALL sub %%a
>
>
> /* sub.bat */
> set str=%1
> set camster=%str:~0.17%

The dot should be a comma.

-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Two potential memory leaks in sqlite-3.7.11

2012-04-11 Thread Eduardo Morras

At 14:06 11/04/2012, you wrote:

On Wed, Apr 11, 2012 at 02:01:29PM +0200, Eduardo Morras wrote:
> At 12:09 11/04/2012, you wrote:
> >Hi, all
> >I have applied a memory leak detection tool
> >Melton to
> >find memory leaks in sqlite-3.7.11.
> >Two bugs were found, and I check them manually as the real ones.
> >Here is the url of the bugs:
> >http://lcs.ios.ac.cn/~xuzb/bugsfound/memleak/sqlite-3.7.11/realbu 
gs/index.html

>
> For the first one, check line 6307. It does a trick to call free
> only if the pointer is not null.

That's zSelect. The leaked object is zTmp, which has been sneakily
allocated by the appendText function on 6276. Looks like it's actually
leaked on every call.


It's realloced inside appendText function, you're right.


___
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] Two potential memory leaks in sqlite-3.7.11

2012-04-11 Thread Zhenbo Xu
What about the second one?
The heap object allocated at
7547 home_dir =
find_home_dir()
; and is not released when exiting this function via
7558 return 1;
在 2012年4月11日 下午8:06,Andrew Suffield 写道:

> On Wed, Apr 11, 2012 at 02:01:29PM +0200, Eduardo Morras wrote:
> > At 12:09 11/04/2012, you wrote:
> > >Hi, all
> > >I have applied a memory leak detection tool
> > >Melton to
> > >find memory leaks in sqlite-3.7.11.
> > >Two bugs were found, and I check them manually as the real ones.
> > >Here is the url of the bugs:
> > >
> http://lcs.ios.ac.cn/~xuzb/bugsfound/memleak/sqlite-3.7.11/realbugs/index.html
> >
> > For the first one, check line 6307. It does a trick to call free
> > only if the pointer is not null.
>
> That's zSelect. The leaked object is zTmp, which has been sneakily
> allocated by the appendText function on 6276. Looks like it's actually
> leaked on every call.
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



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


Re: [sqlite] Two potential memory leaks in sqlite-3.7.11

2012-04-11 Thread Andrew Suffield
On Wed, Apr 11, 2012 at 02:01:29PM +0200, Eduardo Morras wrote:
> At 12:09 11/04/2012, you wrote:
> >Hi, all
> >I have applied a memory leak detection tool
> >Melton to
> >find memory leaks in sqlite-3.7.11.
> >Two bugs were found, and I check them manually as the real ones.
> >Here is the url of the bugs:
> >http://lcs.ios.ac.cn/~xuzb/bugsfound/memleak/sqlite-3.7.11/realbugs/index.html
> 
> For the first one, check line 6307. It does a trick to call free
> only if the pointer is not null.

That's zSelect. The leaked object is zTmp, which has been sneakily
allocated by the appendText function on 6276. Looks like it's actually
leaked on every call.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] error compilation with sqlite amalgamation

2012-04-11 Thread Black, Michael (IS)
You don't show how you're compiling...but this is what you need to do.



gcc -o myprog myprog.c sqlite3.c -lthread -ldl



Your undefined reference are to the two libraries you need to link in to 
resolve them.





Michael D. Black

Senior Scientist

Advanced Analytics Directorate

Advanced GEOINT Solutions Operating Unit

Northrop Grumman Information Systems


From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on 
behalf of Sako Youssouf [youssouf.s...@renault-trucks.com]
Sent: Wednesday, April 11, 2012 6:20 AM
To: sqlite-users@sqlite.org
Subject: EXT :[sqlite] error compilation with sqlite amalgamation

Hi,

I want to use sqlite with an arm processor, and when I compiled the source 
files from the amalgamation, I got  these errors:

sqlite3.o: In function `pthreadMutexAlloc':

sqlite3.c:(.text+0x3a93): undefined reference to `pthread_mutexattr_init'

sqlite3.c:(.text+0x3aa6): undefined reference to `pthread_mutexattr_settype'

sqlite3.c:(.text+0x3ac3): undefined reference to `pthread_mutexattr_destroy'

sqlite3.o: In function `pthreadMutexTry':

sqlite3.c:(.text+0x3b64): undefined reference to `pthread_mutex_trylock'

sqlite3.o: In function `unixDlOpen':

sqlite3.c:(.text+0xccf6): undefined reference to `dlopen'

sqlite3.o: In function `unixDlError':

sqlite3.c:(.text+0xcd08): undefined reference to `dlerror'

sqlite3.o: In function `unixDlSym':

sqlite3.c:(.text+0xcd46): undefined reference to `dlsym'

sqlite3.o: In function `unixDlClose':

sqlite3.c:(.text+0xcd6b): undefined reference to `dlclose'

collect2: ld a retourné 1 code d'état d'exécution

can someone explain me what can be the problem ?
thank you!
Youssouf
___
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] Two potential memory leaks in sqlite-3.7.11

2012-04-11 Thread Eduardo Morras

At 12:09 11/04/2012, you wrote:

Hi, all
I have applied a memory leak detection tool
Melton to
find memory leaks in sqlite-3.7.11.
Two bugs were found, and I check them manually as the real ones.
Here is the url of the bugs:
http://lcs.ios.ac.cn/~xuzb/bugsfound/memleak/sqlite-3.7.11/realbugs/index.html


For the first one, check line 6307. It does a trick to call free only 
if the pointer is not null.


For the second perhaps the same trick as 6307 line should be added in 
7572, changing:


- 7572 free(zBuf);
+ 7572 if (zBuf) free(zBuf);

Because the malloc in line 7555 is inside if from line 7546.


Or you can download it at:
http://lcs.ios.ac.cn/~xuzb/bugsfound/memleak/sqlite-3.7.11/realbugs_sqlite_3.7.11.tar.gz


Hope for your replies if these bugs are the real ones. Thank you!

--
Zhenbo Xu
___
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] error compilation with sqlite amalgamation

2012-04-11 Thread Sako Youssouf
Hi,

I want to use sqlite with an arm processor, and when I compiled the source 
files from the amalgamation, I got  these errors:

sqlite3.o: In function `pthreadMutexAlloc':

sqlite3.c:(.text+0x3a93): undefined reference to `pthread_mutexattr_init'

sqlite3.c:(.text+0x3aa6): undefined reference to `pthread_mutexattr_settype'

sqlite3.c:(.text+0x3ac3): undefined reference to `pthread_mutexattr_destroy'

sqlite3.o: In function `pthreadMutexTry':

sqlite3.c:(.text+0x3b64): undefined reference to `pthread_mutex_trylock'

sqlite3.o: In function `unixDlOpen':

sqlite3.c:(.text+0xccf6): undefined reference to `dlopen'

sqlite3.o: In function `unixDlError':

sqlite3.c:(.text+0xcd08): undefined reference to `dlerror'

sqlite3.o: In function `unixDlSym':

sqlite3.c:(.text+0xcd46): undefined reference to `dlsym'

sqlite3.o: In function `unixDlClose':

sqlite3.c:(.text+0xcd6b): undefined reference to `dlclose'

collect2: ld a retourné 1 code d'état d'exécution

can someone explain me what can be the problem ?
thank you!
Youssouf
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Issue with Session while using SQLLITE database

2012-04-11 Thread Taleeb Anwar
As the error suggests you need to serialize you session object when using
"State Server". See an example here -
http://nareshkamuni.blogspot.in/2011/12/example-of-stateserver-session-mode-in.html(note
the [serializable] tag).

Maybe someone else may explain which will be a better option (to use state
server or to move the db out) - myself: am just a beginner in .NET and thus
will not try to answer that..

Hope it helps...
Taleeb Anwar

*Hai Ab bhi Tera "Shwarma" Afsana Khwan Humara!!*




On Wed, Apr 11, 2012 at 3:37 PM, Dorababu Meka  wrote:

> Ok but I am using Mysql too in my application if I use that I am getting an
> error as
>
> *Unable to serialize the session state. In 'StateServer' and 'SQLServer'
> mode, ASP.NET will serialize the session state objects, and as a result
> non-serializable objects or MarshalByRef objects are not permitted. The
> same restriction applies if similar serialization is done by the custom
> session state store in 'Custom' mode.*
> On Wed, Apr 11, 2012 at 1:32 PM, Taleeb Anwar 
> wrote:
>
> > Ok. Here's what I guess is happening. You are making changes in you db
> file
> > which is stored inside your bin directory. When there is a change in the
> > bin directory* the App pool recycles *and thus you loose the session
> > variable.
> >
> > There must be several ways of avoiding it - perhaps the following will
> work
> > In your web.config add the following
> >
> > 
> >
> >
> >
> > 
> >
> > Hope it helps...
> >
> > Thanks & Regards
> > Taleeb Anwar
> >
> > *Hai Ab bhi Tera "Shwarma" Afsana Khwan Humara!!*
> >
> >
> >
> >
> > On Tue, Apr 10, 2012 at 6:26 PM, Dorababu Meka 
> > wrote:
> >
> > > Yeah on Inserting or Updating the session is getting *NULL*
> > >
> > > On Tue, Apr 10, 2012 at 6:25 PM, Taleeb Anwar 
> > > wrote:
> > >
> > > > Of course the value will not be inserted - but just wanted to make
> sure
> > > > that the problem is occurring on insertion..!
> > > >
> > > > Thanks & Regards
> > > > Taleeb Anwar
> > > >
> > > > *Hai Ab bhi Tera "Shwarma" Afsana Khwan Humara!!*
> > > >
> > > >
> > > >
> > > >
> > > > On Tue, Apr 10, 2012 at 6:23 PM, Dorababu Meka 
> > > > wrote:
> > > >
> > > > > How Can I insert data in to the table if I comment that line as per
> > you
> > > > > said..
> > > > >
> > > > > Session value exists if I comment that line..
> > > > >
> > > > > On Tue, Apr 10, 2012 at 6:20 PM, Taleeb Anwar <
> taleeban...@gmail.com
> > >
> > > > > wrote:
> > > > >
> > > > > > Though I don't know much about .NET...still
> > > > > >
> > > > > > Try the following
> > > > > > Comment the execute non query. Now Click on button 1 (no values
> > will
> > > be
> > > > > > inserted) and then on button 2. Is session value retained or
> lost?
> > > > > >
> > > > > > Thanks & Regards
> > > > > > Taleeb Anwar
> > > > > >
> > > > > > *Hai Ab bhi Tera "Shwarma" Afsana Khwan Humara!!*
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > On Tue, Apr 10, 2012 at 5:40 PM, Dorababu Meka <
> > dora.m...@gmail.com>
> > > > > > wrote:
> > > > > >
> > > > > > > This is my code that I have written in .Net
> > > > > > >
> > > > > > > protected void Page_Load(object sender, EventArgs e)
> > > > > > >{
> > > > > > >
> > > > > > >if (!IsPostBack)
> > > > > > >{
> > > > > > >Session["x"] = "session value"; // assigning Session
> > > > > > >}
> > > > > > >}
> > > > > > >
> > > > > > > My code to insert data to the Database is as follows
> > > > > > >
> > > > > > > protected void Button1_Click(object sender, EventArgs e)
> > > > > > >{
> > > > > > >string path = Server.MapPath("bin/sampldb.db");
> > > > > > >SQLiteConnection conn = new SQLiteConnection("Data
> > Source="
> > > +
> > > > > path
> > > > > > > + "");
> > > > > > >try
> > > > > > >{
> > > > > > >conn.Open();
> > > > > > >SQLiteCommand cmd = new SQLiteCommand();
> > > > > > >cmd.Connection = conn;
> > > > > > >string txt = "insert into stu values(" +
> > TextBox1.Text +
> > > > > ",'"
> > > > > > +
> > > > > > > TextBox2.Text + "')";
> > > > > > >cmd.CommandType = CommandType.Text;
> > > > > > >cmd.CommandText = txt;
> > > > > > >cmd.ExecuteNonQuery();
> > > > > > >conn.Close();
> > > > > > >
> > > > > > >}
> > > > > > >catch (Exception ex)
> > > > > > >{
> > > > > > >Label1.Visible = true;
> > > > > > >Label1.Text = "Error:" + ex.Message;
> > > > > > >}
> > > > > > >}
> > > > > > >
> > > > > > > My code to test whether Session exists or not after Inserting
> > data
> > > is
> > > > > as
> > > > > > > follows
> > > > > > >
> > > > > > > protected void Button2_Click(object sender, EventArgs e)
> > > > > > >{
> > > > > > >if (Session["x"] != null)  // Here after Inserting data
> > and
> > > > > > > clicking on the next button available my Session value is
> getting
> >

[sqlite] Two potential memory leaks in sqlite-3.7.11

2012-04-11 Thread Zhenbo Xu
Hi, all
I have applied a memory leak detection tool
Melton to
find memory leaks in sqlite-3.7.11.
Two bugs were found, and I check them manually as the real ones.
Here is the url of the bugs:
http://lcs.ios.ac.cn/~xuzb/bugsfound/memleak/sqlite-3.7.11/realbugs/index.html

Or you can download it at:
http://lcs.ios.ac.cn/~xuzb/bugsfound/memleak/sqlite-3.7.11/realbugs_sqlite_3.7.11.tar.gz


Hope for your replies if these bugs are the real ones. Thank you!

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


Re: [sqlite] Issue with Session while using SQLLITE database

2012-04-11 Thread Dorababu Meka
Ok but I am using Mysql too in my application if I use that I am getting an
error as

*Unable to serialize the session state. In 'StateServer' and 'SQLServer'
mode, ASP.NET will serialize the session state objects, and as a result
non-serializable objects or MarshalByRef objects are not permitted. The
same restriction applies if similar serialization is done by the custom
session state store in 'Custom' mode.*
On Wed, Apr 11, 2012 at 1:32 PM, Taleeb Anwar  wrote:

> Ok. Here's what I guess is happening. You are making changes in you db file
> which is stored inside your bin directory. When there is a change in the
> bin directory* the App pool recycles *and thus you loose the session
> variable.
>
> There must be several ways of avoiding it - perhaps the following will work
> In your web.config add the following
>
> 
>
>
>
> 
>
> Hope it helps...
>
> Thanks & Regards
> Taleeb Anwar
>
> *Hai Ab bhi Tera "Shwarma" Afsana Khwan Humara!!*
>
>
>
>
> On Tue, Apr 10, 2012 at 6:26 PM, Dorababu Meka 
> wrote:
>
> > Yeah on Inserting or Updating the session is getting *NULL*
> >
> > On Tue, Apr 10, 2012 at 6:25 PM, Taleeb Anwar 
> > wrote:
> >
> > > Of course the value will not be inserted - but just wanted to make sure
> > > that the problem is occurring on insertion..!
> > >
> > > Thanks & Regards
> > > Taleeb Anwar
> > >
> > > *Hai Ab bhi Tera "Shwarma" Afsana Khwan Humara!!*
> > >
> > >
> > >
> > >
> > > On Tue, Apr 10, 2012 at 6:23 PM, Dorababu Meka 
> > > wrote:
> > >
> > > > How Can I insert data in to the table if I comment that line as per
> you
> > > > said..
> > > >
> > > > Session value exists if I comment that line..
> > > >
> > > > On Tue, Apr 10, 2012 at 6:20 PM, Taleeb Anwar  >
> > > > wrote:
> > > >
> > > > > Though I don't know much about .NET...still
> > > > >
> > > > > Try the following
> > > > > Comment the execute non query. Now Click on button 1 (no values
> will
> > be
> > > > > inserted) and then on button 2. Is session value retained or lost?
> > > > >
> > > > > Thanks & Regards
> > > > > Taleeb Anwar
> > > > >
> > > > > *Hai Ab bhi Tera "Shwarma" Afsana Khwan Humara!!*
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > On Tue, Apr 10, 2012 at 5:40 PM, Dorababu Meka <
> dora.m...@gmail.com>
> > > > > wrote:
> > > > >
> > > > > > This is my code that I have written in .Net
> > > > > >
> > > > > > protected void Page_Load(object sender, EventArgs e)
> > > > > >{
> > > > > >
> > > > > >if (!IsPostBack)
> > > > > >{
> > > > > >Session["x"] = "session value"; // assigning Session
> > > > > >}
> > > > > >}
> > > > > >
> > > > > > My code to insert data to the Database is as follows
> > > > > >
> > > > > > protected void Button1_Click(object sender, EventArgs e)
> > > > > >{
> > > > > >string path = Server.MapPath("bin/sampldb.db");
> > > > > >SQLiteConnection conn = new SQLiteConnection("Data
> Source="
> > +
> > > > path
> > > > > > + "");
> > > > > >try
> > > > > >{
> > > > > >conn.Open();
> > > > > >SQLiteCommand cmd = new SQLiteCommand();
> > > > > >cmd.Connection = conn;
> > > > > >string txt = "insert into stu values(" +
> TextBox1.Text +
> > > > ",'"
> > > > > +
> > > > > > TextBox2.Text + "')";
> > > > > >cmd.CommandType = CommandType.Text;
> > > > > >cmd.CommandText = txt;
> > > > > >cmd.ExecuteNonQuery();
> > > > > >conn.Close();
> > > > > >
> > > > > >}
> > > > > >catch (Exception ex)
> > > > > >{
> > > > > >Label1.Visible = true;
> > > > > >Label1.Text = "Error:" + ex.Message;
> > > > > >}
> > > > > >}
> > > > > >
> > > > > > My code to test whether Session exists or not after Inserting
> data
> > is
> > > > as
> > > > > > follows
> > > > > >
> > > > > > protected void Button2_Click(object sender, EventArgs e)
> > > > > >{
> > > > > >if (Session["x"] != null)  // Here after Inserting data
> and
> > > > > > clicking on the next button available my Session value is getting
> > > Null
> > > > > >{
> > > > > >Label1.Visible = true;
> > > > > >Label1.Text = Session["x"].ToString();
> > > > > > }
> > > > > > }
> > > > > >
> > > > > > This is the over all code I have written in my application
> > > > > >
> > > > > > On Tue, Apr 10, 2012 at 5:35 PM, TeDe  wrote:
> > > > > >
> > > > > > > Am 10.04.2012 11:17, schrieb Dorababu Meka:
> > > > > > > > Hi I am using SQLLITE database in my .net application.
> > > > Unfortunately
> > > > > > if I
> > > > > > > > perform any operation like Insert and performing other
> > operations
> > > > > like
> > > > > > > > getting data from database my Session which was assigned
> before
> > > is
> > > > > > > getting *
> > > > > > > > NULL.* Is this a bug or what, have you fixed this in later
> > > > versions,
> > > > > if
> > > > > > > so
> > > > > > > > plea

Re: [sqlite] Issue with Session while using SQLLITE database

2012-04-11 Thread Taleeb Anwar
Ok. Here's what I guess is happening. You are making changes in you db file
which is stored inside your bin directory. When there is a change in the
bin directory* the App pool recycles *and thus you loose the session
variable.

There must be several ways of avoiding it - perhaps the following will work
In your web.config add the following







Hope it helps...

Thanks & Regards
Taleeb Anwar

*Hai Ab bhi Tera "Shwarma" Afsana Khwan Humara!!*




On Tue, Apr 10, 2012 at 6:26 PM, Dorababu Meka  wrote:

> Yeah on Inserting or Updating the session is getting *NULL*
>
> On Tue, Apr 10, 2012 at 6:25 PM, Taleeb Anwar 
> wrote:
>
> > Of course the value will not be inserted - but just wanted to make sure
> > that the problem is occurring on insertion..!
> >
> > Thanks & Regards
> > Taleeb Anwar
> >
> > *Hai Ab bhi Tera "Shwarma" Afsana Khwan Humara!!*
> >
> >
> >
> >
> > On Tue, Apr 10, 2012 at 6:23 PM, Dorababu Meka 
> > wrote:
> >
> > > How Can I insert data in to the table if I comment that line as per you
> > > said..
> > >
> > > Session value exists if I comment that line..
> > >
> > > On Tue, Apr 10, 2012 at 6:20 PM, Taleeb Anwar 
> > > wrote:
> > >
> > > > Though I don't know much about .NET...still
> > > >
> > > > Try the following
> > > > Comment the execute non query. Now Click on button 1 (no values will
> be
> > > > inserted) and then on button 2. Is session value retained or lost?
> > > >
> > > > Thanks & Regards
> > > > Taleeb Anwar
> > > >
> > > > *Hai Ab bhi Tera "Shwarma" Afsana Khwan Humara!!*
> > > >
> > > >
> > > >
> > > >
> > > > On Tue, Apr 10, 2012 at 5:40 PM, Dorababu Meka 
> > > > wrote:
> > > >
> > > > > This is my code that I have written in .Net
> > > > >
> > > > > protected void Page_Load(object sender, EventArgs e)
> > > > >{
> > > > >
> > > > >if (!IsPostBack)
> > > > >{
> > > > >Session["x"] = "session value"; // assigning Session
> > > > >}
> > > > >}
> > > > >
> > > > > My code to insert data to the Database is as follows
> > > > >
> > > > > protected void Button1_Click(object sender, EventArgs e)
> > > > >{
> > > > >string path = Server.MapPath("bin/sampldb.db");
> > > > >SQLiteConnection conn = new SQLiteConnection("Data Source="
> +
> > > path
> > > > > + "");
> > > > >try
> > > > >{
> > > > >conn.Open();
> > > > >SQLiteCommand cmd = new SQLiteCommand();
> > > > >cmd.Connection = conn;
> > > > >string txt = "insert into stu values(" + TextBox1.Text +
> > > ",'"
> > > > +
> > > > > TextBox2.Text + "')";
> > > > >cmd.CommandType = CommandType.Text;
> > > > >cmd.CommandText = txt;
> > > > >cmd.ExecuteNonQuery();
> > > > >conn.Close();
> > > > >
> > > > >}
> > > > >catch (Exception ex)
> > > > >{
> > > > >Label1.Visible = true;
> > > > >Label1.Text = "Error:" + ex.Message;
> > > > >}
> > > > >}
> > > > >
> > > > > My code to test whether Session exists or not after Inserting data
> is
> > > as
> > > > > follows
> > > > >
> > > > > protected void Button2_Click(object sender, EventArgs e)
> > > > >{
> > > > >if (Session["x"] != null)  // Here after Inserting data and
> > > > > clicking on the next button available my Session value is getting
> > Null
> > > > >{
> > > > >Label1.Visible = true;
> > > > >Label1.Text = Session["x"].ToString();
> > > > > }
> > > > > }
> > > > >
> > > > > This is the over all code I have written in my application
> > > > >
> > > > > On Tue, Apr 10, 2012 at 5:35 PM, TeDe  wrote:
> > > > >
> > > > > > Am 10.04.2012 11:17, schrieb Dorababu Meka:
> > > > > > > Hi I am using SQLLITE database in my .net application.
> > > Unfortunately
> > > > > if I
> > > > > > > perform any operation like Insert and performing other
> operations
> > > > like
> > > > > > > getting data from database my Session which was assigned before
> > is
> > > > > > getting *
> > > > > > > NULL.* Is this a bug or what, have you fixed this in later
> > > versions,
> > > > if
> > > > > > so
> > > > > > > please let me know.
> > > > > > >
> > > > > > > I am using Visual Studio 2010..
> > > > > > >
> > > > > > We have been using System.Data.SQLite for many years, without
> major
> > > > > > bugs. So its unlikely you found one. Instead the way you are
> using
> > > the
> > > > > > Framework might be somehow erroneous.
> > > > > >
> > > > > > If you ask these kind of questions, please post some lines of
> > > relevant
> > > > > > code. With such an unspecific information, nobody is able to help
> > > you.
> > > > > >
> > > > > > Thomas
> > > > > > ___
> > > > > > sqlite-users mailing list
> > > > > > sqlite-users@sqlite.org
> > > > > > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > -